OpenWalnut
1.5.0dev
|
Dataset to store a bunch of points without order or topology. More...
#include <WDataSetPoints.h>
Public Types | |
enum | ColorType { GRAY = 1 , RGB = 3 , RGBA =4 } |
The type of colors we have for each point. More... | |
typedef std::shared_ptr< WDataSetPoints > | SPtr |
Pointer to dataset. More... | |
typedef std::shared_ptr< const WDataSetPoints > | ConstSPtr |
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< WDataSet > | SPtr |
Shared pointer abbreviation to a instance of this class. More... | |
typedef std::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=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< 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... | |
std::shared_ptr< WProperties > | getProperties () const |
Return a pointer to the properties object of the dataset. More... | |
std::shared_ptr< WProperties > | getInformationProperties () 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< WPrototyped > | getPrototype () |
Returns a prototype instantiated with the true type of the deriving class. More... | |
Static Public Member Functions inherited from WDataSet | |
static std::shared_ptr< WPrototyped > | getPrototype () |
Returns a prototype instantiated with the true type of the deriving class. More... | |
Static Protected Attributes | |
static std::shared_ptr< WPrototyped > | m_prototype = std::shared_ptr< WPrototyped >() |
The prototype as singleton. More... | |
Static Protected Attributes inherited from WDataSet | |
static std::shared_ptr< WPrototyped > | m_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< WProperties > | m_properties |
The property object for the dataset. More... | |
std::shared_ptr< WProperties > | m_infoProperties |
The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". More... | |
Dataset to store a bunch of points without order or topology.
Definition at line 41 of file WDataSetPoints.h.
typedef std::shared_ptr< std::vector< float > > WDataSetPoints::ColorArray |
Colors for each vertex in VertexArray.
Definition at line 63 of file WDataSetPoints.h.
typedef std::shared_ptr< const WDataSetPoints > WDataSetPoints::ConstSPtr |
Pointer to const dataset.
Definition at line 53 of file WDataSetPoints.h.
typedef std::shared_ptr< WDataSetPoints > WDataSetPoints::SPtr |
Pointer to dataset.
Definition at line 48 of file WDataSetPoints.h.
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.
The type of colors we have for each point.
Definition at line 202 of file WDataSetPoints.h.
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.
vertices | the vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme |
colors | the colors of each vertex. Can be NULL. Stored as R1,G1,B1,A1, ... Rn,Gn,Bn,An |
boundingBox | The 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 = 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.
vertices | the vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme |
colors | optional colors of each vertex. Stored as R1,[G1,B1,[A1,]] ... Rn,[Gn,Bn,[An]] |
data | optional extra data. |
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 78 of file WDataSetPoints.cpp.
Referenced by getPrototype().
|
virtual |
Destructor.
Definition at line 83 of file WDataSetPoints.cpp.
WBoundingBox WDataSetPoints::getBoundingBox | ( | ) | const |
Get the bounding box.
Definition at line 179 of file WDataSetPoints.cpp.
References m_bb.
WColor WDataSetPoints::getColor | ( | const size_t | pointIdx | ) | const |
The color of a given point.
WOutOfBounds | if invalid index is used. |
pointIdx | the point index. |
Definition at line 201 of file WDataSetPoints.cpp.
References getColorType(), isValidPointIdx(), and m_colors.
WDataSetPoints::ColorArray WDataSetPoints::getColors | ( | ) | const |
Getter for the point colors.
Definition at line 169 of file WDataSetPoints.cpp.
References m_colors.
WDataSetPoints::ColorType WDataSetPoints::getColorType | ( | ) | const |
Check the type of color.
Definition at line 235 of file WDataSetPoints.cpp.
References m_colorType.
Referenced by getColor().
std::any WDataSetPoints::getData | ( | ) | const |
Getter for the data set.
Definition at line 174 of file WDataSetPoints.cpp.
References m_data.
|
virtual |
Gets the description for this prototype.
Reimplemented from WDataSet.
Definition at line 149 of file WDataSetPoints.cpp.
|
virtual |
Gets the name of this prototype.
Reimplemented from WDataSet.
Definition at line 144 of file WDataSetPoints.cpp.
WPosition WDataSetPoints::getPosition | ( | const size_t | pointIdx | ) | const |
Query coordinates of a given point.
WOutOfBounds | if invalid index is used. |
pointIdx | the point index. |
Definition at line 196 of file WDataSetPoints.cpp.
References operator[]().
|
static |
Returns a prototype instantiated with the true type of the deriving class.
Definition at line 154 of file WDataSetPoints.cpp.
References m_prototype, and WDataSetPoints().
WDataSetPoints::VertexArray WDataSetPoints::getVertices | ( | ) | const |
Getter for the point vertices.
Definition at line 164 of file WDataSetPoints.cpp.
References m_vertices.
|
private |
Initialize arrays and bbox if needed.
Used during construction.
calcBB | if 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().
|
virtual |
Determines whether this dataset can be used as a texture.
Reimplemented from WDataSet.
Definition at line 139 of file WDataSetPoints.cpp.
bool WDataSetPoints::isValidPointIdx | ( | const size_t | pointIdx | ) | const |
Is this a valid point index?
pointIdx | the index to check |
Definition at line 230 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.
WOutOfBounds | if invalid index is used. |
pointIdx | the point index. |
Definition at line 184 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.
Definition at line 134 of file WDataSetPoints.cpp.
References m_vertices.
Referenced by isValidPointIdx().
|
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().
|
private |
An array of the colors per vertex.
Definition at line 230 of file WDataSetPoints.h.
Referenced by getColor(), getColors(), and init().
|
private |
Which colortype do we use in m_colors.
Definition at line 240 of file WDataSetPoints.h.
Referenced by getColorType(), and init().
|
private |
An optional vector for data per vertex.
Definition at line 235 of file WDataSetPoints.h.
Referenced by getData().
|
staticprotected |
The prototype as singleton.
Definition at line 219 of file WDataSetPoints.h.
Referenced by getPrototype().
|
private |
Point vector for all points.
Definition at line 225 of file WDataSetPoints.h.
Referenced by getVertices(), init(), operator[](), and size().