mirror of https://github.com/CGAL/cgal
Fix SLS iterators to actually handle all possible models
This commit is contained in:
parent
f6579ecb2c
commit
b51b4d8713
|
|
@ -13,72 +13,65 @@
|
|||
|
||||
#include <CGAL/license/Straight_skeleton_2.h>
|
||||
|
||||
#include <CGAL/Polygon_with_holes_2.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL_SS_i {
|
||||
|
||||
// to distinguish between SequenceContainers of points, and GeneralPolygonWithHoles_2
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(Hole_const_iterator)
|
||||
|
||||
// Generic container
|
||||
template<class Poly>
|
||||
inline typename Poly::const_iterator vertices_begin ( Poly const& aPoly )
|
||||
{ return aPoly.begin() ; }
|
||||
// Polygon_2-type container
|
||||
template <typename Poly>
|
||||
inline typename Poly::const_iterator
|
||||
vertices_begin(const Poly& aPoly,
|
||||
std::enable_if_t<!has_Hole_const_iterator<Poly>::value>* = nullptr)
|
||||
{ return aPoly.begin(); }
|
||||
|
||||
template<class Poly>
|
||||
inline typename Poly::const_iterator vertices_end ( Poly const& aPoly )
|
||||
{ return aPoly.end() ; }
|
||||
template <typename Poly>
|
||||
inline typename Poly::const_iterator
|
||||
vertices_end(const Poly& aPoly,
|
||||
std::enable_if_t<!has_Hole_const_iterator<Poly>::value>* = nullptr)
|
||||
{ return aPoly.end(); }
|
||||
|
||||
template<class Poly>
|
||||
inline typename Poly::const_iterator vertices_begin ( boost::shared_ptr<Poly> const& aPoly )
|
||||
{ return aPoly->begin() ; }
|
||||
template <typename Poly>
|
||||
inline typename Poly::const_iterator
|
||||
vertices_begin(const boost::shared_ptr<Poly>& aPoly,
|
||||
std::enable_if_t<!has_Hole_const_iterator<Poly>::value>* = nullptr)
|
||||
{ return aPoly->begin(); }
|
||||
|
||||
template<class Poly>
|
||||
inline typename Poly::const_iterator vertices_end ( boost::shared_ptr<Poly> const& aPoly )
|
||||
{ return aPoly->end() ; }
|
||||
template <typename Poly>
|
||||
inline typename Poly::const_iterator
|
||||
vertices_end(const boost::shared_ptr<Poly> & aPoly,
|
||||
std::enable_if_t<!has_Hole_const_iterator<Poly>::value>* = nullptr)
|
||||
{ return aPoly->end(); }
|
||||
|
||||
// Polygon_2
|
||||
template<class K, class C>
|
||||
inline typename Polygon_2<K,C>::Vertex_const_iterator
|
||||
vertices_begin ( Polygon_2<K,C> const& aPoly )
|
||||
{ return aPoly.vertices_begin() ; }
|
||||
// Polygon_with_holes_2-type container
|
||||
template <typename PolyWithHoles>
|
||||
inline typename PolyWithHoles::Polygon_2::const_iterator
|
||||
vertices_begin(const PolyWithHoles& aPoly,
|
||||
std::enable_if_t<has_Hole_const_iterator<PolyWithHoles>::value>* = nullptr)
|
||||
{ return aPoly.outer_boundary().begin(); }
|
||||
|
||||
template<class K, class C>
|
||||
inline typename Polygon_2<K,C>::Vertex_const_iterator
|
||||
vertices_end( Polygon_2<K,C> const& aPoly )
|
||||
{ return aPoly.vertices_end() ; }
|
||||
template <typename PolyWithHoles>
|
||||
inline typename PolyWithHoles::Polygon_2::const_iterator
|
||||
vertices_end(const PolyWithHoles& aPoly,
|
||||
std::enable_if_t<has_Hole_const_iterator<PolyWithHoles>::value>* = nullptr)
|
||||
{ return aPoly.outer_boundary().end(); }
|
||||
|
||||
template<class K, class C>
|
||||
inline typename Polygon_2<K,C>::Vertex_const_iterator vertices_begin ( boost::shared_ptr<Polygon_2<K,C> > const& aPoly )
|
||||
{ return aPoly->vertices_begin() ; }
|
||||
template <typename PolyWithHoles>
|
||||
inline typename PolyWithHoles::Polygon_2::const_iterator
|
||||
vertices_begin(const boost::shared_ptr<PolyWithHoles>& aPoly,
|
||||
std::enable_if_t<has_Hole_const_iterator<PolyWithHoles>::value>* = nullptr)
|
||||
{ return aPoly->outer_boundary().begin(); }
|
||||
|
||||
template<class K, class C>
|
||||
inline typename Polygon_2<K,C>::Vertex_const_iterator vertices_end( boost::shared_ptr<Polygon_2<K,C> > const& aPoly )
|
||||
{ return aPoly->vertices_end() ; }
|
||||
|
||||
// Polygon_with_holes_2
|
||||
template<class K, class C>
|
||||
inline typename Polygon_with_holes_2<K,C>::Polygon_2::Vertex_const_iterator
|
||||
vertices_begin ( Polygon_with_holes_2<K,C> const& aPoly )
|
||||
{ return aPoly.outer_boundary().vertices_begin() ; }
|
||||
|
||||
template<class K, class C>
|
||||
inline typename Polygon_with_holes_2<K,C>::Polygon_2::Vertex_const_iterator
|
||||
vertices_end( Polygon_with_holes_2<K,C> const& aPoly )
|
||||
{ return aPoly.outer_boundary().vertices_end() ; }
|
||||
|
||||
template<class K, class C>
|
||||
inline typename Polygon_with_holes_2<K,C>::Polygon_2::Vertex_const_iterator
|
||||
vertices_begin ( boost::shared_ptr<Polygon_with_holes_2<K,C> > const& aPoly )
|
||||
{ return aPoly->outer_boundary().vertices_begin() ; }
|
||||
|
||||
template<class K, class C>
|
||||
inline typename Polygon_with_holes_2<K,C>::Polygon_2::Vertex_const_iterator
|
||||
vertices_end( boost::shared_ptr<Polygon_with_holes_2<K,C> > const& aPoly )
|
||||
{ return aPoly->outer_boundary().vertices_end() ; }
|
||||
template <typename PolyWithHoles>
|
||||
inline typename PolyWithHoles::Polygon_2::const_iterator
|
||||
vertices_end(const boost::shared_ptr<PolyWithHoles>& aPoly,
|
||||
std::enable_if_t<has_Hole_const_iterator<PolyWithHoles>::value>* = nullptr)
|
||||
{ return aPoly->outer_boundary().end(); }
|
||||
|
||||
} // namespace CGAL_SS_i
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
Loading…
Reference in New Issue