CGAL::Arr_consolidated_curve_data_traits_2<Traits,Data>

Definition

The class Arr_consolidated_curve_data_traits_2<Traits,Data> is a model of the concept ArrangementTraits_2, and serves as a decorator class that enables the extension of the curve type defined by the Traits parameter. The traits class inherits its point type from Traits::Point_2, and defines the types Curve_2 and X_monotone_curve_2 extended with extraneous data fields of type Data.

Each Curve_2 object is associated with a single data field of type Data, and each X_monotone_curve_2 object is associated with a set of unique data objects. When a curve is subdivided into x-monotone subcurves, all resulting subcurves are associated with a list containing a single data object, copied from the inducing curve. When an x-monotone curve is split, its data set is duplicated, and inserted into the sets of both resulting subcurves. In case two (or more) x-monotone curves overlap, their data sets are consolidated, and are inserted into the set of the x-monotone curve that represents the overlap.

#include <CGAL/Arr_consolidated_curve_data_traits_2.h>

Is Model for the Concepts

ArrangementTraits_2

Inherits From

Arr_curve_data_traits_2< Traits,
_Unique_list<Data>,
_Consolidate_unique_lists<Data>,
Data>

Types

typedef Traits 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.

Arr_consolidated_curve_data_traits_2<Traits,Data>::typedef Data_container
a set of data objects that is associated with an x-monotone curve.

Arr_consolidated_curve_data_traits_2<Traits,Data>::typedef Data_iterator
a non-mutable iterator for the data objects in the data container.

Class Arr_consolidated_curve_data_traits_2<Traits,Data>::Data_container

The Data_container class nested within the consolidated curve-data traits and associated with the Traits::X_monotone_curve_2 type is maintained as a list with unique data objects. This representation is simple and efficient in terms of memory consumption. It also requires that the Data class supports only the equality operator. Note however that most set operations require linear time.

Creation

Arr_consolidated_curve_data_traits_2<Traits,Data>:: Data_container dset;
default constructor.


Arr_consolidated_curve_data_traits_2<Traits,Data>:: Data_container dset ( Data data);
constructs set containing a single data object.

Access Functions

std::size_t dset.size () returns the number of data objects in the set.

Data_iterator dset.begin () returns an iterator pointing to the first data object.

Data_iterator dset.end () returns a past-the-end iterator for the data objects.

Data dset.front () returns the first data object inserted into the set.
Precondition: The number of data objects is not 0.

Data dset.back () returns the last data object inserted into the set.
Precondition: The number of data objects is not 0.

Predicates

bool dset == Data_container other check if the two sets contain the same data objects (regardless of order).

Data_iterator dset.find ( Data data) find the given data object in the set and returns an iterator for this object, or end() if it is not found.

Modifiers

bool dset.insert ( Data data) inserts the given data object into the set. Returns true on success, or false if the set already contains the object.

bool dset.erase ( Data data) erases the given data object from the set. Returns true on success, or false if the set does not contain the object.

void dset.clear () clears the set.