OpenWalnut  1.4.0
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes
WDataSetPoints Class Reference

Dataset to store a bunch of points without order or topology. More...

#include <WDataSetPoints.h>

+ Inheritance diagram for WDataSetPoints:

List of all members.

Public Types

enum  ColorType { GRAY = 1, RGB = 3, RGBA = 4 }
 The type of colors we have for each point. More...
typedef boost::shared_ptr
< WDataSetPoints
SPtr
 Pointer to dataset.
typedef boost::shared_ptr
< const WDataSetPoints
ConstSPtr
 Pointer to const dataset.
typedef boost::shared_ptr
< std::vector< float > > 
VertexArray
 List of vertex coordinates in term of components of vertices.
typedef boost::shared_ptr
< std::vector< float > > 
ColorArray
 Colors for each vertex in VertexArray.

Public Member Functions

 WDataSetPoints (VertexArray vertices, ColorArray colors, WBoundingBox boundingBox)
 Constructs a new set of points.
 WDataSetPoints (VertexArray vertices, ColorArray colors)
 Constructs a new set of points.
 WDataSetPoints ()
 Constructs a new set of points.
virtual ~WDataSetPoints ()
 Destructor.
size_t size () const
 Get number of points in this data set.
virtual bool isTexture () const
 Determines whether this dataset can be used as a texture.
virtual const std::string getName () const
 Gets the name of this prototype.
virtual const std::string getDescription () const
 Gets the description for this prototype.
VertexArray getVertices () const
 Getter for the point vertices.
ColorArray getColors () const
 Getter for the point colors.
WBoundingBox getBoundingBox () const
 Get the bounding box.
WPosition operator[] (const size_t pointIdx) const
 Query coordinates of a given point.
WPosition getPosition (const size_t pointIdx) const
 Query coordinates of a given point.
WColor getColor (const size_t pointIdx) const
 The color of a given point.
bool isValidPointIdx (const size_t pointIdx) const
 Is this a valid point index?
ColorType getColorType () const
 Check the type of color.

Static Public Member Functions

static boost::shared_ptr
< WPrototyped
getPrototype ()
 Returns a prototype instantiated with the true type of the deriving class.

Static Protected Attributes

static boost::shared_ptr
< WPrototyped
m_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton.

Private Member Functions

void init (bool calcBB=false)
 Initialize arrays and bbox if needed.

Private Attributes

VertexArray m_vertices
 Point vector for all points.
ColorArray m_colors
 An array of the colors per vertex.
ColorType m_colorType
 Which colortype do we use in m_colors.
WBoundingBox m_bb
 Axis aligned bounding box for all point-vertices of this dataset.

Detailed Description

Dataset to store a bunch of points without order or topology.

Definition at line 40 of file WDataSetPoints.h.


Member Typedef Documentation

typedef boost::shared_ptr< std::vector< float > > WDataSetPoints::ColorArray

Colors for each vertex in VertexArray.

Definition at line 62 of file WDataSetPoints.h.

typedef boost::shared_ptr< const WDataSetPoints > WDataSetPoints::ConstSPtr

Pointer to const dataset.

Reimplemented from WDataSet.

Definition at line 52 of file WDataSetPoints.h.

typedef boost::shared_ptr< WDataSetPoints > WDataSetPoints::SPtr

Pointer to dataset.

Reimplemented from WDataSet.

Definition at line 47 of file WDataSetPoints.h.

typedef boost::shared_ptr< std::vector< float > > WDataSetPoints::VertexArray

List of vertex coordinates in term of components of vertices.

Definition at line 57 of file WDataSetPoints.h.


Member Enumeration Documentation

The type of colors we have for each point.

Definition at line 194 of file WDataSetPoints.h.


Constructor & Destructor Documentation

Constructs a new set of points.

If no color is specified, white is used for all points.

Notes:
the number of floats in vertices must be a multiple of 3
Notes:
the number of floats in colors (if not NULL) must be vertices->size() / 3 times one of 1,3, or 4
Parameters:
verticesthe vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
colorsthe colors of each vertex. Can be NULL.. Stored as R1,G1,B1,A1, ... Rn,Gn,Bn,An
boundingBoxThe bounding box of the points (first minimum, second maximum).

Definition at line 38 of file WDataSetPoints.cpp.

References init().

Constructs a new set of points.

The bounding box is calculated during construction. If no color is specified, white is used for all points.

Notes:
the number of floats in vertices must be a multiple of 3
Notes:
the number of floats in colors (if not NULL) must be vertices->size() / 3 times one of 1,3, or 4
Parameters:
verticesthe vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
colorsthe colors of each vertex. Can be NULL.. Stored as R1,[G1,B1,[A1,]] ... Rn,[Gn,Bn,[An]]

