mirror of https://github.com/CGAL/cgal
Inherit from the helper class to avoid storing the graph if tag is true.
This commit is contained in:
parent
da01fb43ee
commit
4615c636d5
|
|
@ -33,33 +33,47 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
namespace internal_primitive_id{
|
namespace internal_primitive_id{
|
||||||
//helper struct for creating the right Id: just a face_descriptor if OneFaceGraphPerTree
|
//helper base class for creating the right Id: just a face_descriptor if OneFaceGraphPerTree
|
||||||
// is true,else : a pair with the corresponding graph.
|
// is true,else : a pair with the corresponding graph.
|
||||||
template<class FaceGraph,
|
template<class FaceGraph,
|
||||||
class OneFaceGraphPerTree>
|
class OneFaceGraphPerTree>
|
||||||
struct Primitive_id;
|
class Primitive_wrapper;
|
||||||
|
|
||||||
template<class FaceGraph>
|
template<class FaceGraph>
|
||||||
struct Primitive_id<FaceGraph, Tag_true>
|
class Primitive_wrapper<FaceGraph, Tag_true>
|
||||||
{
|
{
|
||||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor Id_;
|
public:
|
||||||
|
typedef typename boost::graph_traits<FaceGraph>::face_descriptor Id;
|
||||||
|
|
||||||
|
Primitive_wrapper(const FaceGraph*)
|
||||||
|
{}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static Id_ from_id(const T& id, const FaceGraph&)
|
Id from_id(const T& id)const
|
||||||
{
|
{
|
||||||
return Id_(id);
|
return Id(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class FaceGraph>
|
template<class FaceGraph>
|
||||||
struct Primitive_id<FaceGraph, Tag_false>
|
class Primitive_wrapper<FaceGraph, Tag_false>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
typedef std::pair<typename boost::graph_traits<FaceGraph>::face_descriptor,
|
typedef std::pair<typename boost::graph_traits<FaceGraph>::face_descriptor,
|
||||||
FaceGraph> Id_;
|
FaceGraph> Id;
|
||||||
|
|
||||||
|
Primitive_wrapper(const FaceGraph* graph)
|
||||||
|
:this_graph(graph)
|
||||||
|
{}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static Id_ from_id(const T& id, const FaceGraph& f)
|
Id from_id(const T& id)const
|
||||||
{
|
{
|
||||||
return std::make_pair(id, f);
|
return std::make_pair(id, *this_graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const FaceGraph* this_graph;
|
||||||
};
|
};
|
||||||
}//end internal
|
}//end internal
|
||||||
|
|
||||||
|
|
@ -107,7 +121,8 @@ class AABB_face_graph_triangle_primitive
|
||||||
typename boost::property_map< FaceGraph,
|
typename boost::property_map< FaceGraph,
|
||||||
vertex_point_t>::type >::type>,
|
vertex_point_t>::type >::type>,
|
||||||
OneFaceGraphPerTree,
|
OneFaceGraphPerTree,
|
||||||
CacheDatum >
|
CacheDatum >,
|
||||||
|
public internal_primitive_id::Primitive_wrapper<FaceGraph, OneFaceGraphPerTree>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::type >::type VertexPointPMap_;
|
typedef typename Default::Get<VertexPointPMap, typename boost::property_map< FaceGraph, vertex_point_t>::type >::type VertexPointPMap_;
|
||||||
|
|
@ -120,10 +135,11 @@ class AABB_face_graph_triangle_primitive
|
||||||
Point_property_map,
|
Point_property_map,
|
||||||
OneFaceGraphPerTree,
|
OneFaceGraphPerTree,
|
||||||
CacheDatum > Base;
|
CacheDatum > Base;
|
||||||
|
|
||||||
|
typedef internal_primitive_id::Primitive_wrapper<FaceGraph, OneFaceGraphPerTree> Base_2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename internal_primitive_id::Primitive_id<FaceGraph, OneFaceGraphPerTree>::Id_ Id;
|
typedef typename Base_2::Id Id;
|
||||||
protected:
|
|
||||||
const FaceGraph* this_graph;
|
|
||||||
public:
|
public:
|
||||||
#ifdef DOXYGEN_RUNNING
|
#ifdef DOXYGEN_RUNNING
|
||||||
/// \name Types
|
/// \name Types
|
||||||
|
|
@ -151,8 +167,7 @@ public:
|
||||||
static unspecified_type construct_shared_data( FaceGraph& graph );
|
static unspecified_type construct_shared_data( FaceGraph& graph );
|
||||||
#endif
|
#endif
|
||||||
Id id() const {
|
Id id() const {
|
||||||
return internal_primitive_id::Primitive_id<FaceGraph, OneFaceGraphPerTree>::from_id(Base::id(),
|
return Base_2::from_id(Base::id());
|
||||||
*this_graph);
|
|
||||||
}
|
}
|
||||||
// constructors
|
// constructors
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -166,7 +181,7 @@ public:
|
||||||
: Base( it,
|
: Base( it,
|
||||||
Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
|
Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
|
||||||
Point_property_map(const_cast<FaceGraph*>(&graph),vppm) ),
|
Point_property_map(const_cast<FaceGraph*>(&graph),vppm) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -180,7 +195,7 @@ public:
|
||||||
: Base( Id_(id),
|
: Base( Id_(id),
|
||||||
Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
|
Triangle_property_map(const_cast<FaceGraph*>(&graph),vppm),
|
||||||
Point_property_map(const_cast<FaceGraph*>(&graph),vppm) ),
|
Point_property_map(const_cast<FaceGraph*>(&graph),vppm) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
|
|
@ -189,7 +204,7 @@ public:
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Triangle_property_map(const_cast<FaceGraph*>(&graph)),
|
Triangle_property_map(const_cast<FaceGraph*>(&graph)),
|
||||||
Point_property_map(const_cast<FaceGraph*>(&graph)) ),
|
Point_property_map(const_cast<FaceGraph*>(&graph)) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AABB_face_graph_triangle_primitive(
|
AABB_face_graph_triangle_primitive(
|
||||||
|
|
@ -197,7 +212,7 @@ public:
|
||||||
: Base( Id_(id),
|
: Base( Id_(id),
|
||||||
Triangle_property_map(const_cast<FaceGraph*>(&graph)),
|
Triangle_property_map(const_cast<FaceGraph*>(&graph)),
|
||||||
Point_property_map(const_cast<FaceGraph*>(&graph)) ),
|
Point_property_map(const_cast<FaceGraph*>(&graph)) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,33 +40,47 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
namespace internal_primitive_id{
|
namespace internal_primitive_id{
|
||||||
//helper struct for creating the right Id: just an edge_descriptor if OneHalfedgeGraphPerTree
|
//helper base class for creating the right Id: just a face_descriptor if OneFaceGraphPerTree
|
||||||
// is true,else : a pair with the corresponding graph.
|
// is true,else : a pair with the corresponding graph.
|
||||||
template<class HalfedgeGraph,
|
template<class Graph,
|
||||||
class OneHalfedgeGraphPerTree>
|
class OneGraphPerTree>
|
||||||
struct EPrimitive_id;
|
class EPrimitive_wrapper;
|
||||||
|
|
||||||
template<class HalfedgeGraph>
|
template<class Graph>
|
||||||
struct EPrimitive_id<HalfedgeGraph, Tag_true>
|
class EPrimitive_wrapper<Graph, Tag_true>
|
||||||
{
|
{
|
||||||
typedef typename boost::graph_traits<HalfedgeGraph>::edge_descriptor Id_;
|
public:
|
||||||
|
typedef typename boost::graph_traits<Graph>::edge_descriptor Id;
|
||||||
|
|
||||||
|
EPrimitive_wrapper(const Graph*)
|
||||||
|
{}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static Id_ from_id(const T& id, const HalfedgeGraph&)
|
Id from_id(const T& id)const
|
||||||
{
|
{
|
||||||
return Id_(id);
|
return Id(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class HalfedgeGraph>
|
template<class Graph>
|
||||||
struct EPrimitive_id<HalfedgeGraph, Tag_false>
|
class EPrimitive_wrapper<Graph, Tag_false>
|
||||||
{
|
{
|
||||||
typedef std::pair<typename boost::graph_traits<HalfedgeGraph>::edge_descriptor,
|
public:
|
||||||
HalfedgeGraph> Id_;
|
typedef std::pair<typename boost::graph_traits<Graph>::edge_descriptor,
|
||||||
|
Graph> Id;
|
||||||
|
|
||||||
|
EPrimitive_wrapper(const Graph* graph)
|
||||||
|
:this_graph(graph)
|
||||||
|
{}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static Id_ from_id(const T& id, const HalfedgeGraph& f)
|
Id from_id(const T& id)const
|
||||||
{
|
{
|
||||||
return std::make_pair(id, f);
|
return std::make_pair(id, *this_graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Graph* this_graph;
|
||||||
};
|
};
|
||||||
}//end internal
|
}//end internal
|
||||||
|
|
||||||
|
|
@ -120,7 +134,8 @@ class AABB_halfedge_graph_segment_primitive
|
||||||
typename boost::property_map< HalfedgeGraph,
|
typename boost::property_map< HalfedgeGraph,
|
||||||
vertex_point_t>::type >::type >,
|
vertex_point_t>::type >::type >,
|
||||||
OneHalfedgeGraphPerTree,
|
OneHalfedgeGraphPerTree,
|
||||||
CacheDatum >
|
CacheDatum >,
|
||||||
|
public internal_primitive_id::EPrimitive_wrapper<HalfedgeGraph, OneHalfedgeGraphPerTree>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::type >::type VertexPointPMap_;
|
typedef typename Default::Get<VertexPointPMap,typename boost::property_map< HalfedgeGraph,vertex_point_t>::type >::type VertexPointPMap_;
|
||||||
|
|
@ -134,11 +149,12 @@ class AABB_halfedge_graph_segment_primitive
|
||||||
Point_property_map,
|
Point_property_map,
|
||||||
OneHalfedgeGraphPerTree,
|
OneHalfedgeGraphPerTree,
|
||||||
CacheDatum > Base;
|
CacheDatum > Base;
|
||||||
|
|
||||||
|
typedef internal_primitive_id::EPrimitive_wrapper<HalfedgeGraph, OneHalfedgeGraphPerTree> Base_2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename internal_primitive_id::EPrimitive_id<HalfedgeGraph, OneHalfedgeGraphPerTree>::Id_ Id;
|
typedef typename Base_2::Id Id;
|
||||||
protected:
|
|
||||||
const HalfedgeGraph* this_graph;
|
|
||||||
public:
|
public:
|
||||||
#ifdef DOXYGEN_RUNNING
|
#ifdef DOXYGEN_RUNNING
|
||||||
/// \name Types
|
/// \name Types
|
||||||
|
|
@ -165,9 +181,7 @@ public:
|
||||||
static unspecified_type construct_shared_data( HalfedgeGraph& graph );
|
static unspecified_type construct_shared_data( HalfedgeGraph& graph );
|
||||||
#endif
|
#endif
|
||||||
Id id() const {
|
Id id() const {
|
||||||
return internal_primitive_id::EPrimitive_id<HalfedgeGraph,
|
return Base_2::from_id(Base::id());
|
||||||
OneHalfedgeGraphPerTree>::from_id(Base::id(),
|
|
||||||
*this_graph);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -183,7 +197,7 @@ public:
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Segment_property_map(const_cast<HalfedgeGraph*>(&graph), vppm),
|
Segment_property_map(const_cast<HalfedgeGraph*>(&graph), vppm),
|
||||||
Point_property_map(const_cast<HalfedgeGraph*>(&graph), vppm) ),
|
Point_property_map(const_cast<HalfedgeGraph*>(&graph), vppm) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -196,7 +210,7 @@ public:
|
||||||
: Base( Id_(id),
|
: Base( Id_(id),
|
||||||
Segment_property_map(const_cast<HalfedgeGraph*>(&graph), vppm),
|
Segment_property_map(const_cast<HalfedgeGraph*>(&graph), vppm),
|
||||||
Point_property_map(const_cast<HalfedgeGraph*>(&graph), vppm) ),
|
Point_property_map(const_cast<HalfedgeGraph*>(&graph), vppm) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
|
|
@ -205,7 +219,7 @@ public:
|
||||||
: Base( Id_(*it),
|
: Base( Id_(*it),
|
||||||
Segment_property_map(const_cast<HalfedgeGraph*>(&graph)),
|
Segment_property_map(const_cast<HalfedgeGraph*>(&graph)),
|
||||||
Point_property_map(const_cast<HalfedgeGraph*>(&graph)) ),
|
Point_property_map(const_cast<HalfedgeGraph*>(&graph)) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AABB_halfedge_graph_segment_primitive(
|
AABB_halfedge_graph_segment_primitive(
|
||||||
|
|
@ -213,7 +227,7 @@ public:
|
||||||
: Base( Id_(id),
|
: Base( Id_(id),
|
||||||
Segment_property_map(const_cast<HalfedgeGraph*>(&graph)),
|
Segment_property_map(const_cast<HalfedgeGraph*>(&graph)),
|
||||||
Point_property_map(const_cast<HalfedgeGraph*>(&graph)) ),
|
Point_property_map(const_cast<HalfedgeGraph*>(&graph)) ),
|
||||||
this_graph(&graph)
|
Base_2(&graph)
|
||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue