OpenWalnut  1.4.0
Public Member Functions | Protected Member Functions | Private Attributes
WFiberPointsIterator Class Reference

An iterator for iterating the points of a fiber. More...

#include <WDataSetFibers.h>

List of all members.

Public Member Functions

 WFiberPointsIterator ()
 Default contructor.
 WFiberPointsIterator (WDataSetFibers const *fibers, std::size_t fbIdx, std::size_t idx, bool reverse=false)
 Constructor.
 WFiberPointsIterator (WFiberPointsIterator const &iter)
 Copy constructor.
 ~WFiberPointsIterator ()
 Destructor.
WFiberPointsIteratoroperator= (WFiberPointsIterator const &iter)
 Copy operator.
WFiberPointsIteratoroperator++ ()
 Increment operator.
WFiberPointsIteratoroperator-- ()
 Decrement operator.
WFiberPointsIterator operator++ (int)
 Increment operator.
WFiberPointsIterator operator-- (int)
 Decrement operator.
bool operator== (WFiberPointsIterator const &rhs) const
 Compare to another point iterator.
bool operator!= (WFiberPointsIterator const &rhs) const
 Compare to another point iterator.
WPosition operator* ()
 Returns the coordinates of the point currently pointed to.
double getParameter (double def=0.0) const
 Returns the parameter specified in the vertex parameter array of the dataset.
WPosition getTangent () const
 The tangent of the point.
WColor getColor () const
 Return the color of the point.
WColor getColor (std::size_t idx) const
 Return the color of the point.
WColor getColor (std::string name) const
 Return the color of the point.
WColor getColor (const boost::shared_ptr< WDataSetFibers::ColorScheme > scheme) const
 Return the color of the point.

Protected Member Functions

std::size_t getBaseIndex () const
 Calculates the index of this point in the dataset arrays.

Private Attributes

WDataSetFibers const * m_fibers
 The pointer to the fibers.
std::size_t m_fiberIndex
 The index of the fiber.
std::size_t m_index
 The index of the current point.
bool m_reverse
 Whether to iterate backwards.

Detailed Description

An iterator for iterating the points of a fiber.

Allows for both forward and backward iteration of points.

Definition at line 651 of file WDataSetFibers.h.


Constructor & Destructor Documentation

Default contructor.

Creates an invalid iterator.

Definition at line 507 of file WDataSetFibers.cpp.

WFiberPointsIterator::WFiberPointsIterator ( WDataSetFibers const *  fibers,
std::size_t  fbIdx,
std::size_t  idx,
bool  reverse = false 
)

Constructor.

Creates an iterator pointing to a certain point of a fiber.

Parameters:
fibersThe pointer to the fiber data.
fbIdxThe index of the fiber in the fiber dataset.
idxThe index of the point of the curent fiber.
reverseWhether to iterate backwards.

Definition at line 515 of file WDataSetFibers.cpp.

Copy constructor.

Parameters:
iterThe iterator to copy from.

Definition at line 523 of file WDataSetFibers.cpp.

Destructor.

Definition at line 531 of file WDataSetFibers.cpp.


Member Function Documentation

std::size_t WFiberPointsIterator::getBaseIndex ( ) const [protected]

Calculates the index of this point in the dataset arrays.

But be aware that this index works vertex-wise. This mens, getting the y coordinate of the vertex in the dataset vertex array, use 3 * getBaseIndex() + 1. This depends on the type of array you like to query.

Notes:
this function properly handles the case when walking in reverse direction.
Returns:
the base index, vertex-wise.

Definition at line 576 of file WDataSetFibers.cpp.

References WDataSetFibers::getLineLengths(), WDataSetFibers::getLineStartIndexes(), m_fiberIndex, m_fibers, m_index, and m_reverse.

Referenced by getColor(), getParameter(), getTangent(), and operator*().

Return the color of the point.

Returns:
the color.

Definition at line 667 of file WDataSetFibers.cpp.

References WDataSetFibers::getColorScheme(), and m_fibers.

Referenced by getColor().

WColor WFiberPointsIterator::getColor ( std::size_t  idx) const

Return the color of the point.

Parameters:
idxthe index of the colorscheme to use.
Exceptions:
WDHNoSuchDataSetif the colorscheme does not exist.
Returns:
the color.

Definition at line 672 of file WDataSetFibers.cpp.

References getColor(), WDataSetFibers::getColorScheme(), and m_fibers.

WColor WFiberPointsIterator::getColor ( std::string  name) const

Return the color of the point.

Parameters:
namethe name of the colorscheme to use.
Exceptions:
WDHNoSuchDataSetif the colorscheme does not exist.
Returns:
the color.