Definition at line 58 of file WDataSetPoints.cpp.

References init().

Constructs a new set of points.

The constructed instance is empty..

Definition at line 76 of file WDataSetPoints.cpp.

Referenced by getPrototype().

Destructor.

Definition at line 81 of file WDataSetPoints.cpp.


Member Function Documentation

Get the bounding box.

Returns:
The bounding box of all points.

Definition at line 163 of file WDataSetPoints.cpp.

References m_bb.

WColor WDataSetPoints::getColor ( const size_t  pointIdx) const

The color of a given point.

Exceptions:
WOutOfBoundsif invalid index is used.
Parameters:
pointIdxthe point index.
Returns:
the color

Definition at line 185 of file WDataSetPoints.cpp.

References getColorType(), isValidPointIdx(), and m_colors.

Getter for the point colors.

Returns:
The colors

Definition at line 158 of file WDataSetPoints.cpp.

References m_colors.

Check the type of color.

Returns:
the type

Definition at line 219 of file WDataSetPoints.cpp.

References m_colorType.

Referenced by getColor().

const std::string WDataSetPoints::getDescription ( ) const [virtual]

Gets the description for this prototype.

Returns:
the description

Reimplemented from WDataSet.

Definition at line 138 of file WDataSetPoints.cpp.

const std::string WDataSetPoints::getName ( ) const [virtual]

Gets the name of this prototype.

Returns:
the name.

Reimplemented from WDataSet.

Definition at line 133 of file WDataSetPoints.cpp.

WPosition WDataSetPoints::getPosition ( const size_t  pointIdx) const

Query coordinates of a given point.

Exceptions:
WOutOfBoundsif invalid index is used.
Parameters:
pointIdxthe point index.
Returns:
the coordinates

Definition at line 180 of file WDataSetPoints.cpp.

References operator[]().

boost::shared_ptr< WPrototyped > WDataSetPoints::getPrototype ( ) [static]

Returns a prototype instantiated with the true type of the deriving class.

Returns:
the prototype.

Reimplemented from WDataSet.

Definition at line 143 of file WDataSetPoints.cpp.

References m_prototype, and WDataSetPoints().

Getter for the point vertices.

Returns:
The vertices

Definition at line 153 of file WDataSetPoints.cpp.

References m_vertices.

void WDataSetPoints::init ( bool  calcBB = false) [private]

Initialize arrays and bbox if needed.

Used during construction.

Parameters:
calcBBif true, the bounding box is calculated

Definition at line 86 of file WDataSetPoints.cpp.

References m_bb, m_colors, m_colorType, and m_vertices.

Referenced by WDataSetPoints().

bool WDataSetPoints::isTexture ( ) const [virtual]

Determines whether this dataset can be used as a texture.

Returns:
true if usable as texture.

Reimplemented from WDataSet.

Definition at line 128 of file WDataSetPoints.cpp.

bool WDataSetPoints::isValidPointIdx ( const size_t  pointIdx) const

Is this a valid point index?

Parameters:
pointIdxthe index to check
Returns:
true if yes.

Definition at line 214 of file WDataSetPoints.cpp.

References size().

Referenced by getColor(), and operator[]().

WPosition WDataSetPoints::operator[] ( const size_t  pointIdx) const

Query coordinates of a given point.

Exceptions:
WOutOfBoundsif invalid index is used.
Parameters:
pointIdxthe point index.
Returns:
the coordinates

Definition at line 168 of file WDataSetPoints.cpp.

References isValidPointIdx(), and m_vertices.

Referenced by getPosition().

Get number of points in this data set.

Returns:
number of points

Definition at line 123 of file WDataSetPoints.cpp.

References m_vertices.

Referenced by isValidPointIdx().


Member Data Documentation

Axis aligned bounding box for all point-vertices of this dataset.

Definition at line 232 of file WDataSetPoints.h.

Referenced by getBoundingBox(), and init().

An array of the colors per vertex.

Definition at line 222 of file WDataSetPoints.h.

Referenced by getColor(), getColors(), and init().

Which colortype do we use in m_colors.

Definition at line 227 of file WDataSetPoints.h.

Referenced by getColorType(), and init().

boost::shared_ptr< WPrototyped > WDataSetPoints::m_prototype = boost::shared_ptr< WPrototyped >() [static, protected]

The prototype as singleton.

Reimplemented from WDataSet.

Definition at line 211 of file WDataSetPoints.h.

Referenced by getPrototype().

Point vector for all points.

Definition at line 217 of file WDataSetPoints.h.

Referenced by getVertices(), init(), operator[](), and size().


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