cee::geo::DataIndexedPolylines

class DataIndexedPolylines : public Data

Data structure representing polylines data for a geometry part used in the GeometryModel

Polylines data consist of an array of vertices, and a two dimensional array of indices where each entry describes a polyline. You can have as many polylines as you want, and each polyline can have any number of segments.

See also

GeometryModel, Part, and Data

Public Functions

DataIndexedPolylines()

Constructs an empty data object.

DataIndexedPolylines(const std::vector<Vec3d> &vertices, const std::vector<std::vector<unsigned int>> &indices)

Constructs polyline data defined by an array of vertices and an array of indices.

indices is a two dimensional array where each entry describes a polyline. You can have as many polylines as you want, and each polyline can have any number of segments.

Example, part containing two polylines:

// Polyline vertices
std::vector<cee::Vec3d> polylinesVertices;
polylinesVertices.push_back(cee::Vec3d(0.0, 0.0, 0.0));
polylinesVertices.push_back(cee::Vec3d(1.0, 0.0, 0.0));
polylinesVertices.push_back(cee::Vec3d(1.5, 0.0, 1.0));
polylinesVertices.push_back(cee::Vec3d(0.0, 0.0, -1.0));
polylinesVertices.push_back(cee::Vec3d(1.0, 0.0, -1.0));
polylinesVertices.push_back(cee::Vec3d(1.5, 0.0, 0.0));

// Polyline indices
std::vector<unsigned int> firstLineIndices = { 0, 1, 2 };
std::vector<unsigned int> secondLineIndices = { 3, 4, 5 };
std::vector<std::vector<unsigned int> > polylinesIndices;
polylinesIndices.push_back(firstLineIndices);   // First polyline
polylinesIndices.push_back(secondLineIndices);  // Second polyline

// Create polyline data part using the vertices and connectivities
cee::PtrRef<cee::geo::DataIndexedPolylines> linePartData = new cee::geo::DataIndexedPolylines(polylinesVertices, polylinesIndices);

virtual Type type() const

Returns Data::INDEXED_POLYLINES.

virtual BoundingBox boundingBox() const

Returns the bounding box of the part data.

This also includes vertices which may not be used by the indices data.

size_t vertexCount() const

Returns number of vertices for all polylines.

std::vector<Vec3d> vertices() const

Returns an array of vertices for all the polylines.

These vertices are used to build up each polyline defined by their associated connectivity indices.

void setVertices(const std::vector<Vec3d> &vertices)

Sets vertices used by all the polylines.

These vertices are used to build up each polyline defined by their associated connectivity indices.

size_t polylineCount() const

Returns number of polylines.

std::vector<std::vector<unsigned int>> polylinesIndices() const

Returns the two dimensional array of indices for all polylines in data.

void setPolylinesIndices(const std::vector<std::vector<unsigned int>> &indices)

Sets the indices into the vertex array for all polylines.

The indices must be a two dimensional array, even if there is only one polyline.

Example:

std::vector<unsigned int> firstLineIndices = { 0, 1, 2 };
std::vector<unsigned int> secondLineIndices = { 3, 4, 5 };
std::vector<std::vector<unsigned int> > polylinesIndices;
polylinesIndices.push_back(firstLineIndices);
polylinesIndices.push_back(secondLineIndices);

// Create polyline data part using the vertices and connectivities
cee::PtrRef<cee::geo::DataIndexedPolylines> linePartData = new cee::geo::DataIndexedPolylines();
linePartData->setVertices(polylinesVertices);
linePartData->setPolylinesIndices(polylinesIndices);

Note! This does not affect the bounding box.

void removeAll()

Clears all data.