CGAL::Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>

Definition

The class Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv> is a model of the ArrangementTraits_2 concept and serves as a decorator class that allows the extension of the curves defined by the base traits-class (the Tr parameter), which serves as a geometric traits-class (a model of the ArrangementTraits_2 concept), with extraneous (non-geometric) data fields.

The traits class inherits its point type from Traits::Point_2, and defines an extended Curve_2 and X_monotone_curve_2 types, as detailed below.

Each Curve_2 object is associated with a single data field of type CData, and each X_monotone_curve_2 object is associated with a single data field of type XData. When a curve is subdivided into x-monotone subcurves, its data field is converted using the conversion functor, which is specified by the Cnv template-parameter, and the resulting objects is copied to all X_monotone_curve_2 objects induced by this curve. The conversion functor should provide an operator with the following prototype:
XData operator() (const CData& d) const;

By default, the two data types are the same, so the conversion operator is trivial:

CData = XData
Cnv = _Default_convert_functor<CData,XData>

In case two (or more) x-monotone curves overlap, their data fields are merged to a single field, using the merge functor functor, which is specified by the Mrg template-parameter. This functor should provide an operator with the following prototype:
XData operator() (const XData& d1, const XData& d2) const;
which returns a single data object that represents the merged data field of d1 and d2. The x-monotone curve that represents the overlap is associated with the output of this functor.

#include <CGAL/Arr_curve_data_traits_2.h>

Is Model for the Concepts

ArrangementTraits_2

Types

typedef Tr Base_traits_2; the base traits-class.
typedef typename Base_traits_2::Curve_2
Base_curve_2; the base curve.
typedef typename Base_traits_2::X_monotone_curve_2
Base_x_monotone_curve_2; the base x-monotone curve curve.

typedef Mrg Merge; the merge functor.
typedef Cnv Convert; the conversion functor.

typedef CData Curve_data; the type of data associated with curves.
typedef XData X_monotone_curve_data; the type of data associated with x-monotone curves.

Inherits From

Base_traits_2

Class Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::Curve_2

The Curve_2 class nested within the curve-data traits extends the Base_traits_2::Curve_2 type with an extra data field of type Data.

Inherits From

Base_curve_2

Creation

Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::Curve_2 cv;
default constructor.


Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::Curve_2 cv ( Base_curve_2 base);
constructs curve from the given base curve with uninitialized data field.


Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::Curve_2 cv ( Base_curve_2 base, Data data);
constructs curve from the given base curve with an attached data field.

Access Functions

Curve_data cv.data () returns the data field (a non-const version, which returns a reference to the data object, is also available).

void cv.set_data ( Curve_data data) sets the data field.

Class Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::X_monotone_curve_2

The X_monotone_curve_2 class nested within the curve-data traits extends the Base_traits_2::X_monotone_curve_2 type with an extra data field.

Inherits From

Base_x_monotone_curve_2

Creation

Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::X_monotone_curve_2 xcv;
default constructor.


Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::X_monotone_curve_2 xcv ( Base_x_monotone_curve_2 base);
constructs an x-monotone curve from the given base curve with uninitialized data field.


Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>::X_monotone_curve_2 xcv ( Base_x_monotone_curve_2 base, X_monotone_curve_data data);
constructs an x-monotone curve from the given base x-monotone curve with an attached data field.

Access Functions

X_monotone_curve_data xcv.data () returns the field (a non-const version, which returns a reference to the data object, is also available).

void xcv.set_data ( X_monotone_curve_data data)
sets the data field.