MEPP2 Project
properties_cgal_point_set.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
16 
17 #include <string>
18 
19 
20 namespace FEVV {
21 
22 // _PMap_traits specialization for FEVV::CGALPointSet
23 // use CGAL::Point_set_3 internal property maps
24 // (which are the same as CGAL::Surface_mesh internal
25 // property maps)
26 
27 
28 // define default property map type (associative property map,
29 // vector property map...) for each cell type (vertex, face...) ;
30 
31 // a counter used to generate a unique property map identifier
33 
34 // default vertex property map
35 template< typename ValueT >
37 {
38  // use CGAL::Point_set_3 internal property map
39  typedef typename FEVV::CGALPointSet::Property_map< ValueT > pmap_type;
40 
42  {
43  std::string name = std::to_string(cgal_point_set_prop_map_counter);
45  return const_cast< FEVV::CGALPointSet & >(m)
46  .add_property_map< ValueT >(name)
47  .first;
48  }
49 };
50 
51 #if 0 // useless for point cloud
52 
53 // default face property map
54 template< typename ValueT >
55 struct Face_pmap_traits< FEVV::CGALPointSet, ValueT >
56 {
57  typedef typename boost::property_map< FEVV::CGALPointSet,
58  boost::face_index_t >::const_type
59  face_index_map_type;
60  typedef typename boost::vector_property_map< ValueT, face_index_map_type >
61  pmap_type;
62 
63  static pmap_type create(const FEVV::CGALPointSet &m)
64  {
65  auto index_map = get(boost::face_index, m);
66  pmap_type pmap(index_map);
67  return pmap;
68  }
69 };
70 
71 // default edge property map
72 template< typename ValueT >
73 struct Edge_pmap_traits< FEVV::CGALPointSet, ValueT >
74 {
75  typedef typename boost::property_map< FEVV::CGALPointSet,
76  boost::edge_index_t >::const_type
77  edge_index_map_type;
78  typedef typename boost::vector_property_map< ValueT, edge_index_map_type >
79  pmap_type;
80 
81  static pmap_type create(const FEVV::CGALPointSet &m)
82  {
83  auto index_map = get(boost::edge_index, m);
84  pmap_type pmap(index_map);
85  return pmap;
86  }
87 };
88 
89 // default halfedge property map
90 template< typename ValueT >
91 struct Halfedge_pmap_traits< FEVV::CGALPointSet, ValueT >
92 {
93  typedef typename boost::property_map< FEVV::CGALPointSet,
94  boost::halfedge_index_t >::const_type
95  halfedge_index_map_type;
96  typedef typename boost::vector_property_map< ValueT, halfedge_index_map_type >
97  pmap_type;
98 
99  static pmap_type create(const FEVV::CGALPointSet &m)
100  {
101  auto index_map = get(boost::halfedge_index, m);
102  pmap_type pmap(index_map);
103  return pmap;
104  }
105 };
106 
107 #endif
108 
109 // define standard property map types for (property,cell) pair,
110 // for example vertex-normal
111 
112 // specialize the property maps traits for vertex-normal
113 template<>
115 {
116  typedef FEVV::CGALPointSet::Vector_map pmap_type;
117 
119  {
120  return const_cast< FEVV::CGALPointSet& >(m).add_normal_map().first;
121  }
122 };
123 
124 #if 0
125 // specialize the property maps traits for vertex-tangent
126 template<>
127 struct _PMap_traits< FEVV::CGALPointSet, FEVV::vertex_tangent_t >
128 {
129  typedef FEVV::CGALPointSet::Vector_map pmap_type;
130  typedef FEVV::CGALPointSet::Vector_3 Vector_3;
131 
132  static pmap_type create(const FEVV::CGALPointSet &m)
133  {
134  return const_cast< FEVV::CGALPointSet & >(m)
135  .add_property_map< Vector_3 >("vertex_tangent")
136  .first;
137  }
138 };
139 
140 // specialize the property maps traits for vertex-texcoord
141 template<>
142 struct _PMap_traits< FEVV::CGALPointSet, FEVV::vertex_texcoord_t >
143 {
144  typedef FEVV::CGALPointSet::Vector_map pmap_type;
145  typedef FEVV::CGALPointSet::Vector_3 Vector_3;
146 
147  static pmap_type create(const FEVV::CGALPointSet &m)
148  {
149  return const_cast< FEVV::CGALPointSet & >(m)
150  .add_property_map< Vector_3 >("vertex_texcoord")
151  .first;
152  }
153 };
154 #endif
155 
156 // specialize the standard property map for vertex-color
157 template<>
159 {
161  typedef FEVV::CGALPointSet::Property_map< Color > pmap_type;
162 
164  {
165  return const_cast< FEVV::CGALPointSet & >(m)
166  .add_property_map< Color >("vertex_color")
167  .first;
168  }
169 };
170 
171 // specialize the standard property map for vertex-custom_vector
172 template<>
174 {
175  typedef FEVV::CGALPointSet::Vector_map pmap_type;
176  typedef FEVV::CGALPointSet::Vector_3 Vector_3;
177 
179  {
180  return const_cast< FEVV::CGALPointSet & >(m)
181  .add_property_map< Vector_3 >("vertex_custom_vector")
182  .first;
183  }
184 };
185 
186 // specialize the standard property map for vertex-custom_vector_color
187 template<>
189 {
190  typedef FEVV::CGALPointSet::Vector_map pmap_type; // ask ELO
191  typedef FEVV::CGALPointSet::Vector_3 Vector_3; // ask ELO
192 
194  {
195  return const_cast< FEVV::CGALPointSet & >(m)
196  .add_property_map< Vector_3 >("vertex_custom_vector_color")
197  .first;
198  }
199 };
200 
201 // specialize the standard property map for vertex-custom_vector_param
202 template<>
204 {
205  typedef FEVV::CGALPointSet::Vector_map pmap_type;
206  typedef FEVV::CGALPointSet::Vector_3 Vector_3;
207 
209  {
210  return const_cast< FEVV::CGALPointSet & >(m)
211  .add_property_map< Vector_3 >("vertex_custom_vector_param")
212  .first;
213  }
214 };
215 
216 } // namespace FEVV
FEVV::cgal_point_set_prop_map_counter
static size_t cgal_point_set_prop_map_counter
Definition: properties_cgal_point_set.h:32
Wrappings_cgal_point_set.h
FEVV::CGALPointSet
CGAL::Point_set_3< CGALPointSetPoint > CGALPointSet
Definition: DataStructures_cgal_point_set.h:71
FEVV::Halfedge_pmap_traits::create
static pmap_type create(const MeshT &m)
Definition: properties.h:365
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_color_t >::Vector_3
FEVV::CGALPointSet::Vector_3 Vector_3
Definition: properties_cgal_point_set.h:191
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_t >::pmap_type
FEVV::CGALPointSet::Vector_map pmap_type
Definition: properties_cgal_point_set.h:175
Geometry_traits_cgal_point_set.h
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_color_t >::create
static pmap_type create(const FEVV::CGALPointSet &m)
Definition: properties_cgal_point_set.h:193
FEVV::Edge_pmap_traits::create
static pmap_type create(const MeshT &)
Definition: properties.h:349
FEVV::vertex_custom_vector_color_t
vertex_custom_vector_color_t
Definition: properties.h:57
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_normal_t >::create
static pmap_type create(const FEVV::CGALPointSet &m)
Definition: properties_cgal_point_set.h:118
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_normal_t >::pmap_type
FEVV::CGALPointSet::Vector_map pmap_type
Definition: properties_cgal_point_set.h:116
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_param_t >::Vector_3
FEVV::CGALPointSet::Vector_3 Vector_3
Definition: properties_cgal_point_set.h:206
FEVV::vertex_normal_t
vertex_normal_t
Definition: properties.h:35
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_param_t >::create
static pmap_type create(const FEVV::CGALPointSet &m)
Definition: properties_cgal_point_set.h:208
FEVV::get
FEVV::PCLPointCloudPointMap::value_type get(const FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key)
Specialization of get(point_map, key) for PCLPointCloud.
Definition: Graph_properties_pcl_point_cloud.h:117
FEVV::vertex_tangent_t
vertex_tangent_t
Definition: properties.h:39
FEVV::Vertex_pmap_traits< FEVV::CGALPointSet, ValueT >::pmap_type
FEVV::CGALPointSet::Property_map< ValueT > pmap_type
Definition: properties_cgal_point_set.h:39
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_color_t >::pmap_type
FEVV::CGALPointSet::Property_map< Color > pmap_type
Definition: properties_cgal_point_set.h:161
FEVV::vertex_color_t
vertex_color_t
Definition: properties.h:47
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::Edge_pmap_traits::pmap_type
FEVV::Assoc_property_map< edge_key_type, ValueT > pmap_type
Definition: properties.h:347
FEVV::Vertex_pmap_traits
Definition: properties.h:315
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_t >::create
static pmap_type create(const FEVV::CGALPointSet &m)
Definition: properties_cgal_point_set.h:178
FEVV::vertex_custom_vector_param_t
vertex_custom_vector_param_t
Definition: properties.h:61
FEVV::Halfedge_pmap_traits::pmap_type
FEVV::Assoc_property_map< halfedge_key_type, ValueT > pmap_type
Definition: properties.h:363
FEVV::vertex_custom_vector_t
vertex_custom_vector_t
Definition: properties.h:53
FEVV::Vertex_pmap_traits< FEVV::CGALPointSet, ValueT >::create
static pmap_type create(const FEVV::CGALPointSet &m)
Definition: properties_cgal_point_set.h:41
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_color_t >::Color
FEVV::CGALPointSetColor Color
Definition: properties_cgal_point_set.h:160
FEVV::Face_pmap_traits::create
static pmap_type create(const MeshT &)
Definition: properties.h:335
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_param_t >::pmap_type
FEVV::CGALPointSet::Vector_map pmap_type
Definition: properties_cgal_point_set.h:205
FEVV::CGALPointSetColor
Definition: DataStructures_cgal_point_set.h:40
FEVV::Face_pmap_traits::pmap_type
FEVV::Assoc_property_map< face_key_type, ValueT > pmap_type
Definition: properties.h:333
FEVV::_PMap_traits
Definition: properties.h:376
properties.h
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_t >::Vector_3
FEVV::CGALPointSet::Vector_3 Vector_3
Definition: properties_cgal_point_set.h:176
FEVV::vertex_texcoord_t
vertex_texcoord_t
Definition: properties.h:43
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_custom_vector_color_t >::pmap_type
FEVV::CGALPointSet::Vector_map pmap_type
Definition: properties_cgal_point_set.h:190
FEVV::_PMap_traits< FEVV::CGALPointSet, FEVV::vertex_color_t >::create
static pmap_type create(const FEVV::CGALPointSet &m)
Definition: properties_cgal_point_set.h:163