DGtal 1.3.0
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator Class Reference

Aim: This class aims at representing an iterator that provides a way to scan the points of a DSL. It is both a model of readable iterator and of bidirectional iterator. More...

#include <DGtal/geometry/curves/ArithmeticalDSL.h>

Inheritance diagram for DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator:

Public Member Functions

 ConstIterator ()
 
 ConstIterator (const ArithmeticalDSL *aDSL, const Point &aPoint)
 
 ConstIterator (const ConstIterator &aOther)
 
ConstIteratoroperator= (const ConstIterator &aOther)
 
 ~ConstIterator ()
 
Integer remainder () const
 

Private Member Functions

Point const dereference () const
 
void increment ()
 
void decrement ()
 
bool equal (const ConstIterator &aOther) const
 
void advance (const Position &aShift)
 
Position distance_to (const ConstIterator &aOther) const
 

Private Attributes

const ArithmeticalDSLmyDSLPtr
 Constant aliasing pointer to the DSL visited by the iterator. More...
 
Point myCurrentPoint
 The current point. More...
 
Integer myQuantityToAdd
 Quantity to add to the current remainder. More...
 
Integer myQuantityToRemove
 Quantity to remove to the current remainder. More...
 
Integer myCurrentRemainder
 Remainder of the current point. More...
 

Friends

class boost::iterator_core_access
 

Detailed Description

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
class DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator

Aim: This class aims at representing an iterator that provides a way to scan the points of a DSL. It is both a model of readable iterator and of bidirectional iterator.

Instances of this class are returned by begin and end methods of DSL classes as follows:

// Draw the DSL points between firstPoint and lastPoint
it = line.begin(firstPoint),
ite = line.end(lastPoint);
it != ite; ++it )
{
board << SetMode( it->className(), "Paving" )
<< *it; //Draw the point
}
Aim: This class aims at representing an iterator that provides a way to scan the points of a DSL....
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition: Board2D.h:247

See Digital straight lines and segments
for further details.

See also
ArithmeticalDSL NaiveDSL StandardDSL
exampleArithmeticalDSL.cpp
Examples
geometry/curves/exampleArithmeticalDSL.cpp.

Definition at line 177 of file ArithmeticalDSL.h.

Constructor & Destructor Documentation

◆ ConstIterator() [1/3]

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::ConstIterator ( )

Default constructor (not valid).

◆ ConstIterator() [2/3]

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::ConstIterator ( const ArithmeticalDSL aDSL,
const Point aPoint 
)

Constructor.

Parameters
aDSLan arithmetical DSL
aPointa point of the DSL containing aDSL

◆ ConstIterator() [3/3]

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::ConstIterator ( const ConstIterator aOther)

Copy constructor.

Parameters
aOtherthe iterator to clone.

◆ ~ConstIterator()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::~ConstIterator ( )

Destructor. Does nothing.

Member Function Documentation

◆ advance()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::advance ( const Position aShift)
private

Moves myCurrentPoint lying at position i to the point of the DSL lying at position i + aShift

Parameters
aShiftposition difference NB: in O(1)

◆ decrement()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::decrement ( )
private

Moves myCurrentPoint to the previous point of the DSL

◆ dereference()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Point const DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::dereference ( ) const
private

Dereference operator

Returns
the current point

◆ distance_to()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Position DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::distance_to ( const ConstIterator aOther) const
private

Computes the distance between *this and aOther, ie. the difference between their positions

Parameters
aOtherany other iterator
Returns
distance between the two iterators

◆ equal()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::equal ( const ConstIterator aOther) const
private

Equality operator.

Parameters
aOtherthe iterator to compare with (must be defined on the same DSL).
Returns
'true' if their current points coincide.

◆ increment()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::increment ( )
private

Moves myCurrentPoint to the next point of the DSL

◆ operator=()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
ConstIterator & DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::operator= ( const ConstIterator aOther)

Assignment.

Parameters
aOtherthe iterator to copy.
Returns
a reference on 'this'.

◆ remainder()

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::remainder ( ) const
Returns
the remainder of the current point (without any computation)

Friends And Related Function Documentation

◆ boost::iterator_core_access

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
friend class boost::iterator_core_access
friend

Definition at line 248 of file ArithmeticalDSL.h.

Field Documentation

◆ myCurrentPoint

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Point DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myCurrentPoint
private

The current point.

Definition at line 195 of file ArithmeticalDSL.h.

◆ myCurrentRemainder

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myCurrentRemainder
private

Remainder of the current point.

Definition at line 204 of file ArithmeticalDSL.h.

◆ myDSLPtr

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
const ArithmeticalDSL* DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myDSLPtr
private

Constant aliasing pointer to the DSL visited by the iterator.

Definition at line 192 of file ArithmeticalDSL.h.

◆ myQuantityToAdd

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myQuantityToAdd
private

Quantity to add to the current remainder.

Definition at line 198 of file ArithmeticalDSL.h.

◆ myQuantityToRemove

template<typename TCoordinate , typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myQuantityToRemove
private

Quantity to remove to the current remainder.

Definition at line 201 of file ArithmeticalDSL.h.


The documentation for this class was generated from the following file: