MEPP2 Project
Graph_properties_aif.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 Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, 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 
15 
16 #include <CGAL/boost/graph/properties.h> // for boost::vertex_point_t
17 
18 
23 
24 
25 /*
26  * A class that associate a vertex/edge/face descriptor to an index,
27  * that will be used as a property map key.
28  */
29 template< typename VEF >
31  : public boost::put_get_helper< unsigned int, AIF_index_pmap< VEF > >
32 {
33 public:
34  typedef boost::readable_property_map_tag category;
35  // typedef boost::read_write_property_map_tag category;
36  // typedef boost::lvalue_property_map_tag category;
37  typedef unsigned int value_type;
38  typedef unsigned int reference;
39  typedef VEF key_type;
40 
41  value_type operator[](const key_type &vd) const
42  {
43  return static_cast< value_type >(vd->GetIndex());
44  }
45 };
46 
47 
48 namespace boost {
49 
50 // FACE
51 template<>
52 struct property_map< FEVV::DataStructures::AIF::AIFMesh, boost::face_index_t >
53 {
58 };
59 // FACE
60 
61 // VERTEX
62 template<>
63 struct property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >
64 {
69 };
70 template<>
71 struct property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_point_t >
72 {
75 };
76 // VERTEX
77 
78 // HALFEDGE
79 template<>
80 struct property_map< FEVV::DataStructures::AIF::AIFMesh,
81  boost::halfedge_index_t >
82 {
87 };
88 // HALFEDGE
89 
90 // EDGE
91 template<>
92 struct property_map< FEVV::DataStructures::AIF::AIFMesh, boost::edge_index_t >
93 {
98 };
99 // EDGE
100 
101 /*****************************************************************************/
102 
106 inline typename boost::property_map< FEVV::DataStructures::AIF::AIFMesh,
107  boost::vertex_index_t >::const_type
108 get(const boost::vertex_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
109 {
110  return AIF_index_pmap< typename boost::graph_traits<
112 }
113 
118 get(const boost::vertex_point_t, FEVV::DataStructures::AIF::AIFMesh &m)
119 {
121  m.GetPropertyMap< AIFVertex::ptr, Point >("v:point");
122  return *pm;
123 }
124 
130 get(const boost::vertex_point_t, const FEVV::DataStructures::AIF::AIFMesh &m)
131 {
133  const_cast< FEVV::DataStructures::AIF::AIFMesh & >(m)
134  .GetPropertyMap< AIFVertex::ptr, Point >("v:point");
135  return *pm;
136 }
137 
138 /*****************************************************************************/
139 
143 inline typename boost::property_map< FEVV::DataStructures::AIF::AIFMesh,
144  boost::face_index_t >::const_type
145 get(const boost::face_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
146 {
147  return AIF_index_pmap< typename boost::graph_traits<
148  FEVV::DataStructures::AIF::AIFMesh >::face_descriptor >();
149 }
150 
151 /*****************************************************************************/
152 
156 inline typename boost::property_map< FEVV::DataStructures::AIF::AIFMesh,
157  boost::edge_index_t >::const_type
158 get(const boost::edge_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
159 {
160  return AIF_index_pmap< typename boost::graph_traits<
161  FEVV::DataStructures::AIF::AIFMesh >::edge_descriptor >();
162 }
163 
164 /*****************************************************************************/
165 } // namespace boost
166 
167 
168 namespace FEVV {
169 namespace DataStructures {
170 namespace AIF {
171 
173 template< typename ValueT, typename KeyT >
174 inline ValueT &
176 {
177  return pm[k];
178 }
179 
180 /*****************************************************************************/
181 
183 inline typename boost::property_traits< typename boost::property_map<
185  boost::vertex_index_t >::const_type >::value_type
186 get(const boost::vertex_index_t &prop,
188  const typename boost::graph_traits<
190 {
191  auto pm_index = boost::get(prop, sm);
192  return get(pm_index, k);
193 }
194 
195 /*****************************************************************************/
196 
198 inline Point
199 get(const boost::vertex_point_t &prop,
201  typename boost::graph_traits<
203 {
205  boost::get(prop, sm);
206  return get(pm_pos, k);
207 }
208 
209 /*****************************************************************************/
210 
212 template< typename ValueT, typename KeyT >
213 inline void
215  KeyT k,
216  const ValueT &v)
217 {
218  pm[k] = v;
219 }
220 
221 /*****************************************************************************/
222 
224 template< typename ValueT >
225 inline void
226 put(const boost::vertex_index_t &prop,
228  const typename boost::graph_traits<
230  // const typename boost::property_map<typename
231  // FEVV::DataStructures::AIF::AIFMesh,
232  // boost::vertex_index_t>::const_type>::value_type& v
233  const ValueT &v)
234 {
235  typedef typename boost::property_map< FEVV::DataStructures::AIF::AIFMesh,
236  boost::vertex_index_t >::type Map;
237  Map pm = get(prop, sm);
238  // auto pm = boost::get(prop, sm);
239  put(pm, k, v);
240 }
241 
242 /*****************************************************************************/
243 
245 inline void
246 put(const boost::vertex_point_t &/*prop*/,
248  const typename boost::graph_traits<
250  const typename boost::graph_traits<
251  FEVV::DataStructures::AIF::AIFMesh >::vertex_property_type &/*vp*/)
252 {
253  assert(false);
254  // auto pos_pm = boost::get(boost::vertex_point, sm);
255  // boost::put(pos_pm, k, vp);
256 }
257 
258 /*****************************************************************************/
259 
260 // boost MutablePropertyGraph Concept
261 inline typename boost::graph_traits<
263 add_vertex(typename boost::graph_traits<
264  FEVV::DataStructures::AIF::AIFMesh >::vertex_property_type vp,
266 {
267  // typedef FEVV::DataStructures::AIF::AIFTopologyHelpers AIFHelpers; //
268  // AIFHelpers type is defined in Graph_traits_aif.h
269  typename boost::graph_traits<
272  auto pm = boost::get(boost::vertex_point, sm);
273  put(pm, v, vp);
274  return v;
275 }
276 
277 } // namespace AIF
278 } // namespace DataStructures
279 } // namespace FEVV
280 
FEVV::DataStructures::AIF::AIFVertex::ptr
boost::shared_ptr< self > ptr
Definition: AIFVertex.hpp:47
AIF_index_pmap
Definition: Graph_properties_aif.h:32
AIF_index_pmap::key_type
VEF key_type
Definition: Graph_properties_aif.h:39
Vector
AIFMesh::Vector Vector
Definition: Graph_properties_aif.h:22
FEVV::DataStructures::AIF::AIFVertex
This class represents a vertex used by AIFMesh objects. An AIFVertex natively saves relations with it...
Definition: AIFVertex.hpp:41
boost
Definition: Graph_properties_aif.h:48
Point
AIFMesh::Point Point
Definition: Graph_properties_aif.h:21
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::const_type
AIF_index_pmap< boost::graph_traits< AIFMesh >::vertex_descriptor > const_type
Definition: Graph_properties_aif.h:68
FEVV::DataStructures::AIF::get
ValueT & get(const typename FEVV::DataStructures::AIF::PropertyMap< ValueT > &pm, KeyT k)
Specialization of get(pmap, key) for AIF.
Definition: Graph_properties_aif.h:175
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_point_t >::type
FEVV::DataStructures::AIF::PropertyMap< Point > type
Definition: Graph_properties_aif.h:73
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::face_index_t >::const_type
AIF_index_pmap< boost::graph_traits< AIFMesh >::face_descriptor > const_type
Definition: Graph_properties_aif.h:57
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::halfedge_index_t >::type
AIF_index_pmap< boost::graph_traits< AIFMesh >::halfedge_descriptor > type
Definition: Graph_properties_aif.h:84
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_point_t >::const_type
FEVV::DataStructures::AIF::PropertyMap< Point > const_type
Definition: Graph_properties_aif.h:74
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::edge_index_t >::type
AIF_index_pmap< boost::graph_traits< AIFMesh >::edge_descriptor > type
Definition: Graph_properties_aif.h:95
AIFVertex
FEVV::DataStructures::AIF::AIFVertex AIFVertex
Definition: Graph_properties_aif.h:20
FEVV::DataStructures::AIF::PropertyMap
Definition: AIFProperties.h:381
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::halfedge_index_t >::const_type
AIF_index_pmap< boost::graph_traits< AIFMesh >::halfedge_descriptor > const_type
Definition: Graph_properties_aif.h:86
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
AIFMesh.hpp
AIF_index_pmap::category
boost::readable_property_map_tag category
Definition: Graph_properties_aif.h:34
AIF_index_pmap::reference
unsigned int reference
Definition: Graph_properties_aif.h:38
Graph_traits_aif.h
FEVV::DataStructures::AIF::AIFVector
Definition: AIFProperties.h:173
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::face_index_t >::type
AIF_index_pmap< boost::graph_traits< AIFMesh >::face_descriptor > type
Definition: Graph_properties_aif.h:55
FEVV::DataStructures::AIF::add_vertex
boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_descriptor add_vertex(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::vertex_property_type vp, FEVV::DataStructures::AIF::AIFMesh &sm)
Definition: Graph_properties_aif.h:263
boost::get
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::const_type get(const boost::vertex_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
Returns the vertex index property map of the mesh.
Definition: Graph_properties_aif.h:108
msdm2::vertex_descriptor
boost::graph_traits< MeshT >::vertex_descriptor vertex_descriptor
Definition: msdm2_surfacemesh.h:33
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition: AIFMesh.hpp:47
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::edge_index_t >::const_type
AIF_index_pmap< boost::graph_traits< AIFMesh >::edge_descriptor > const_type
Definition: Graph_properties_aif.h:97
AIF_index_pmap::value_type
unsigned int value_type
Definition: Graph_properties_aif.h:37
FEVV::DataStructures::AIF::AIFTopologyHelpers::add_vertex
static vertex_descriptor add_vertex(ptr_mesh mesh)
Definition: AIFTopologyHelpers.h:2709
AIF_index_pmap::operator[]
value_type operator[](const key_type &vd) const
Definition: Graph_properties_aif.h:41
AIFMesh
FEVV::DataStructures::AIF::AIFMesh AIFMesh
Definition: Graph_properties_aif.h:19
FEVV::DataStructures::AIF::AIFMesh::GetPropertyMap
PropertyMap< T > * GetPropertyMap(const std::string &mapName)
Definition: AIFMesh.hpp:383
FEVV::DataStructures::AIF::AIFPoint
Definition: AIFProperties.h:31
FEVV::DataStructures::AIF::put
void put(const typename FEVV::DataStructures::AIF::PropertyMap< ValueT > &pm, KeyT k, const ValueT &v)
Specialization of put(pmap, key, value) for AIF.
Definition: Graph_properties_aif.h:214
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::type
AIF_index_pmap< boost::graph_traits< AIFMesh >::vertex_descriptor > type
Definition: Graph_properties_aif.h:66