diff --git a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h index bc666e097bd..b394bbcd317 100644 --- a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h +++ b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h @@ -35,8 +35,6 @@ #include -#include - namespace CGAL { namespace Mesh_3 { @@ -216,220 +214,6 @@ struct Mesh_polyhedron_3 typedef Polyhedron_3 > type; typedef type Type; }; - -template -struct Time_stamp_pmap -{ - typedef std::size_t& reference; - typedef std::size_t value_type; - typedef Handle key_type; - typedef boost::writable_property_map_tag category; - - friend std::size_t get(const Time_stamp_pmap&, key_type h) - { - return h->time_stamp(); - } - - friend void put(const Time_stamp_pmap&, key_type h, - std::size_t ts) - { - h->set_time_stamp(ts); - } - -}; - - -template -struct Patch_id_pmap { - - typedef typename Mesh_polyhedron_3::type Polyhedron; - typedef typename Polyhedron::Face_handle key_type; - typedef typename Polyhedron::Facet::Patch_id value_type; - typedef value_type reference; - typedef boost::writable_property_map_tag category; - - friend Patch_id get(const Patch_id_pmap&, key_type h) - { - return h->patch_id(); - } - - friend void put(const Patch_id_pmap&, key_type h, - Patch_id pid) - { - h->set_patch_id(pid); - } - -}; - - -template -inline Patch_id_pmap -get(CGAL::face_patch_id_t, - const Polyhedron_3 >&) -{ - return Patch_id_pmap(); -} - - -namespace internal{ -BOOST_MPL_HAS_XXX_TRAIT_DEF(Plane_3) -} - -template -struct Get_static_property_map { - typedef CGAL::static_property_map > >::face_descriptor,std::pair > type; -}; - -template -typename boost::lazy_enable_if< -internal::has_Plane_3, -Get_static_property_map ->::type - inline get(CGAL::face_patch_id_t, Polyhedron_3 >& ) -{ - typedef CGAL::static_property_map > >::face_descriptor,std::pair > Pmap; - - return Pmap(std::make_pair(0,1)); -} - - -template -struct vertex_num_feature_edges_pmap { - - typedef typename Mesh_polyhedron_3::type Polyhedron; - typedef typename Polyhedron::Vertex_handle key_type; - typedef int value_type; - friend int get(const vertex_num_feature_edges_pmap&, key_type h) - { - return h->nb_of_feature_edges; - } - - friend void put(const vertex_num_feature_edges_pmap&, key_type h, int n) - { - h->nb_of_feature_edges = n; - } - -}; - - -template -inline vertex_num_feature_edges_pmap -get(vertex_num_feature_edges_t, - const Polyhedron_3 >&) -{ - return vertex_num_feature_edges_pmap(); -} - - -template -struct Is_feature_pmap { - typedef typename Mesh_polyhedron_3::type Polyhedron; - typedef typename Polyhedron::Halfedge_handle key_type; - typedef bool value_type; - - friend bool get(const Is_feature_pmap&, key_type h) - { - return h->is_feature_edge(); - } - - friend void put(const Is_feature_pmap&, key_type h, bool b) - { - h->set_feature_edge(b); - } - -}; - - -template -inline Is_feature_pmap -get(halfedge_is_feature_t, - const Polyhedron_3 >&) -{ - return Is_feature_pmap (); -} - - -template -struct vertex_incident_patches_pmap { - typedef typename Mesh_polyhedron_3::type Polyhedron; - typedef typename Polyhedron::Vertex_handle key_type; - typedef typename std::set value_type; - typedef typename boost::read_write_property_map_tag category; - - friend value_type get(const vertex_incident_patches_pmap&, const key_type& h) - { - return h->incident_patches_ids_set(); - } - - friend void put(const vertex_incident_patches_pmap&, const key_type& k , value_type& v) - { - BOOST_FOREACH(Patch_id n, v) - k->add_incident_patch(n); - } - -}; - -template -inline vertex_incident_patches_pmap -get(CGAL::vertex_incident_patches_t, - const Polyhedron_3 >&) -{ - return vertex_incident_patches_pmap(); -} - } // end namespace CGAL -namespace boost { - - template - struct property_map >, CGAL::face_patch_id_t > - { - typedef CGAL::Patch_id_pmap type; - }; - - template - struct property_map >, CGAL::vertex_num_feature_edges_t> - { - typedef CGAL::vertex_num_feature_edges_pmap type; - }; - - template - struct property_map >, CGAL::halfedge_is_feature_t> - { - typedef CGAL::Is_feature_pmap type; - }; - - template - struct property_map >, CGAL::vertex_incident_patches_t > - { - typedef CGAL::vertex_incident_patches_pmap type; - }; - - template - struct property_map >, CGAL::vertex_time_stamp_t> - { - typedef CGAL::Polyhedron_3 > Graph; - typedef CGAL::Time_stamp_pmap::vertex_descriptor> type; - }; - - - template - struct property_map >, CGAL::halfedge_time_stamp_t> - { - typedef CGAL::Polyhedron_3 > Graph; - typedef CGAL::Time_stamp_pmap::halfedge_descriptor> type; - }; - - - template - struct property_map >, CGAL::face_time_stamp_t> - { - typedef CGAL::Polyhedron_3 > Graph; - typedef CGAL::Time_stamp_pmap::face_descriptor> type; - }; -} // namespace boost - #endif // CGAL_MESH_POLYHEDRON_3_H diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h index 3bc1ad325d6..655916d2778 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include diff --git a/Polyhedron/include/CGAL/boost/graph/PMP_properties_Polyhedron_3.h b/Polyhedron/include/CGAL/boost/graph/PMP_properties_Polyhedron_3.h new file mode 100644 index 00000000000..440a771ca55 --- /dev/null +++ b/Polyhedron/include/CGAL/boost/graph/PMP_properties_Polyhedron_3.h @@ -0,0 +1,314 @@ +// Copyright (c) 2017 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_PMP_PROPERTIES_POLYHEDRON_3_H +#define CGAL_PMP_PROPERTIES_POLYHEDRON_3_H + +#include + +#include +#include + +#define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS + +namespace CGAL { + +struct Polyhedron_face_time_stamp_pmap +{ + typedef void key_type; + typedef std::size_t value_type; + typedef std::size_t reference; + typedef boost::read_write_property_map_tag category; +}; + +template +std::size_t get(Polyhedron_face_time_stamp_pmap, Handle_type h) +{ + return h->time_stamp(); +} + +template +void put(Polyhedron_face_time_stamp_pmap, Handle_type h, + std::size_t ts) +{ + h->set_time_stamp(ts); +} + +template <> +struct Polyhedron_property_map +{ + template + struct bind_ + { + typedef Polyhedron_face_time_stamp_pmap type; + typedef type const_type; + }; +}; + +template <> +struct Polyhedron_property_map + : public Polyhedron_property_map +{}; + +template <> +struct Polyhedron_property_map + : public Polyhedron_property_map +{}; + + +template +struct Polyhedron_face_patch_id_pmap { + typedef void key_type; + typedef Patch_id value_type; + typedef Patch_id reference; + typedef boost::read_write_property_map_tag category; +}; + +template +Patch_id get(Polyhedron_face_patch_id_pmap, Handle_type h) +{ + return h->patch_id(); +} + +template +void put(Polyhedron_face_patch_id_pmap, Handle_type h, + Patch_id pid) +{ + h->set_patch_id(pid); +} + +template +struct Polyhedron_property_map > +{ + template + struct bind_ + { + typedef Polyhedron_face_patch_id_pmap type; + typedef type const_type; + }; +}; + + + +namespace internal{ +BOOST_MPL_HAS_XXX_TRAIT_DEF(Plane_3) + +template +struct Get_static_property_map { + typedef boost::graph_traits > Graph_traits; + typedef CGAL::static_property_map > type; +}; + +} // end namespace internal + +template +typename boost::lazy_enable_if< + internal::has_Plane_3, + internal::Get_static_property_map + >::type +get(CGAL::face_patch_id_t, const Polyhedron_3&) +{ + typedef typename internal::Get_static_property_map::type Pmap; + return Pmap( std::pair(0,1) ); +} + +template <> +struct Polyhedron_property_map > +{ + template + struct bind_ + { + typedef typename internal::Get_static_property_map::type type; + typedef type const_type; + }; +}; + + + +struct Polyhedron_num_feature_edges_pmap { + typedef void key_type; + typedef int value_type; + typedef int reference; + typedef boost::read_write_property_map_tag category; +}; + +template +int get(Polyhedron_num_feature_edges_pmap, Handle_type h) +{ + return h->nb_of_feature_edges; +} + +template +void put(Polyhedron_num_feature_edges_pmap, Handle_type h, int n) +{ + h->nb_of_feature_edges = n; +} + + +template <> +struct Polyhedron_property_map +{ + template + struct bind_ + { + typedef Polyhedron_num_feature_edges_pmap type; + typedef type const_type; + }; +}; + +struct Polyhedron_is_feature_edge_pmap { + typedef void key_type; + typedef bool value_type; + typedef bool reference; + typedef boost::read_write_property_map_tag category; +}; + +template +bool get(Polyhedron_is_feature_edge_pmap, Handle_type h) +{ + return h->is_feature_edge(); +} + +template +void put(Polyhedron_is_feature_edge_pmap, Handle_type h, bool b) +{ + h->set_feature_edge(b); +} + +template <> +struct Polyhedron_property_map +{ + template + struct bind_ + { + typedef Polyhedron_is_feature_edge_pmap type; + typedef type const_type; + }; +}; + +// template +// inline Is_feature_pmap +// get(halfedge_is_feature_t, +// const Polyhedron_3 >&) +// { +// return Is_feature_pmap (); +// } + + +template +struct Polyhedron_incident_patches_pmap { + typedef void key_type; + typedef std::set value_type; + typedef std::set& reference; + typedef boost::read_write_property_map_tag category; +}; + +template +std::set& get(Polyhedron_incident_patches_pmap, + Handle_type h) +{ + return h->incident_patches_ids_set(); +} + +template +void put(Polyhedron_incident_patches_pmap, + Handle_type h, const std::set& v) +{ + BOOST_FOREACH(Patch_id n, v) + h->add_incident_patch(n); +} + +template +struct Polyhedron_property_map > +{ + template + struct bind_ + { + typedef Polyhedron_incident_patches_pmap type; + typedef type const_type; + }; +}; + +// template +// inline vertex_incident_patches_pmap +// get(CGAL::vertex_incident_patches_t, +// const Polyhedron_3 >&) +// { +// return vertex_incident_patches_pmap(); +// } + +} // end namespace CGAL + +namespace boost { + + // template + // struct property_map, + // CGAL::vertex_time_stamp_t> + // { + // typedef CGAL::Polyhedron_face_time_stamp_pmap type; + // }; + + // template + // struct property_map, + // CGAL::halfedge_time_stamp_t> + // { + // typedef CGAL::Polyhedron_face_time_stamp_pmap type; + // }; + + // template + // struct property_map, + // CGAL::face_time_stamp_t> + // { + // typedef CGAL::Polyhedron_face_time_stamp_pmap type; + // }; + + // template + // struct property_map, + // CGAL::face_patch_id_t > + // { + // typedef CGAL::Polyhedron_face_patch_id_pmap type; + // }; + + // template + // struct property_map, + // CGAL::vertex_num_feature_edges_t> + // { + // typedef CGAL::Polyhedron_num_feature_edges_pmap type; + // }; + + // template + // struct property_map, + // CGAL::halfedge_is_feature_t> + // { + // typedef CGAL::Polyhedron_is_feature_edge_pmap type; + // }; + + // template + // struct property_map, + // CGAL::vertex_incident_patches_t > + // { + // typedef CGAL::Polyhedron_incident_patches_pmap type; + // }; + +} // namespace boost + +#undef CGAL_HDS_PARAM_ + +#endif // CGAL_PMP_PROPERTIES_POLYHEDRON_3_H