From 578889e8015d7a44ed5c430f7427eda95ce1ef53 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 8 Sep 2017 18:30:49 +0200 Subject: [PATCH] Fix compilation of mesh_polyhedral_domain.cpp with Polyhedron_3 --- .../CGAL/Mesh_3/properties_Polyhedron_3.h | 19 ++++++++++ .../CGAL/Polyhedral_complex_mesh_domain_3.h | 1 - .../include/CGAL/Polyhedral_mesh_domain_3.h | 36 ++++++++++++++----- .../Polyhedral_mesh_domain_with_features_3.h | 8 ++--- Property_map/include/CGAL/property_map.h | 3 ++ 5 files changed, 54 insertions(+), 13 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/properties_Polyhedron_3.h b/Mesh_3/include/CGAL/Mesh_3/properties_Polyhedron_3.h index ffac64be48a..3f5ebb49373 100644 --- a/Mesh_3/include/CGAL/Mesh_3/properties_Polyhedron_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/properties_Polyhedron_3.h @@ -154,6 +154,25 @@ struct Polyhedron_property_map > }; }; +// 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 Polyhedron_property_map > + : public Polyhedron_property_map > +{ +}; + +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; diff --git a/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h index 0b07a638a67..a314b330aa8 100644 --- a/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h @@ -880,7 +880,6 @@ detect_features(FT angle_in_degree, BOOST_FOREACH(Polyhedron_type& p, poly) { PIDMap pid_map = get(face_patch_id_t(), p); - VIPMap vip_map = get(vertex_incident_patches_t(), p); EIFMap eif = get(CGAL::edge_is_feature, p); const std::size_t polyhedron_id = &p - &poly[0]; BOOST_FOREACH(face_descriptor f, faces(p)) diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 18334a59ffd..e44e20ebe3f 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -32,8 +32,7 @@ #include #include -#include -#include +#include #include #include @@ -53,6 +52,8 @@ #include #include #include +#include +#include #include #include #include @@ -188,8 +189,8 @@ public: struct Primitive { typedef typename boost::graph_traits

::face_descriptor face_descriptor_t; - const P* graph; face_descriptor_t face_descriptor; + const P* graph; typedef Triangle_from_face_descriptor_map

Triangle_pmap; typedef One_point_from_face_descriptor_map

Point_pmap; @@ -223,18 +224,37 @@ public: typedef Primitive

type; static Surface_patch_index get_index(const typename type::Id primitive_id) { - return get(get(face_patch_id_t(), + return get(get(face_patch_id_t(), *primitive_id.graph), primitive_id.face_descriptor); } - }; + }; // Primitive_type (for non-Polyhedron_3) + template struct Primitive_type { typedef AABB_face_graph_triangle_primitive

type; - static Surface_patch_index get_index(const typename type::Id face_handle) { - return face_handle->patch_id(); + static Surface_patch_index get_index(const typename type::Id face_handle, + Tag_false) + { + typename boost::property_map >::type pmap; + return get(pmap, face_handle); } - }; + + static Surface_patch_index get_index(const typename type::Id, + Tag_true) + { + return Surface_patch_index(0,1); + } + + static Surface_patch_index get_index(const typename type::Id face_handle) + { + namespace m = boost::mpl; + return get_index(face_handle, + Boolean_tag, + boost::is_same + >::value>()); + } + }; // Primitive_type specialized for CGAL::Polyehdron_3 public: typedef typename Primitive_type::type Ins_fctor_primitive; 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 1bb805defb4..71704569cb1 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 @@ -463,11 +463,11 @@ detect_features(FT angle_in_degree, std::vector& poly) face_ids[f] = id++; } - typedef typename boost::property_map >::type PIDMap; + typedef typename boost::property_map >::type PIDMap; typedef typename boost::property_map >::type VIPMap; typedef typename boost::property_map::type EIFMap; - PIDMap pid_map = get(face_patch_id_t(), p); + PIDMap pid_map = get(face_patch_id_t(), p); VIPMap vip_map = get(vertex_incident_patches_t(), p); EIFMap eif_map = get(CGAL::edge_is_feature, p); @@ -572,8 +572,8 @@ add_featured_edges_to_graph(const Polyhedron& p, } } - typedef typename boost::property_map >::type Face_patch_id_pmap; - Face_patch_id_pmap fpm = get(face_patch_id_t(),p); + typedef typename boost::property_map >::type Face_patch_id_pmap; + Face_patch_id_pmap fpm = get(face_patch_id_t(),p); BOOST_FOREACH(Graph_edge_descriptor e, edges(graph)){ vertex_descriptor vs = p2vmap[get(vpm,source(e,graph))]; diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 891de5f6a00..1a3cc152a81 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -44,10 +44,13 @@ namespace CGAL { template class Static_property_map { +public: typedef K key_type; typedef V value_type; typedef const V& reference; typedef boost::read_write_property_map_tag category; + +private: V v; public: