// Copyright (c) 2017 GeometryFactory (France). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Andreas Fabri #ifndef CGAL_PROPERTIES_POLYHEDRON_3_FEATURES_H #define CGAL_PROPERTIES_POLYHEDRON_3_FEATURES_H #include #include #define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS namespace CGAL { namespace internal{ BOOST_MPL_HAS_XXX_TRAIT_DEF(Plane_3) template struct Get_static_property_map { typedef boost::graph_traits > Graph_traits; typedef CGAL::Constant_property_map > type; }; } // end namespace internal 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 HDS_property_map, CGAL::face_patch_id_t > { struct bind_ { typedef Polyhedron_face_patch_id_pmap type; typedef type const_type; }; }; 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 HDS_property_map, CGAL::face_patch_id_t > { struct bind_ { typedef typename internal::Get_static_property_map::type type; typedef type const_type; }; }; // Compatibility: when the `Patch_id` template argument of // `Polyhedron_mesh_domain` is `Tag_true` (because that argument was named // `UsePatchId` in previous versions of CGAL. template struct HDS_property_map, CGAL::face_patch_id_t > { struct bind_ { typedef Polyhedron_3 Polyhedron; typedef Polyhedron_face_patch_id_pmap type; typedef type const_type; }; }; // Compatibility: when the `Patch_id` template argument of // `Polyhedron_mesh_domain` is `Tag_false` (because that argument was named // `UsePatchId` in previous versions of CGAL. template struct HDS_property_map, CGAL::face_patch_id_t > : public HDS_property_map, CGAL::face_patch_id_t > { }; 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& p) { return get(CGAL::face_patch_id_t(), p); } 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 HDS_property_map, CGAL::vertex_feature_degree_t> { 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 e) { return e.halfedge()->is_feature_edge() || e.halfedge()->opposite()->is_feature_edge(); } template void put(Polyhedron_is_feature_edge_pmap, Handle_type e, bool b) { e.halfedge()->set_feature_edge(b); e.halfedge()->opposite()->set_feature_edge(b); } template struct HDS_property_map, CGAL::edge_is_feature_t> { struct bind_ { typedef Polyhedron_is_feature_edge_pmap type; typedef type const_type; }; }; template struct Polyhedron_incident_patches_pmap { typedef void key_type; typedef std::set value_type; typedef std::set& reference; typedef boost::lvalue_property_map_tag category; template reference operator[](Handle_type h) const { return get(*this, h); } }; 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) { h->clear_incident_patches(); for(Patch_id n : v) h->add_incident_patch(n); } template struct HDS_property_map, CGAL::vertex_incident_patches_t > { struct bind_ { typedef Polyhedron_incident_patches_pmap type; typedef type const_type; }; }; } // end namespace CGAL #undef CGAL_HDS_PARAM_ #endif // CGAL_PROPERTIES_POLYHEDRON_3_FEATURES_H