mirror of https://github.com/CGAL/cgal
fix the const correctness of FaceGraph and HalfedgeGraph primitives
The BGL is not const correct by design choice. Passing a const Graph as template parameter to the primitive type is error prone. This will make the life easier to the user.
This commit is contained in:
parent
fd91616f51
commit
e412f6c2e5
|
|
@ -135,18 +135,18 @@ public:
|
||||||
Constructs a primitive.
|
Constructs a primitive.
|
||||||
*/
|
*/
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
AABB_face_graph_triangle_primitive(Iterator it, FaceGraph& graph, VertexPointPMap vppm)
|
AABB_face_graph_triangle_primitive(Iterator it, const FaceGraph& graph, VertexPointPMap vppm)
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Triangle_property_map(&graph,vppm),
|
Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
|
||||||
Point_property_map(&graph,vppm) )
|
Point_property_map(const_cast<FaceGraph*>(&graph),vppm) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
AABB_face_graph_triangle_primitive(Iterator it, FaceGraph& graph)
|
AABB_face_graph_triangle_primitive(Iterator it, const FaceGraph& graph)
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Triangle_property_map(&graph),
|
Triangle_property_map(const_cast<FaceGraph*>(&graph)),
|
||||||
Point_property_map(&graph) )
|
Point_property_map(const_cast<FaceGraph*>(&graph)) )
|
||||||
{}
|
{}
|
||||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||||
// for backward compatibility with Polyhedron::facets_begin()
|
// for backward compatibility with Polyhedron::facets_begin()
|
||||||
|
|
@ -171,9 +171,9 @@ public:
|
||||||
/// \internal
|
/// \internal
|
||||||
static
|
static
|
||||||
typename Cstr_shared_data::Shared_data
|
typename Cstr_shared_data::Shared_data
|
||||||
construct_shared_data(FaceGraph& graph)
|
construct_shared_data(const FaceGraph& graph)
|
||||||
{
|
{
|
||||||
return Cstr_shared_data::construct_shared_data(graph);
|
return Cstr_shared_data::construct_shared_data(const_cast<FaceGraph&>(graph));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -121,18 +121,18 @@ public:
|
||||||
is available with `vppm` set to `boost::get(vertex_point, graph)`.
|
is available with `vppm` set to `boost::get(vertex_point, graph)`.
|
||||||
*/
|
*/
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
AABB_halfedge_graph_segment_primitive(Iterator it, HalfedgeGraph& graph, VertexPointPMap vppm)
|
AABB_halfedge_graph_segment_primitive(Iterator it, const HalfedgeGraph& graph, VertexPointPMap vppm)
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Segment_property_map(&graph, vppm),
|
Segment_property_map(const_cast<HalfedgeGraph*>(&graph), vppm),
|
||||||
Point_property_map(&graph, vppm) )
|
Point_property_map(const_cast<HalfedgeGraph*>(&graph), vppm) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
AABB_halfedge_graph_segment_primitive(Iterator it, HalfedgeGraph& graph)
|
AABB_halfedge_graph_segment_primitive(Iterator it, const HalfedgeGraph& graph)
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Segment_property_map(&graph),
|
Segment_property_map(const_cast<HalfedgeGraph*>(&graph)),
|
||||||
Point_property_map(&graph) ){}
|
Point_property_map(const_cast<HalfedgeGraph*>(&graph)) ){}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// \internal
|
/// \internal
|
||||||
|
|
@ -140,9 +140,9 @@ public:
|
||||||
/// \internal
|
/// \internal
|
||||||
static
|
static
|
||||||
typename Cstr_shared_data::Shared_data
|
typename Cstr_shared_data::Shared_data
|
||||||
construct_shared_data(HalfedgeGraph& graph)
|
construct_shared_data(const HalfedgeGraph& graph)
|
||||||
{
|
{
|
||||||
return Cstr_shared_data::construct_shared_data(graph);
|
return Cstr_shared_data::construct_shared_data(const_cast<HalfedgeGraph&>(graph));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ struct Test {
|
||||||
std::cout << "Bbox - Triangle\n";
|
std::cout << "Bbox - Triangle\n";
|
||||||
|
|
||||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||||
typedef CGAL::AABB_face_graph_triangle_primitive<const Polyhedron> Primitive;
|
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
|
||||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||||
typedef CGAL::AABB_tree<Traits> Tree;
|
typedef CGAL::AABB_tree<Traits> Tree;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue