diff --git a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h index 80cc4c874a9..c7a8182d68d 100644 --- a/BGL/include/CGAL/boost/graph/Face_filtered_graph.h +++ b/BGL/include/CGAL/boost/graph/Face_filtered_graph.h @@ -104,6 +104,66 @@ struct Face_filtered_graph typedef Face_filtered_graph Self; + /*! + * \brief constructs an empty face filtered graph (no face is selected) + * + * \tparam NamedParameters a sequence of named parameters + * + * \param graph the underlying graph. + * + * \param np optional sequence of named parameters among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_index_map} + * \cgalParamDescription{a property map associating to each vertex of `graph` a unique index between `0` and `num_vertices(graph) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{an automatically indexed internal map} + * \cgalParamExtra{If this parameter is not passed, internal machinery will create and initialize + * a face index property map, either using the internal property map if it exists + * or using an external map. The latter might result in - slightly - worsened performance + * in case of non-constant complexity for index access.} + * \cgalParamNEnd + * + * \cgalParamNBegin{halfedge_index_map} + * \cgalParamDescription{a property map associating to each halfedge of `graph` a unique index between `0` and `num_halfedges(graph) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%halfedge_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{an automatically indexed internal map} + * \cgalParamExtra{If this parameter is not passed, internal machinery will create and initialize + * a face index property map, either using the internal property map if it exists + * or using an external map. The latter might result in - slightly - worsened performance + * in case of non-constant complexity for index access.} + * \cgalParamNEnd + * + * \cgalParamNBegin{face_index_map} + * \cgalParamDescription{a property map associating to each face of `graph` a unique index between `0` and `num_faces(graph) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%face_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{an automatically indexed internal map} + * \cgalParamExtra{If this parameter is not passed, internal machinery will create and initialize + * a face index property map, either using the internal property map if it exists + * or using an external map. The latter might result in - slightly - worsened performance + * in case of non-constant complexity for index access.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + */ + template + Face_filtered_graph(const Graph& graph, + const CGAL_BGL_NP_CLASS& np) + : _graph(const_cast(graph)) + , fimap(CGAL::get_initialized_face_index_map(graph, np)) + , vimap(CGAL::get_initialized_vertex_index_map(graph, np)) + , himap(CGAL::get_initialized_halfedge_index_map(graph, np)) + , selected_faces(num_faces(graph), 0) + , selected_vertices(num_vertices(graph), 0) + , selected_halfedges(num_halfedges(graph), 0) + {} + + Face_filtered_graph(const Graph& graph) + :Face_filtered_graph(graph, parameters::all_default()) + {} + /*! * \brief Constructor where the set of selected faces is specified as a range of patch ids. * diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/extract_segmentation_into_mesh_example.cpp b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/extract_segmentation_into_mesh_example.cpp index c226c867b5a..c8f1597f441 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/extract_segmentation_into_mesh_example.cpp +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/extract_segmentation_into_mesh_example.cpp @@ -40,11 +40,10 @@ int main(int argc, char** argv ) typedef CGAL::Face_filtered_graph Filtered_graph; //print area of each segment and then put it in a Mesh and print it in an OFF file - Filtered_graph segment_mesh(mesh, 0, segment_property_map); + Filtered_graph segment_mesh(mesh); for(std::size_t id = 0; id < number_of_segments; ++id) { - if(id > 0) - segment_mesh.set_selected_faces(id, segment_property_map); + segment_mesh.set_selected_faces(id, segment_property_map); std::cout << "Segment "<