mirror of https://github.com/CGAL/cgal
Move helper classes to SLS_aux.h
This commit is contained in:
parent
9c5842625b
commit
15c674d5c9
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
#include <CGAL/license/Straight_skeleton_2.h>
|
||||
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <CGAL/Straight_skeleton_2/Straight_skeleton_aux.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
|
@ -21,9 +22,6 @@
|
|||
namespace CGAL {
|
||||
namespace CGAL_SS_i {
|
||||
|
||||
// to distinguish between SequenceContainers of points, and GeneralPolygonWithHoles_2
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(Hole_const_iterator)
|
||||
|
||||
// Polygon_2-type container
|
||||
template <typename Poly>
|
||||
inline typename Poly::const_iterator
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
#include <CGAL/Straight_skeleton_2/debug.h>
|
||||
#include <CGAL/Straight_skeleton_2/test.h>
|
||||
|
||||
#include <CGAL/Polygon_with_holes_2.h>
|
||||
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/none.hpp>
|
||||
|
|
@ -171,6 +174,68 @@ private:
|
|||
Handle mE[3];
|
||||
} ;
|
||||
|
||||
template<class U, class V>
|
||||
struct Is_same_type { typedef Tag_false type ; } ;
|
||||
|
||||
template<class U>
|
||||
struct Is_same_type<U,U> { typedef Tag_true type ; } ;
|
||||
|
||||
// to distinguish between SequenceContainers of points, and GeneralPolygonWithHoles_2
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(Hole_const_iterator)
|
||||
|
||||
// The return type of create_(weighted)_interior/exterior_skeleton_and_offset_polygons_2:
|
||||
// - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type
|
||||
// should be the internal (hole-less) polygon type GeneralPolygonWithHoles_2::Polygon_2
|
||||
// - if polygon input is just a sequence container of points (e.g. Polygon_2), then the same type
|
||||
// is expected in output
|
||||
template <typename Polygon, typename OfK,
|
||||
bool has_holes = CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>
|
||||
struct Default_return_polygon_type // Polygon type supports holes
|
||||
{
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<
|
||||
typename Polygon::Polygon_2>::type>::Kernel,
|
||||
OfK>::value,
|
||||
typename Polygon::Polygon_2, // correct kernel
|
||||
CGAL::Polygon_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
template <typename Polygon, typename OfK>
|
||||
struct Default_return_polygon_type<Polygon, OfK, false> // Polygon type does NOT support holes
|
||||
{
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<Polygon>::type>::Kernel,
|
||||
OfK>::value,
|
||||
Polygon, // correct kernel
|
||||
CGAL::Polygon_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
// The return type of create_interior/exterior_skeleton_and_offset_polygons_with_holes_2:
|
||||
// - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type should be the same
|
||||
// - if polygon input is just a sequence container of points (e.g. Polygon_2), then use
|
||||
// General_polygon_with_holes_2<Polygon>
|
||||
template <typename Polygon, typename OfK,
|
||||
bool has_holes = CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>
|
||||
struct Default_return_polygon_with_holes_type // Polygon type supports holes
|
||||
{
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<
|
||||
typename Polygon::Polygon_2>::type>::Kernel,
|
||||
OfK>::value,
|
||||
Polygon, // correct kernel
|
||||
CGAL::Polygon_with_holes_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
template <typename Polygon, typename OfK>
|
||||
struct Default_return_polygon_with_holes_type<Polygon, OfK, false> // Polygon type does NOT support holes
|
||||
{
|
||||
// Maybe on paper the `conditional<true>` should be `General_polygon_with_holes_2<Polygon>`...
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<Polygon>::type>::Kernel,
|
||||
OfK>::value,
|
||||
CGAL::Polygon_with_holes_2<OfK>, // correct kernel but no holes
|
||||
CGAL::Polygon_with_holes_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
} // namespace CGAL_SS_i
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <CGAL/license/Straight_skeleton_2.h>
|
||||
|
||||
#include <CGAL/Straight_skeleton_2/Straight_skeleton_aux.h>
|
||||
#include <CGAL/create_straight_skeleton_2.h>
|
||||
#include <CGAL/compute_outer_frame_margin.h>
|
||||
#include <CGAL/Polygon_offset_builder_2.h>
|
||||
|
|
@ -42,66 +43,6 @@ namespace CGAL {
|
|||
|
||||
namespace CGAL_SS_i {
|
||||
|
||||
template<class U, class V>
|
||||
struct Is_same_type { typedef Tag_false type ; } ;
|
||||
|
||||
template<class U>
|
||||
struct Is_same_type<U,U> { typedef Tag_true type ; } ;
|
||||
|
||||
// The return type of create_interior/exterior_skeleton_and_offset_polygons_2:
|
||||
// - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type
|
||||
// should be the internal (hole-less) polygon type GeneralPolygonWithHoles_2::Polygon_2
|
||||
// - if polygon input is just a sequence container of points (e.g. Polygon_2), then the same type
|
||||
// is expected in output
|
||||
template <typename Polygon, typename OfK,
|
||||
bool has_holes = CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>
|
||||
struct Default_return_polygon_type // Polygon type supports holes
|
||||
{
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<
|
||||
typename Polygon::Polygon_2>::type>::Kernel,
|
||||
OfK>::value,
|
||||
typename Polygon::Polygon_2, // correct kernel
|
||||
CGAL::Polygon_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
template <typename Polygon, typename OfK>
|
||||
struct Default_return_polygon_type<Polygon, OfK, false> // Polygon type does NOT support holes
|
||||
{
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<Polygon>::type>::Kernel,
|
||||
OfK>::value,
|
||||
Polygon, // correct kernel
|
||||
CGAL::Polygon_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
// The return type of create_interior/exterior_skeleton_and_offset_polygons_with_holes_2:
|
||||
// - if polygon input is a model of 'GeneralPolygonWithHoles_2', the return type should be the same
|
||||
// - if polygon input is just a sequence container of points (e.g. Polygon_2), then use
|
||||
// General_polygon_with_holes_2<Polygon>
|
||||
template <typename Polygon, typename OfK,
|
||||
bool has_holes = CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>
|
||||
struct Default_return_polygon_with_holes_type // Polygon type supports holes
|
||||
{
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<
|
||||
typename Polygon::Polygon_2>::type>::Kernel,
|
||||
OfK>::value,
|
||||
Polygon, // correct kernel
|
||||
CGAL::Polygon_with_holes_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
template <typename Polygon, typename OfK>
|
||||
struct Default_return_polygon_with_holes_type<Polygon, OfK, false> // Polygon type does NOT support holes
|
||||
{
|
||||
// Maybe on paper the `conditional<true>` should be `General_polygon_with_holes_2<Polygon>`...
|
||||
typedef typename std::conditional<std::is_same<
|
||||
typename Kernel_traits<typename boost::range_value<Polygon>::type>::Kernel,
|
||||
OfK>::value,
|
||||
CGAL::Polygon_with_holes_2<OfK>, // correct kernel but no holes
|
||||
CGAL::Polygon_with_holes_2<OfK> /*incorrect kernel*/ >::type type;
|
||||
};
|
||||
|
||||
template<class FT, class PointIterator, class HoleIterator, class K>
|
||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||
create_partial_interior_straight_skeleton_2 ( FT const& aMaxTime
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
#include <CGAL/license/Straight_skeleton_2.h>
|
||||
|
||||
#include <CGAL/create_straight_skeleton_2.h>
|
||||
#include <CGAL/create_weighted_offset_polygons_2.h>
|
||||
#include <CGAL/Straight_skeleton_2/Straight_skeleton_aux.h>
|
||||
#include <CGAL/create_offset_polygons_2.h>
|
||||
#include <CGAL/compute_outer_frame_margin.h>
|
||||
#include <CGAL/Polygon_offset_builder_2.h>
|
||||
#include <CGAL/Straight_skeleton_converter_2.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue