From 9cd67621989bc50df3b628411caa9db1ea796f68 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Mon, 13 May 2024 17:25:33 +0200 Subject: [PATCH] adapting examples --- .../draw_surface_mesh_small_faces.cpp | 17 ++++++------ .../internal/compute_confidences.h | 6 ++--- .../internal/hypothesis.h | 26 +++++++++---------- .../include/CGAL/Surface_mesh/Properties.h | 1 + .../graph/properties_Surface_mesh_features.h | 4 +-- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp index 396f3a9a814..53fd54f92a8 100644 --- a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp +++ b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp @@ -27,17 +27,18 @@ struct Graphics_scene_options_small_faces: Graphics_scene_options_small_faces(const SM& sm): Base(), m_sm(sm) { - typename SM::template Property_map faces_size; - boost::tie(faces_size, m_with_size)=sm.template property_map("f:size"); + std::optional> faces_size + = sm.template property_map("f:size"); + m_with_size = faces_size.has_value(); if(!m_with_size) { return; } - m_min_size=faces_size[*(sm.faces().begin())]; + m_min_size=(*faces_size)[*(sm.faces().begin())]; m_max_size=m_min_size; FT cur_size; for (typename SM::Face_range::iterator f=sm.faces().begin(); f!=sm.faces().end(); ++f) { - cur_size=faces_size[*f]; + cur_size=(*faces_size)[*f]; if (cur_sizem_max_size) m_max_size=cur_size; } @@ -60,12 +61,12 @@ struct Graphics_scene_options_small_faces: // Compare the size of the face with the % m_threshold bool exist; - typename SM::template Property_map faces_size; - boost::tie(faces_size, exist)=sm.template property_map("f:size"); - assert(exist); + std::optional> faces_size + =sm.template property_map("f:size"); + assert(faces_size.has_value()); // If the face is small, color it in red. - if (get(faces_size, fh) face_supporting_segments = - mesh.template property_map("f:supp_segment").first; + *mesh.template property_map("f:supp_segment"); Planar_segment* segment = face_supporting_segments[face]; if (segment == nullptr) @@ -123,7 +123,7 @@ namespace internal { // The supporting plane of each face typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; + *mesh.template property_map("f:supp_plane"); // We do everything by projecting the point onto the face's supporting plane const Plane* supporting_plane = face_supporting_planes[face]; CGAL_assertion(supporting_plane == segment->supporting_plane()); @@ -186,7 +186,7 @@ namespace internal { // The supporting plane of each face typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; + *mesh.template property_map("f:supp_plane"); FT degenerate_face_area_threshold = CGAL::snap_squared_distance_threshold() * CGAL::snap_squared_distance_threshold(); diff --git a/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/hypothesis.h b/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/hypothesis.h index 19ee7849a78..488b57d2b8a 100644 --- a/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/hypothesis.h +++ b/Polygonal_surface_reconstruction/include/CGAL/Polygonal_surface_reconstruction/internal/hypothesis.h @@ -539,9 +539,9 @@ namespace CGAL { // Properties of the bbox_mesh typename Polygon_mesh::template Property_map > bbox_edge_supporting_planes - = bbox_mesh.template property_map >("e:supp_plane").first; + = *bbox_mesh.template property_map >("e:supp_plane"); typename Polygon_mesh::template Property_map > bbox_vertex_supporting_planes - = bbox_mesh.template property_map >("v:supp_plane").first; + = *bbox_mesh.template property_map >("v:supp_plane"); // The properties of the proxy mesh candidate_faces.clear(); @@ -729,11 +729,11 @@ namespace CGAL { Hypothesis::split_edge(Polygon_mesh& mesh, const EdgePos& ep, const Plane* cutting_plane) { // The supporting planes of each edge typename Polygon_mesh::template Property_map > edge_supporting_planes = - mesh.template property_map >("e:supp_plane").first; + *mesh.template property_map >("e:supp_plane"); // The supporting planes of each vertex typename Polygon_mesh::template Property_map > vertex_supporting_planes - = mesh.template property_map >("v:supp_plane").first; + = *mesh.template property_map >("v:supp_plane"); // We cannot use const reference, because it will become invalid after splitting std::set sfs = edge_supporting_planes[ep.edge]; @@ -771,7 +771,7 @@ namespace CGAL { // The supporting plane of each face typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; + *mesh.template property_map("f:supp_plane"); const Plane* supporting_plane = face_supporting_planes[face]; if (supporting_plane == cutting_plane) @@ -779,11 +779,11 @@ namespace CGAL { // The supporting planar segment of each face typename Polygon_mesh::template Property_map face_supporting_segments = - mesh.template property_map("f:supp_segment").first; + *mesh.template property_map("f:supp_segment"); // The supporting planes of each edge typename Polygon_mesh::template Property_map > edge_supporting_planes = - mesh.template property_map >("e:supp_plane").first; + *mesh.template property_map >("e:supp_plane"); Planar_segment* supporting_segment = face_supporting_segments[face]; @@ -882,13 +882,13 @@ namespace CGAL { // The supporting plane of each face typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; + *mesh.template property_map("f:supp_plane"); const Plane* supporting_plane = face_supporting_planes[face]; if (supporting_plane == cutting_plane) return; typename Polygon_mesh::template Property_map > edge_supporting_planes - = mesh.template property_map >("e:supp_plane").first; + = *mesh.template property_map >("e:supp_plane"); const typename Polygon_mesh::template Property_map& coords = mesh.points(); @@ -997,11 +997,11 @@ namespace CGAL { { // The supporting plane of each face typename Polygon_mesh::template Property_map face_supporting_planes = - mesh.template property_map("f:supp_plane").first; + *mesh.template property_map("f:supp_plane"); // The supporting planar segment of each face typename Polygon_mesh::template Property_map face_supporting_segments = - mesh.template property_map("f:supp_segment").first; + *mesh.template property_map("f:supp_segment"); std::set intersecting_faces; for(auto f : mesh.faces()) { @@ -1034,7 +1034,7 @@ namespace CGAL { // The supporting plane of each face typename Polygon_mesh::template Property_map face_supporting_planes - = candidate_faces.template property_map("f:supp_plane").first; + = *candidate_faces.template property_map("f:supp_plane"); for (std::size_t i = 0; i < all_faces.size(); ++i) { Face_descriptor face = all_faces[i]; @@ -1090,7 +1090,7 @@ namespace CGAL { typename Hypothesis::Adjacency Hypothesis::extract_adjacency(const Polygon_mesh& candidate_faces) { typename Polygon_mesh::template Property_map > vertex_supporting_planes - = candidate_faces.template property_map >("v:supp_plane").first; + = *candidate_faces.template property_map >("v:supp_plane"); // An edge is denoted by its two end points typedef typename std::unordered_map > Edge_map; diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h index 56e8c03266f..ef1f6c7ad48 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh_features.h b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh_features.h index 1484943f078..df87705df13 100644 --- a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh_features.h +++ b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh_features.h @@ -100,7 +100,7 @@ typename boost::lazy_disable_if< inline get(CGAL::face_patch_id_t, const Surface_mesh

& smesh) { typedef typename boost::graph_traits >::face_descriptor face_descriptor; - return smesh. template property_map("f:patch_id").first; + return *smesh. template property_map("f:patch_id"); } @@ -134,7 +134,7 @@ CGAL_PROPERTY_SURFACE_MESH_RETURN_TYPE(CGAL::edge_is_feature_t) inline get(CGAL::edge_is_feature_t, const Surface_mesh

& smesh) { typedef typename boost::graph_traits >::edge_descriptor edge_descriptor; - return smesh. template property_map("e:is_feature").first; + return *smesh. template property_map("e:is_feature"); }