Definition at line 677 of file WDataSetFibers.cpp.

References getColor(), WDataSetFibers::getColorScheme(), and m_fibers.

WColor WFiberPointsIterator::getColor ( const boost::shared_ptr< WDataSetFibers::ColorScheme scheme) const

Return the color of the point.

Parameters:
schemethe colorscheme to use.
Exceptions:
WDHNoSuchDataSetif the colorscheme does not exist.
Returns:
the color.

Definition at line 631 of file WDataSetFibers.cpp.

References getBaseIndex(), WDataSetFibers::ColorScheme::GRAY, WDataSetFibers::ColorScheme::RGB, and WDataSetFibers::ColorScheme::RGBA.

double WFiberPointsIterator::getParameter ( double  def = 0.0) const

Returns the parameter specified in the vertex parameter array of the dataset.

If no such array was set, the specified default will be returned.

Parameters:
defthe default value which will be returned if no vertex parameter array was defined.
Returns:
the value or the specified default

Definition at line 613 of file WDataSetFibers.cpp.

References getBaseIndex(), WDataSetFibers::getVertexParameters(), and m_fibers.

The tangent of the point.

Returns:
the tangent

Definition at line 622 of file WDataSetFibers.cpp.

References getBaseIndex(), WDataSetFibers::getTangents(), and m_fibers.

bool WFiberPointsIterator::operator!= ( WFiberPointsIterator const &  rhs) const

Compare to another point iterator.

Parameters:
rhsThe second point iterator.
Returns:
false, iff the two iterators point to the same point of the same fiber.

Definition at line 608 of file WDataSetFibers.cpp.

References operator==().

WPosition WFiberPointsIterator::operator* ( )

Returns the coordinates of the point currently pointed to.

Returns:
The current coordinates.

Definition at line 590 of file WDataSetFibers.cpp.

References getBaseIndex(), WDataSetFibers::getVertices(), and m_fibers.

WFiberPointsIterator & WFiberPointsIterator::operator++ ( )

Increment operator.

Makes the iterator point to the next point.

Returns:
The incremented iterator.

Definition at line 550 of file WDataSetFibers.cpp.

References m_index.

WFiberPointsIterator WFiberPointsIterator::operator++ ( int  )

Increment operator.

Makes the iterator point to the next point.

Returns:
The iterator before incrementing.

Definition at line 556 of file WDataSetFibers.cpp.

References m_fiberIndex, m_fibers, m_index, and m_reverse.

WFiberPointsIterator & WFiberPointsIterator::operator-- ( )

Decrement operator.

Makes the iterator point to the previous point. 3

Returns:
The incremented iterator.

Definition at line 563 of file WDataSetFibers.cpp.

References m_index.

WFiberPointsIterator WFiberPointsIterator::operator-- ( int  )

Decrement operator.

Makes the iterator point to the previous point.

Returns:
The iterator before decrementing.

Definition at line 569 of file WDataSetFibers.cpp.

References m_fiberIndex, m_fibers, m_index, and m_reverse.

WFiberPointsIterator & WFiberPointsIterator::operator= ( WFiberPointsIterator const &  iter)

Copy operator.

Parameters:
iterThe iterator to copy from.
Returns:
*this

Definition at line 535 of file WDataSetFibers.cpp.

References m_fiberIndex, m_fibers, m_index, and m_reverse.

bool WFiberPointsIterator::operator== ( WFiberPointsIterator const &  rhs) const

Compare to another point iterator.

Parameters:
rhsThe second point iterator.
Returns:
true, iff the two iterators point to the same point of the same fiber.

Definition at line 598 of file WDataSetFibers.cpp.

References m_fiberIndex, m_fibers, m_index, m_reverse, and wlog::warn().

Referenced by operator!=().


Member Data Documentation

std::size_t WFiberPointsIterator::m_fiberIndex [private]

The index of the fiber.

Definition at line 816 of file WDataSetFibers.h.

Referenced by getBaseIndex(), operator++(), operator--(), operator=(), and operator==().

The pointer to the fibers.

Definition at line 813 of file WDataSetFibers.h.

Referenced by getBaseIndex(), getColor(), getParameter(), getTangent(), operator*(), operator++(), operator--(), operator=(), and operator==().

std::size_t WFiberPointsIterator::m_index [private]

The index of the current point.

Definition at line 819 of file WDataSetFibers.h.

Referenced by getBaseIndex(), operator++(), operator--(), operator=(), and operator==().

Whether to iterate backwards.

Definition at line 822 of file WDataSetFibers.h.

Referenced by getBaseIndex(), operator++(), operator--(), operator=(), and operator==().


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