OpenWalnut  1.5.0dev
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:
+ Collaboration diagram for WDataSetPoints:

Public Types

enum  ColorType { GRAY = 1 , RGB = 3 , RGBA =4 }
 The type of colors we have for each point. More...
 
typedef std::shared_ptr< WDataSetPointsSPtr
 Pointer to dataset. More...
 
typedef std::shared_ptr< const WDataSetPointsConstSPtr
 Pointer to const dataset. More...
 
typedef std::shared_ptr< std::vector< float > > VertexArray
 List of vertex coordinates in term of components of vertices. More...
 
typedef std::shared_ptr< std::vector< float > > ColorArray
 Colors for each vertex in VertexArray. More...
 
- Public Types inherited from WDataSet
typedef std::shared_ptr< WDataSetSPtr
 Shared pointer abbreviation to a instance of this class. More...
 
typedef std::shared_ptr< const WDataSetConstSPtr
 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=NULL, std::any data=NULL)
 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...
 
std::any getData () const
 Getter for the data set. 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 std::shared_ptr< WDataSetVectorisVectorDataSet ()
 Checks if this dataset is a vector dataset. More...
 
virtual osg::ref_ptr< WDataTexture3DgetTexture () const
 Returns the texture- representation of the dataset. More...
 
std::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset. More...
 
std::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 std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 
- Static Public Member Functions inherited from WDataSet
static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 

Static Protected Attributes

static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 
- Static Protected Attributes inherited from WDataSet
static std::shared_ptr< WPrototypedm_prototype = std::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...
 
std::any m_data
 An optional vector for data 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
std::shared_ptr< WPropertiesm_properties
 The property object for the dataset. More...
 
std::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 41 of file WDataSetPoints.h.

Member Typedef Documentation

◆ ColorArray

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

Colors for each vertex in VertexArray.

Definition at line 63 of file WDataSetPoints.h.

◆ ConstSPtr

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

Pointer to const dataset.

Definition at line 53 of file WDataSetPoints.h.

◆ SPtr

typedef std::shared_ptr< WDataSetPoints > WDataSetPoints::SPtr

Pointer to dataset.

Definition at line 48 of file WDataSetPoints.h.

◆ VertexArray

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

List of vertex coordinates in term of components of vertices.

Definition at line 58 of file WDataSetPoints.h.

Member Enumeration Documentation

◆ ColorType

The type of colors we have for each point.

Definition at line 202 of file WDataSetPoints.h.

Constructor & Destructor Documentation

◆ WDataSetPoints() [1/3]

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.

Note
the number of floats in vertices must be a multiple of 3
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().

+ Here is the call graph for this function:

◆ WDataSetPoints() [2/3]

WDataSetPoints::WDataSetPoints ( WDataSetPoints::VertexArray  vertices,
WDataSetPoints::ColorArray  colors = NULL,
std::any  data = NULL 
)

Constructs a new set of points.

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

Note
the number of floats in vertices must be a multiple of 3
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
colorsoptional colors of each vertex. Stored as R1,[G1,B1,[A1,]] ... Rn,[Gn,Bn,[An]]
dataoptional extra data.

Definition at line 58 of file WDataSetPoints.cpp.

References init().

+ Here is the call graph for this function:

◆ WDataSetPoints() [3/3]

WDataSetPoints::WDataSetPoints ( )

Constructs a new set of points.

The constructed instance is empty.

Definition at line 78 of file WDataSetPoints.cpp.

Referenced by getPrototype().

+ Here is the caller graph for this function:

◆ ~WDataSetPoints()

WDataSetPoints::~WDataSetPoints ( )
virtual

Destructor.

Definition at line 83 of file WDataSetPoints.cpp.

Member Function Documentation

◆ getBoundingBox()

WBoundingBox WDataSetPoints::getBoundingBox ( ) const

Get the bounding box.

Returns
The bounding box of all points.

Definition at line 179 of file WDataSetPoints.cpp.

References m_bb.

◆ getColor()

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 201 of file WDataSetPoints.cpp.

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

+ Here is the call graph for this function:

◆ getColors()

WDataSetPoints::ColorArray WDataSetPoints::getColors ( ) const

Getter for the point colors.

Returns
The colors

Definition at line 169 of file WDataSetPoints.cpp.

References m_colors.

◆ getColorType()

WDataSetPoints::ColorType WDataSetPoints::getColorType ( ) const

Check the type of color.

Returns
the type

Definition at line 235 of file WDataSetPoints.cpp.

References m_colorType.

Referenced by getColor().

+ Here is the caller graph for this function:

◆ getData()

std::any WDataSetPoints::getData ( ) const

Getter for the data set.

Returns
The data set

Definition at line 174 of file WDataSetPoints.cpp.

References m_data.

◆ getDescription()

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

Gets the description for this prototype.

Returns
the description

Reimplemented from WDataSet.

Definition at line 149 of file WDataSetPoints.cpp.

◆ getName()

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

Gets the name of this prototype.

Returns
the name.

Reimplemented from WDataSet.

Definition at line 144 of file WDataSetPoints.cpp.

◆ getPosition()

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 196 of file WDataSetPoints.cpp.

References operator[]().

+ Here is the call graph for this function:

◆ getPrototype()

std::shared_ptr< WPrototyped > WDataSetPoints::getPrototype ( )
static

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

Returns
the prototype.

Definition at line 154 of file WDataSetPoints.cpp.

References m_prototype, and WDataSetPoints().

+ Here is the call graph for this function:

◆ getVertices()

WDataSetPoints::VertexArray WDataSetPoints::getVertices ( ) const

Getter for the point vertices.

Returns
The vertices

Definition at line 164 of file WDataSetPoints.cpp.

References m_vertices.

◆ init()

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 88 of file WDataSetPoints.cpp.

References m_bb, m_colors, m_colorType, and m_vertices.

Referenced by WDataSetPoints().

+ Here is the caller graph for this function:

◆ isTexture()

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 139 of file WDataSetPoints.cpp.

◆ isValidPointIdx()

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 230 of file WDataSetPoints.cpp.

References size().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 184 of file WDataSetPoints.cpp.

References isValidPointIdx(), and m_vertices.

Referenced by getPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

size_t WDataSetPoints::size ( ) const

Get number of points in this data set.

Returns
number of points

Definition at line 134 of file WDataSetPoints.cpp.

References m_vertices.

Referenced by isValidPointIdx().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bb

WBoundingBox WDataSetPoints::m_bb
private

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

Definition at line 245 of file WDataSetPoints.h.

Referenced by getBoundingBox(), and init().

◆ m_colors

ColorArray WDataSetPoints::m_colors
private

An array of the colors per vertex.

Definition at line 230 of file WDataSetPoints.h.

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

◆ m_colorType

ColorType WDataSetPoints::m_colorType
private

Which colortype do we use in m_colors.

Definition at line 240 of file WDataSetPoints.h.

Referenced by getColorType(), and init().

◆ m_data

std::any WDataSetPoints::m_data
private

An optional vector for data per vertex.

Definition at line 235 of file WDataSetPoints.h.

Referenced by getData().

◆ m_prototype

std::shared_ptr< WPrototyped > WDataSetPoints::m_prototype = std::shared_ptr< WPrototyped >()
staticprotected

The prototype as singleton.

Definition at line 219 of file WDataSetPoints.h.

Referenced by getPrototype().

◆ m_vertices

VertexArray WDataSetPoints::m_vertices
private

Point vector for all points.

Definition at line 225 of file WDataSetPoints.h.

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


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