OpenWalnut  1.4.0
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
WDataSetPoints Class Reference

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

#include <WDataSetPoints.h>

+ Inheritance diagram for WDataSetPoints:

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. More...
 
typedef boost::shared_ptr
< const WDataSetPoints
ConstSPtr
 Pointer to const dataset. More...
 
typedef boost::shared_ptr
< std::vector< float > > 
VertexArray
 List of vertex coordinates in term of components of vertices. More...
 
typedef boost::shared_ptr
< std::vector< float > > 
ColorArray
 Colors for each vertex in VertexArray. More...
 
- Public Types inherited from WDataSet
typedef boost::shared_ptr
< WDataSet
SPtr
 Shared pointer abbreviation to a instance of this class. More...
 
typedef boost::shared_ptr
< const WDataSet
ConstSPtr
 Shared pointer abbreviation to a const instance of this class. More...
 

Public Member Functions

 WDataSetPoints (VertexArray vertices, ColorArray colors, WBoundingBox boundingBox)
 Constructs a new set of points. More...
 
 WDataSetPoints (VertexArray vertices, ColorArray colors)
 Constructs a new set of points. More...
 
 WDataSetPoints ()
 Constructs a new set of points. More...
 
virtual ~WDataSetPoints ()
 Destructor. More...
 
size_t size () const
 Get number of points in this data set. More...
 
virtual bool isTexture () const
 Determines whether this dataset can be used as a texture. More...
 
virtual const std::string getName () const
 Gets the name of this prototype. More...
 
virtual const std::string getDescription () const
 Gets the description for this prototype. More...
 
VertexArray getVertices () const
 Getter for the point vertices. More...
 
ColorArray getColors () const
 Getter for the point colors. More...
 
WBoundingBox getBoundingBox () const
 Get the bounding box. More...
 
WPosition operator[] (const size_t pointIdx) const
 Query coordinates of a given point. More...
 
WPosition getPosition (const size_t pointIdx) const
 Query coordinates of a given point. More...
 
WColor getColor (const size_t pointIdx) const
 The color of a given point. More...
 
bool isValidPointIdx (const size_t pointIdx) const
 Is this a valid point index? More...
 
ColorType getColorType () const
 Check the type of color. More...
 
- Public Member Functions inherited from WDataSet
 WDataSet ()
 This constructor should be used if a dataSet does not stem from a file. More...
 
virtual ~WDataSet ()
 Since WDataSet is a base class and thus should be polymorphic we add virtual destructor. More...
 
void setFilename (const std::string filename)
 Set the name of the file that this data set stems from. More...
 
std::string getFilename () const
 Get the name of the file that this data set stems from. More...
 
OW_API_DEPRECATED void setFileName (const std::string filename)
 Set the name of the file that this data set stems from. More...
 
OW_API_DEPRECATED std::string getFileName () const
 Get the name of the file that this data set stems from. More...
 
virtual boost::shared_ptr
< WDataSetVector
isVectorDataSet ()
 Checks if this dataset is a vector dataset. More...
 
virtual osg::ref_ptr
< WDataTexture3D
getTexture () const
 Returns the texture- representation of the dataset. More...
 
boost::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset. More...
 
boost::shared_ptr< WPropertiesgetInformationProperties () const
 Return a pointer to the information properties object of the dataset. More...
 
- Public Member Functions inherited from WTransferable
 WTransferable ()
 Default constructor. More...
 
virtual ~WTransferable ()
 Destructor. More...
 
- Public Member Functions inherited from WPrototyped
 WPrototyped ()
 Default constructor. More...
 
virtual ~WPrototyped ()
 Destructor. More...
 
template<typename T >
bool isA ()
 Checks whether the actual prototype has the specified runtime type. More...
 

Static Public Member Functions

static boost::shared_ptr
< WPrototyped
getPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 
- Static Public Member Functions inherited from WDataSet
static boost::shared_ptr
< WPrototyped
getPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 

Static Protected Attributes

static boost::shared_ptr
< WPrototyped
m_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 
- Static Protected Attributes inherited from WDataSet
static boost::shared_ptr
< WPrototyped
m_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Protected Attributes inherited from WDataSet
boost::shared_ptr< WPropertiesm_properties
 The property object for the dataset. More...
 
boost::shared_ptr< WPropertiesm_infoProperties
 The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". More...
 

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.

Definition at line 52 of file WDataSetPoints.h.

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

Pointer to dataset.

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

WDataSetPoints::WDataSetPoints ( WDataSetPoints::VertexArray  vertices,
WDataSetPoints::ColorArray  colors,
WBoundingBox  boundingBox 
)

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().

WDataSetPoints::WDataSetPoints ( WDataSetPoints::VertexArray  vertices,
WDataSetPoints::ColorArray  colors 
)

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().

WDataSetPoints::WDataSetPoints ( )

Constructs a new set of points.

The constructed instance is empty..

Definition at line 76 of file WDataSetPoints.cpp.

Referenced by getPrototype().

WDataSetPoints::~WDataSetPoints ( )
virtual

Destructor.

Definition at line 81 of file WDataSetPoints.cpp.

Member Function Documentation

WBoundingBox WDataSetPoints::getBoundingBox ( ) const

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.

WDataSetPoints::ColorArray WDataSetPoints::getColors ( ) const

Getter for the point colors.

Returns
The colors

Definition at line 158 of file WDataSetPoints.cpp.

References m_colors.

WDataSetPoints::ColorType WDataSetPoints::getColorType ( ) const

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.

Definition at line 143 of file WDataSetPoints.cpp.

References m_prototype, and WDataSetPoints().

WDataSetPoints::VertexArray WDataSetPoints::getVertices ( ) const

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().

size_t WDataSetPoints::size ( ) const

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

WBoundingBox WDataSetPoints::m_bb
private

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

Definition at line 232 of file WDataSetPoints.h.

Referenced by getBoundingBox(), and init().

ColorArray WDataSetPoints::m_colors
private

An array of the colors per vertex.

Definition at line 222 of file WDataSetPoints.h.

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

ColorType WDataSetPoints::m_colorType
private

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 >()
staticprotected

The prototype as singleton.

Definition at line 211 of file WDataSetPoints.h.

Referenced by getPrototype().

VertexArray WDataSetPoints::m_vertices
private

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: