Added a default merge functor for the generic curve-data traits.

This commit is contained in:
Ron Wein 2006-08-03 11:23:23 +00:00
parent 1e715bf0b7
commit 15929ddde9
3 changed files with 16 additions and 11 deletions

View File

@ -8,20 +8,12 @@
#include <CGAL/Arr_curve_data_traits_2.h> #include <CGAL/Arr_curve_data_traits_2.h>
#include <CGAL/Arrangement_2.h> #include <CGAL/Arrangement_2.h>
struct Default_merge
{
unsigned int operator() (unsigned int, unsigned int) const
{
return (0);
}
};
typedef CGAL::Cartesian<Number_type> Kernel; typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Arr_linear_traits_2<Kernel> Linear_traits_2; typedef CGAL::Arr_linear_traits_2<Kernel> Linear_traits_2;
typedef Linear_traits_2::Point_2 Point_2; typedef Linear_traits_2::Point_2 Point_2;
typedef Linear_traits_2::Line_2 Line_2; typedef Linear_traits_2::Line_2 Line_2;
typedef CGAL::Arr_curve_data_traits_2 typedef CGAL::Arr_curve_data_traits_2<Linear_traits_2,
<Linear_traits_2, unsigned int, Default_merge> Traits_2; unsigned int> Traits_2;
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2; typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;

View File

@ -41,7 +41,8 @@ CGAL_BEGIN_NAMESPACE
* the overlapping subcurve is obtained from the merge functor. * the overlapping subcurve is obtained from the merge functor.
* All other functors are inherited from the base ordinary traits class. * All other functors are inherited from the base ordinary traits class.
*/ */
template <class Traits_, class XMonotoneCurveData_, class Merge_, template <class Traits_, class XMonotoneCurveData_,
class Merge_ = _Default_merge_func<XMonotoneCurveData_>,
class CurveData_ = XMonotoneCurveData_, class CurveData_ = XMonotoneCurveData_,
class Convert_ = _Default_convert_func<CurveData_, class Convert_ = _Default_convert_func<CurveData_,
XMonotoneCurveData_> > XMonotoneCurveData_> >

View File

@ -27,6 +27,18 @@
CGAL_BEGIN_NAMESPACE CGAL_BEGIN_NAMESPACE
/*!
* \struct A simple merge functor.
*/
template <class TYPE>
struct _Default_merge_func
{
const TYPE& operator() (const TYPE& obj1, const TYPE& obj2)
{
return (obj1);
}
};
/*! /*!
* \struct A simple convertor from one type to another. * \struct A simple convertor from one type to another.
*/ */