This class is used to generate DataElementSets from the current DataSource of an UnstructGridModel. More...
Public Types | |
enum | ElementPositionCriterion { FRONT = 0x01, ON = 0x02, BACK = 0x04 } |
Bit-mask used to specify which elements to include with regards to the plane. These values are then combined into the ElementPositionCriteria used in createFromPlane() More... | |
typedef int | ElementPositionCriteria |
Bit-mask made up of ElementPositionCriterion which specifies which elements will be accepted based on the corresponding plane. More... | |
Public Member Functions | |
DataElementSetGenerator (const UnstructGridModel &model, size_t frameIndex) | |
Creates the generator. You specify the model and frameIndex to use. More... | |
PtrRef< DataElementSet > | createFromRegion (int setId, int x, int y, unsigned int width, unsigned int height, const vis::View &view, bool includePartiallyContainedElements) |
Creates a DataElementSet with all elements that are within the given region of the screen. More... | |
PtrRef< DataElementSet > | createFromPolygon (int setId, const std::vector< Vec2f > &polygonInWindowCoordinates, const vis::View &view, bool includePartiallyContainedElements) |
Creates a DataElementSet with all elements that are within the given polygon of the screen. More... | |
PtrRef< DataElementSet > | createFromPlane (int setId, const Plane &plane, ElementPositionCriteria criteria) |
Creates a DataElementSet from a given plane and criteria. More... | |
PtrRef< DataElementSet > | createFromPlanes (int setId, const std::vector< Plane > &planes, ElementPositionCriteria criteria) |
Creates a DataElementSet from an array of planes and criteria. More... | |
PtrRef< DataElementSet > | createAllVisibleElements (int setId) |
Creates a DataElementSet with all visible elements in the given frame. More... | |
PtrRef< DataElementSet > | createAllElementsInPart (int setId, size_t geometryIndex, int partId) |
Creates a DataElementSet with all elements from the specified part in the given frame. More... | |
This class is used to generate DataElementSets from the current DataSource of an UnstructGridModel.
The class offers methods to create sets based on spatial constraints, both in world coordinates and in screen coordinates.
Bit-mask made up of ElementPositionCriterion which specifies which elements will be accepted based on the corresponding plane.
Bit-mask used to specify which elements to include with regards to the plane. These values are then combined into the ElementPositionCriteria used in createFromPlane()
Enumerator | |
---|---|
FRONT |
Constant indicating in front of plane. |
ON |
Constant indicating on the plane. |
BACK |
Constant indicating behind plane. |
cee::ug::DataElementSetGenerator::DataElementSetGenerator | ( | const UnstructGridModel & | model, |
size_t | frameIndex | ||
) |
Creates the generator. You specify the model and frameIndex to use.
The normal usage of this class is to create it on the stack whenever you need it.
PtrRef< DataElementSet > cee::ug::DataElementSetGenerator::createAllElementsInPart | ( | int | setId, |
size_t | geometryIndex, | ||
int | partId | ||
) |
Creates a DataElementSet with all elements from the specified part in the given frame.
PtrRef< DataElementSet > cee::ug::DataElementSetGenerator::createAllVisibleElements | ( | int | setId | ) |
Creates a DataElementSet with all visible elements in the given frame.
PtrRef< DataElementSet > cee::ug::DataElementSetGenerator::createFromPlane | ( | int | setId, |
const Plane & | plane, | ||
ElementPositionCriteria | criteria | ||
) |
Creates a DataElementSet from a given plane and criteria.
The element set is created according to given criteria on the element's position with respect to the plane: ON, FRONT and/or BACK. The element position is determined with the plane normal. Elements that meet the given criteria are added the generated set.
PtrRef< DataElementSet > cee::ug::DataElementSetGenerator::createFromPlanes | ( | int | setId, |
const std::vector< Plane > & | planes, | ||
ElementPositionCriteria | criteria | ||
) |
Creates a DataElementSet from an array of planes and criteria.
The element set is created according to given criteria on the element's position with respect to the planes: ON, FRONT and/or BACK. The element position is determined with each plane normal. Elements that meet the given criteria are added the generated set.
PtrRef< DataElementSet > cee::ug::DataElementSetGenerator::createFromPolygon | ( | int | setId, |
const std::vector< Vec2f > & | polygonInWindowCoordinates, | ||
const vis::View & | view, | ||
bool | includePartiallyContainedElements | ||
) |
Creates a DataElementSet with all elements that are within the given polygon of the screen.
The polygon is described by polygonInWindowCoordinates which contains the points defining the polygon outer contour. The array should contain all nodes in the polygon in the right order. Polygon edges will be created between 0 -> 1, 1 -> 2, .... n -> 0, so there is no need to repeat the first node in order to close the polygon (polygon will be closed).
The coordinates defining the polygon must be specified in OpenGL style coordinates, which means a right handed coordinate system with the origin in the lower left corner of the window.
Example: (100,100), (200, 100), (200, 200), (200, 100) This defines a square with lower left corner of (100, 100) and sides 100 long.
The includePartiallyContainedElements option controls if an element that is partially included in the specified polygon should be included in the resulting DataElementSet or not.
PtrRef< DataElementSet > cee::ug::DataElementSetGenerator::createFromRegion | ( | int | setId, |
int | x, | ||
int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
const vis::View & | view, | ||
bool | includePartiallyContainedElements | ||
) |
Creates a DataElementSet with all elements that are within the given region of the screen.
The x and y coordinates must be specified in OpenGL style coordinates, which means a right-handed coordinate system with the origin in the lower left corner of the window. The width and height are in pixels.
The includePartiallyContainedElements option controls if an element that is partially included in the specified region should be included in the resulting DataElementSet or not.