UnstructGridModel is a subclass of Model which adds specific model structure and functionality for representing scientific and engineering models, e.g. finite element data. More...
Public Types | |
enum | UpdateAction { NORMAL, HIGHLIGHT, VISIBILITY, COLOR_AND_OPACITY, SCALAR_SETTINGS, COLOR_LEGEND, NODE_POSITIONS, TRANSFORMATION_RESULTS, CUTTING_PLANE, ISOSURFACE, ISOVOLUME, PARTICLE_TRACE, REGENERATE_ALL } |
Update action. Used in updateVisualization() to specify level of update needed in order to optimize the update. More... | |
Public Member Functions | |
UnstructGridModel () | |
Constructs an empty model. More... | |
const DataSource * | dataSource () const |
Returns the data source. More... | |
DataSource * | dataSource () |
Returns the data source. More... | |
void | setDataSource (DataSource *dataSource) |
Sets the data source. More... | |
const ModelSpec & | modelSpec () const |
Gets the model specification. More... | |
ModelSpec & | modelSpec () |
Gets the model specification. More... | |
virtual bool | updateVisualization (UpdateAction updateAction=NORMAL, Progress *progress=NULL, Error *error=NULL) |
Updates the visualization based on the current settings. More... | |
void | clearVisualization () |
Clears visualization. More... | |
virtual size_t | startUpdateVisualizationPerFrame (Error *error=NULL) |
Prepares for a per-frame update of the visualization. Returns the number of frames to generate. More... | |
virtual bool | updateVisualizationForFrame (size_t frameIndex, Error *error=NULL) |
Updates the visualization for the given frame. More... | |
const ModelSettings & | modelSettings () const |
Returns a reference to the model settings for this model. More... | |
ModelSettings & | modelSettings () |
Returns a reference to the model settings for this model. More... | |
bool | rayIntersect (int x, int y, const vis::View &view, HitItem *hitItem) const |
Does picking at the given screen coordinates, returning true if anything was hit. More... | |
bool | rayIntersectAllHits (int x, int y, const vis::View &view, HitItemCollection *hitItems) const |
Does picking at the given screen coordinates, returning true if anything was hit and returning all overlapping items if any. More... | |
bool | regionIntersect (int x, int y, unsigned int width, unsigned int height, const vis::View &view, bool acceptPartiallyContainedItems, bool includeElementIndices, std::vector< PartHitItems > *itemList) const |
Finds the parts (and optionally elements) that are (partially) inside the given region. More... | |
bool | polygonIntersect (const std::vector< Vec2f > &polygonInWindowCoordinates, const vis::View &view, bool acceptPartiallyContainedItems, bool includeElementIndices, std::vector< PartHitItems > *itemList) const |
Finds the parts (and optionally elements) that are (partially) inside the given polygon defined in window coordinates. More... | |
bool | rayIntersect (const Ray &ray, HitItem *hitItem) const |
Takes a Ray object and returns a HitItem object. More... | |
bool | rayIntersectAllHits (const Ray &ray, HitItemCollection *hitItems) const |
Takes a Ray object and returns all HitItems objects hit by it. More... | |
size_t | frameCount () const |
Returns the number of frames currently available. More... | |
size_t | currentFrameIndex () const |
Returns the index of the current frame. More... | |
int | currentStateId () const |
Returns the id of the current DataState (the data state in the current frame). More... | |
void | setCurrentFrameIndex (size_t frameIndex) |
Sets the current frame (the frame to render). More... | |
double | particleTraceTime () const |
Returns the current particle trace time. More... | |
void | setParticleTraceTime (double time) |
Sets the current particle trace time. More... | |
virtual BoundingBox | boundingBox () |
Returns the bounding box of the model. More... | |
virtual BoundingBox | frameBoundingBox (size_t frameIndex) |
Returns the bounding box of the model in the given frame. More... | |
virtual BoundingBox | partBoundingBox (size_t frameIndex, size_t globalGeometryIndex, int partId) |
Returns the bounding box of the part in the given frame. More... | |
virtual Str | modelInfo () const |
Returns info regarding the current model contents. More... | |
PartSettings * | partSettings (size_t globalGeometryIndex, int partId) |
Returns the part settings for the part with partId. More... | |
const PartSettings * | existingPartSettings (size_t globalGeometryIndex, int partId) const |
Returns the part settings for the part with partId. More... | |
ScalarSettings * | scalarSettings (int resultId) |
Returns scalar settings for the scalar result with resultId. More... | |
const ScalarSettings * | existingScalarSettings (int resultId) const |
Returns scalar settings for the scalar result with resultId. More... | |
VectorSettings * | vectorSettings (int resultId) |
Returns the vector settings for the vector result with resultId. More... | |
const VectorSettings * | existingVectorSettings (int resultId) const |
Returns vector settings for the vector result with resultId. More... | |
DisplacementSettings * | displacementSettings (int resultId) |
Returns the displacement settings for the displacement result with resultId. More... | |
const DisplacementSettings * | existingDisplacementSettings (int resultId) const |
Returns displacement settings for the result with resultId. More... | |
size_t | cuttingPlaneCount () const |
Returns number of of cutting planes. More... | |
const CuttingPlane * | cuttingPlane (size_t index) const |
Returns the cutting plane at the given index. More... | |
CuttingPlane * | cuttingPlane (size_t index) |
Returns the cutting plane at the given index. More... | |
void | addCuttingPlane (CuttingPlane *cuttingplane) |
Adds a cutting plane to the model. More... | |
void | removeCuttingPlane (const CuttingPlane *cuttingplane) |
Removes the cutting plane cuttingplane from the model. More... | |
void | removeAllCuttingPlanes () |
Removes all cutting planes from the model. More... | |
size_t | isosurfaceCount () const |
Returns number of isosurfaces. More... | |
const Isosurface * | isosurface (size_t index) const |
Returns the isosurface at the given index. More... | |
Isosurface * | isosurface (size_t index) |
Returns the isosurface at the given index. More... | |
void | addIsosurface (Isosurface *isosurf) |
Adds an isosurface to the model. More... | |
void | removeIsosurface (const Isosurface *isosurf) |
Removes the isosurface isosurf from the model. More... | |
void | removeAllIsosurfaces () |
Removes all isosurfaces from the model. More... | |
size_t | isovolumeCount () const |
Returns number of isovolumes. More... | |
const Isovolume * | isovolume (size_t index) const |
Returns the isovolume at the given index. More... | |
Isovolume * | isovolume (size_t index) |
Returns the isovolume at the given index. More... | |
void | addIsovolume (Isovolume *isosurf) |
Adds an isovolume to the model. More... | |
void | removeIsovolume (const Isovolume *volume) |
Removes the isovolume volume from the model. More... | |
void | removeAllIsovolumes () |
Removes all isovolumes from the model. More... | |
size_t | particleTraceGroupCount () const |
Returns the number of particle trace groups in the model. More... | |
const ParticleTraceGroup * | particleTraceGroup (size_t index) const |
Returns the particle trace group at the given index. More... | |
ParticleTraceGroup * | particleTraceGroup (size_t index) |
Returns the particle trace group at the given index. More... | |
void | addParticleTraceGroup (ParticleTraceGroup *group) |
Adds a new particle trace group to the model. More... | |
void | removeParticleTraceGroup (const ParticleTraceGroup *group) |
Removes the given particle trace group from the model. More... | |
void | removeAllParticleTraceGroups () |
Removes all particle trace groups from the model. More... | |
bool | particleTraceTimeRange (size_t frameIndex, double *minimumTime, double *maximumTime) const |
Gets the time range (min to max) of the given frame. More... | |
bool | scalarRange (int resultId, double *min, double *max) const |
Queries the model for the minimum and maximum of the specified scalar result. More... | |
bool | vectorRange (int resultId, double *min, double *max) const |
Queries the model for the min and max of the specified vector result. More... | |
bool | displacementRange (double *min, double *max) const |
Queries the model for the min and max of the current displacement result. More... | |
cee::Color3f | elementSetColor (int setId) const |
Returns the element set color for the specified set id. More... | |
void | setElementSetColor (int setId, const Color3f &color) |
Sets the /a color for the set given by /a setId. More... | |
MirrorSettings & | mirrorSettings () |
Returns the mirror settings for the model. More... | |
const MirrorSettings & | mirrorSettings () const |
Returns the mirror settings for the model. More... | |
![]() | |
Model () | |
Constructs an empty model. More... | |
Str | name () const |
Returns the name of the model. More... | |
void | setName (const Str &name) |
Sets the name of the model. More... | |
bool | use2dPixelProjection () const |
Returns true if the model is using a 2D pixel exact projection to render its content. More... | |
void | setUse2dPixelProjection (bool use2dMode) |
Specify if this model should use an override camera to render 2D sceen aligned data. More... | |
![]() | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
Additional Inherited Members | |
![]() | |
enum | NotifyAction { NO_ACTION, MODEL_CHANGED } |
Notification sent to the view. More... | |
![]() | |
void | notifyObservingViews (NotifyAction notifyAction, const View *exceptView) |
Sends a notification to all observing views. More... | |
bool | hasAnyObservingViewsWithClipping (bool *outExplicitViewClippingIsActive=NULL, bool *outDropShadowClippingIsActive=NULL) const |
Returns true if the model is a being viewed in any views where clipping is enabled (either view clipping or shadow clipping) More... | |
UnstructGridModel is a subclass of Model which adds specific model structure and functionality for representing scientific and engineering models, e.g. finite element data.
It contains a description of visual presentation and feature extraction management such as part settings, result settings (scalar, vector and displacement), isosurfaces, isovolumes, cutting planes, particle traces and mirror settings.
The geometry data model consists of nodes, elements, element connectivity, and aggregations to parts. Nodes and elements can be index- or id-based. Elements also have optional user properties. Parts binds elements and nodes. A geometry consists of a collection of parts. The unstructured grid component supports multiple geometries per state and allows combination of static and dynamic geometries.
Supported element types are point, beam, triangle, quad, tetrahedron, pyramid, pentahedron, hexahedron and polyhedron. See Element::Type for full list of element types.
A View has a collection of models. Add a model to the view with View::addModel(). See View for more information.
The model object owns a data source containing the actual data repository (nodes, topography and result data). Data sources can be file based or build by programmatic input. See DataSource for more information.
Set the data source by setDataSource() and get the current data source using dataSource().
The model specification describes the visual content of the model. For instance, loaded states, which scalar result to show as fringes or perhaps vector result. Each model owns a ModelSpec object which can be accessed through modelSpec().
When an attribute in the model specification has been set or altered, updateVisualization() must be called to apply the changes to the visualized model.
Example - Set a scalar result to be visualized as fringes:
Sets a fringes result in the model specification.
Remember to toggle on fringes visibility for the parts to see the visualized fringes.
Since a setting in the model specification has been altered, the visualization needs to be updated for the change to take effect.
Part settings
Part settings contains various attributes for a part. Part settings can, for instance, be visibility, draw style, transparency, color, result visibility. Get the part settings for a given part by calling partSettings() with the requested geometry index and part id.
A quick way to alter settings for all parts is using the part iterator.
Scalar settings
Scalar settings contains settings for a scalar result. Scalar settings can, for instance, be range, number of levels, legend visibility, color scheme and filtering. Get the scalar setting for a given scalar result by calling scalarSettings() with the requested scalar result id.
Vector settings
Vector settings contains settings for a vector result. Vector settings can, for instance, be scaling and color mode. Get the vector settings for a given vector result by calling vectorSettings() with the requested vector id.
Displacement setting
Displacement settings contains settings for a displacement result. Displacement settings are relative and absolute scaling values. Get the displacement settings for a given displacement result by calling displacementSettings() with the requested displacement id.
Mirror settings
Mirror settings contains setting for the mirror functionality. Mirror settings can, for instance, be enabled true/false, number of passes and Plane information. Get the mirror settings with mirrorSettings().
Model settings
Model settings contains miscellaneous setting for the unstructured grid model. For instance, mesh color, highlight color, undeformed model color/draw style, shader settings and UnstructGridModel related font selection. Get the model settings with modelSettings().
Cutting planes
Cutting planes are slices through the model onto which any scalar or vector fields can be mapped. A cutting plane is defined by a position and a normal vector. Both position and normal can be changed interactively.
Any number of cutting planes can be defined and displayed, and various display attributes can be set separately for each one.
Add a cutting plane with addCuttingPlane(). Remove a specified cutting plane with removeCuttingPlane() or remove all cutting planes with removeAllCuttingPlanes(). Get number of cutting planes in the model with cuttingPlaneCount() and access an existing cutting plane using cuttingPlane() with the requested cutting plane index.
Isosurface
Isosurfaces may be derived based on any scalar variable in a scalar result. In addition, a second scalar result can be mapped onto the surface, showing for instance the variation of temperature over a surface of Constant pressure. Any number of isosurfaces can be defined and displayed, and various display attributes can be set separately for each one. Add a isosurface with addIsosurface(). Remove a specified isosurface with removeIsosurface() or remove all isosurfaces with removeAllIsosurfaces(). Get number of isosurfaces in the model with isosurfaceCount() and access an existing isosurface using isosurface() with the requested isosurface index.
Isovolume
Isovolumes may be derived based on any scalar variable in a scalar result. In addition, a second scalar result can be mapped onto the surface, showing for instance the variation of temperature over a volume computed from Pressure. Any number of isovolumes can be defined and displayed, and various display attributes can be set separately for each one. Add a isovolume with addIsovolume(). Remove a specified isovolume with removeIsovolume() or remove all isovolumes with removeAllIsovolumes(). Get number of isovolumes in the model with isovolumeCount() and access an existing isovolume using isovolume() with the requested isovolume index.
Particle traces
To visualize features of a vector field, it is possible to define streamlines; the paths of mass less particles through the flow. A particle trace group is defined by seed points and a vector result. The particle trace can be animated. Add a particle trace group can be set with addParticleTraceGroup(). Remove the particle trace group with removeParticleTraceGroup(). The model controls which frame is current. Get number of frames in the model with frameCount(). Set and get current frame with setCurrentFrameIndex() and currentFrameIndex().
Find a intersection point with rayIntersect() or rayIntersectAllHits(). It takes a Ray object from the View and creates one or more HitItem object describing where the ray hit the model. See HitItem for a listing of available hit information. Other ray intersection functions are regionIntersect() and polygonIntersect().
Example on creating a model with a memory data source and custom built geometry.
Creates a model and a memory data source. The constructor of the data source takes a unique id and the number of geometries (here 1). Set the data source in the created model.
Creates the state. Set number of geometries to 1 in the constructor.
Sets the newly created state to current in the model specification.
Creates the geometry and add it to the state at index 0.
Build a geometry containing the necessary parts, nodes and elements. Optionally, add results.
When finished, update the metadata in the data source directory with all new content.
Add the finished model to the view.
See the complete source code at: UnstructGrid: Simple model with two triangles
Update action. Used in updateVisualization() to specify level of update needed in order to optimize the update.
Enumerator | |
---|---|
NORMAL |
Default update. Settings and data are inspected and any needed update is performed. |
HIGHLIGHT |
Use this if you only used the setHighlight() method on Parts, CuttingPlane, Isosurface or Isovolume. |
VISIBILITY |
Use this if you only used the setVisible() method on Parts, CuttingPlane, Isosurface or Isovolume. |
COLOR_AND_OPACITY |
Use this if you only used the set*Color() or setOpacity() on Parts, CuttingPlane, Isosurface or Isovolume. |
SCALAR_SETTINGS |
Use this if you only used the ScalarSettings and ColorMapper methods. |
COLOR_LEGEND |
Visual configuration of the color legend (visible, text color, etc) |
NODE_POSITIONS |
Only the positions of the nodes have changed. Note: Only use this when the position of the nodes have changed, but not the number of nodes or element topology. |
TRANSFORMATION_RESULTS |
Only the transformation results have changed, if any. |
CUTTING_PLANE |
Use this if you only changed cutting plane parameters (apart from mapped result). This will recompute the cutting plane in the current frame. All other frames will be computed whenever set visible using the setCurrentFrameIndex() method. |
ISOSURFACE |
Use this if you only changed isosurface parameters (apart from mapped result). This will recompute the isosurface in the current frame. All other frames will be computed whenever set visible using the setCurrentFrameIndex() method. |
ISOVOLUME |
Use this if you only changed isovolume parameters (apart from mapped result). This will recompute the isovolume in the current frame. All other frames will be computed whenever set visible using the setCurrentFrameIndex() method. |
PARTICLE_TRACE |
Use this if you only changed particle trace parameters (apart from mapped result). This will recompute the particle trace in the current frame. All other frames will be computed whenever set visible using the setCurrentFrameIndex() method. |
REGENERATE_ALL |
Force recreation of the supporting display model. Also forces reading of data from an interface (if in use). |
cee::ug::UnstructGridModel::UnstructGridModel | ( | ) |
Constructs an empty model.
void cee::ug::UnstructGridModel::addCuttingPlane | ( | CuttingPlane * | cuttingplane | ) |
Adds a cutting plane to the model.
Cutting planes cannot be shared between models. If you want to have the same cutting plane in two models, duplicate the plane. If you want to move a cutting plane, first remove it from the the original model before adding it to the second one.
void cee::ug::UnstructGridModel::addIsosurface | ( | Isosurface * | isosurf | ) |
Adds an isosurface to the model.
Isosurfaces cannot be shared between models. If you want to have the same isosurface in two models, duplicate the surface. If you want to move an isosurface from one model to another, remove it first from the original model before adding it to the second one.
void cee::ug::UnstructGridModel::addIsovolume | ( | Isovolume * | isosurf | ) |
Adds an isovolume to the model.
Isovolumes cannot be shared between models. If you want to have the same isovolume in two models, duplicate the volume. If you want to move an isovolume from one model to another, remove it first from the original model before adding it to the second one.
void cee::ug::UnstructGridModel::addParticleTraceGroup | ( | ParticleTraceGroup * | group | ) |
Adds a new particle trace group to the model.
Particle trace groups cannot be shared between models. If you want to have the same particle trace group in two models, duplicate the volume. If you want to move an particle trace group from one model to another, remove it first from the original model before adding it to the second one.
|
virtual |
Returns the bounding box of the model.
The bounding box will include all frames if an animation is present
Implements cee::vis::Model.
void cee::ug::UnstructGridModel::clearVisualization | ( | ) |
Clears visualization.
size_t cee::ug::UnstructGridModel::currentFrameIndex | ( | ) | const |
Returns the index of the current frame.
Returns UNDEFINED_SIZE_T if no frames are present.
int cee::ug::UnstructGridModel::currentStateId | ( | ) | const |
Returns the id of the current DataState (the data state in the current frame).
Returns -1 if no current data state.
const CuttingPlane * cee::ug::UnstructGridModel::cuttingPlane | ( | size_t | index | ) | const |
Returns the cutting plane at the given index.
CuttingPlane * cee::ug::UnstructGridModel::cuttingPlane | ( | size_t | index | ) |
Returns the cutting plane at the given index.
size_t cee::ug::UnstructGridModel::cuttingPlaneCount | ( | ) | const |
Returns number of of cutting planes.
const DataSource * cee::ug::UnstructGridModel::dataSource | ( | ) | const |
Returns the data source.
DataSource * cee::ug::UnstructGridModel::dataSource | ( | ) |
Returns the data source.
bool cee::ug::UnstructGridModel::displacementRange | ( | double * | min, |
double * | max | ||
) | const |
Queries the model for the min and max of the current displacement result.
The min/max returned is the minimum and maximum of the currently loaded time steps, and is not necessarily the global minimum and maximum.
Returns true if result values were found.
DisplacementSettings * cee::ug::UnstructGridModel::displacementSettings | ( | int | resultId | ) |
Returns the displacement settings for the displacement result with resultId.
Will create a settings object if no settings exists yet. This allows usage of this function before the visualization has been updated.
cee::Color3f cee::ug::UnstructGridModel::elementSetColor | ( | int | setId | ) | const |
Returns the element set color for the specified set id.
const DisplacementSettings * cee::ug::UnstructGridModel::existingDisplacementSettings | ( | int | resultId | ) | const |
Returns displacement settings for the result with resultId.
const PartSettings * cee::ug::UnstructGridModel::existingPartSettings | ( | size_t | globalGeometryIndex, |
int | partId | ||
) | const |
Returns the part settings for the part with partId.
const ScalarSettings * cee::ug::UnstructGridModel::existingScalarSettings | ( | int | resultId | ) | const |
Returns scalar settings for the scalar result with resultId.
const VectorSettings * cee::ug::UnstructGridModel::existingVectorSettings | ( | int | resultId | ) | const |
Returns vector settings for the vector result with resultId.
|
virtual |
Returns the bounding box of the model in the given frame.
size_t cee::ug::UnstructGridModel::frameCount | ( | ) | const |
Returns the number of frames currently available.
const Isosurface * cee::ug::UnstructGridModel::isosurface | ( | size_t | index | ) | const |
Returns the isosurface at the given index.
Isosurface * cee::ug::UnstructGridModel::isosurface | ( | size_t | index | ) |
Returns the isosurface at the given index.
size_t cee::ug::UnstructGridModel::isosurfaceCount | ( | ) | const |
Returns number of isosurfaces.
const Isovolume * cee::ug::UnstructGridModel::isovolume | ( | size_t | index | ) | const |
Returns the isovolume at the given index.
Isovolume * cee::ug::UnstructGridModel::isovolume | ( | size_t | index | ) |
Returns the isovolume at the given index.
size_t cee::ug::UnstructGridModel::isovolumeCount | ( | ) | const |
Returns number of isovolumes.
MirrorSettings & cee::ug::UnstructGridModel::mirrorSettings | ( | ) |
Returns the mirror settings for the model.
const MirrorSettings & cee::ug::UnstructGridModel::mirrorSettings | ( | ) | const |
Returns the mirror settings for the model.
|
virtual |
Returns info regarding the current model contents.
Reimplemented from cee::vis::Model.
const ModelSettings & cee::ug::UnstructGridModel::modelSettings | ( | ) | const |
Returns a reference to the model settings for this model.
ModelSettings & cee::ug::UnstructGridModel::modelSettings | ( | ) |
Returns a reference to the model settings for this model.
const ModelSpec & cee::ug::UnstructGridModel::modelSpec | ( | ) | const |
Gets the model specification.
ModelSpec & cee::ug::UnstructGridModel::modelSpec | ( | ) |
Gets the model specification.
|
virtual |
Returns the bounding box of the part in the given frame.
const ParticleTraceGroup * cee::ug::UnstructGridModel::particleTraceGroup | ( | size_t | index | ) | const |
Returns the particle trace group at the given index.
ParticleTraceGroup * cee::ug::UnstructGridModel::particleTraceGroup | ( | size_t | index | ) |
Returns the particle trace group at the given index.
size_t cee::ug::UnstructGridModel::particleTraceGroupCount | ( | ) | const |
Returns the number of particle trace groups in the model.
double cee::ug::UnstructGridModel::particleTraceTime | ( | ) | const |
Returns the current particle trace time.
Undefined double indicates the entire trace is shown
bool cee::ug::UnstructGridModel::particleTraceTimeRange | ( | size_t | frameIndex, |
double * | minimumTime, | ||
double * | maximumTime | ||
) | const |
Gets the time range (min to max) of the given frame.
A valid frame index must be specified. Returns true if range is valid.
PartSettings * cee::ug::UnstructGridModel::partSettings | ( | size_t | globalGeometryIndex, |
int | partId | ||
) |
Returns the part settings for the part with partId.
Will create a settings object if no settings exists yet. This allows usage of this function before the visualization has been updated.
bool cee::ug::UnstructGridModel::polygonIntersect | ( | const std::vector< Vec2f > & | polygonInWindowCoordinates, |
const vis::View & | view, | ||
bool | acceptPartiallyContainedItems, | ||
bool | includeElementIndices, | ||
std::vector< PartHitItems > * | itemList | ||
) | const |
Finds the parts (and optionally elements) that are (partially) inside the given polygon defined in window coordinates.
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.
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 partHitItemsList will contain all parts that are inside the given polygon. If acceptPartiallyContainedParts is set to true, parts will be considered inside if they are partially inside (at least one pixel of one item) the polygon. If false, the entire part needs to be completely inside the region.
If includeElementIndices is specified, each PartHitItems will also have a list of the elements that are (partially) within the given polygon. If only the parts are needed, it is faster to set this to false for the method to only consider the part and not each element.
Returns true if any parts was accepted (partHitItemsList.size() > 0)
bool cee::ug::UnstructGridModel::rayIntersect | ( | int | x, |
int | y, | ||
const vis::View & | view, | ||
HitItem * | hitItem | ||
) | const |
Does picking at the given screen coordinates, returning true if anything was hit.
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 hit item object describes where the ray created from the screen coordinates hit the model. See HitItem for a listing of available hit information.
Returns true if something was hit.
bool cee::ug::UnstructGridModel::rayIntersectAllHits | ( | int | x, |
int | y, | ||
const vis::View & | view, | ||
HitItemCollection * | hitItems | ||
) | const |
Does picking at the given screen coordinates, returning true if anything was hit and returning all overlapping items if any.
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 hit item objects describe where the ray created from the screen coordinates hit the model. See HitItem for a listing of available hit information.
Returns true if something was hit.
bool cee::ug::UnstructGridModel::rayIntersectAllHits | ( | const Ray & | ray, |
HitItemCollection * | hitItems | ||
) | const |
bool cee::ug::UnstructGridModel::regionIntersect | ( | int | x, |
int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
const vis::View & | view, | ||
bool | acceptPartiallyContainedItems, | ||
bool | includeElementIndices, | ||
std::vector< PartHitItems > * | partHitItemsList | ||
) | const |
Finds the parts (and optionally elements) that are (partially) inside the given region.
The partHitItemsList will contain all parts that are inside the given region. If acceptPartiallyContainedParts is set to true, parts will be considered inside if they are partially inside (at least one pixel of one item) the region. If false, the entire part needs to be completely inside the region.
If includeElementIndices is specified, each PartHitItems will also have a list of the elements that are (partially) within the given region. If only the parts are needed, it is faster to set this to false for the method to only consider the part and not each element.
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 is in pixels.
Returns true if any parts was accepted (partHitItemsList.size() > 0)
void cee::ug::UnstructGridModel::removeAllCuttingPlanes | ( | ) |
Removes all cutting planes from the model.
void cee::ug::UnstructGridModel::removeAllIsosurfaces | ( | ) |
Removes all isosurfaces from the model.
void cee::ug::UnstructGridModel::removeAllIsovolumes | ( | ) |
Removes all isovolumes from the model.
void cee::ug::UnstructGridModel::removeAllParticleTraceGroups | ( | ) |
Removes all particle trace groups from the model.
void cee::ug::UnstructGridModel::removeCuttingPlane | ( | const CuttingPlane * | cuttingplane | ) |
Removes the cutting plane cuttingplane from the model.
void cee::ug::UnstructGridModel::removeIsosurface | ( | const Isosurface * | isosurf | ) |
Removes the isosurface isosurf from the model.
void cee::ug::UnstructGridModel::removeIsovolume | ( | const Isovolume * | volume | ) |
Removes the isovolume volume from the model.
void cee::ug::UnstructGridModel::removeParticleTraceGroup | ( | const ParticleTraceGroup * | group | ) |
Removes the given particle trace group from the model.
bool cee::ug::UnstructGridModel::scalarRange | ( | int | resultId, |
double * | min, | ||
double * | max | ||
) | const |
Queries the model for the minimum and maximum of the specified scalar result.
The min/max returned is the minimum and maximum of the currently loaded time steps, and is not necessarily the global minimum and maximum.
Returns true if result values were found.
ScalarSettings * cee::ug::UnstructGridModel::scalarSettings | ( | int | resultId | ) |
Returns scalar settings for the scalar result with resultId.
Will create a settings object if no settings exists yet. This allows usage of this function before the visualization has been updated.
void cee::ug::UnstructGridModel::setCurrentFrameIndex | ( | size_t | frameIndex | ) |
Sets the current frame (the frame to render).
frameIndex must be [0 .. numFrames() - 1]
void cee::ug::UnstructGridModel::setDataSource | ( | DataSource * | dataSource | ) |
Sets the data source.
void cee::ug::UnstructGridModel::setElementSetColor | ( | int | setId, |
const Color3f & | color | ||
) |
Sets the /a color for the set given by /a setId.
void cee::ug::UnstructGridModel::setParticleTraceTime | ( | double | time | ) |
Sets the current particle trace time.
Set to undefined double for show entire trace.
|
virtual |
Prepares for a per-frame update of the visualization. Returns the number of frames to generate.
This is useful when setting up animations that will take some time, as the animation frames can be rendered as soon as they are finished, thus giving the user feedback and "hiding" a a lot of the setup time.
To do a per-frame animation setup, first configure the model spec as you would do with updateVisualization(). Then you call this method which prepares the per frame update and returns the number of frames to generate. Then you loop over all these frames and call the updateVisualizationForFrame() method.
Example:
Just to clarify, these two pieces of code gives the same result:
and
|
virtual |
Updates the visualization based on the current settings.
This method needs to be called whenever a change is made to the settings or data in the model.
To optimize the update, an UpdateAction can be provided to limit the update to a specific task. Note that calling updateVisualization(UnstructGridModel::NORMAL) will always work, and the other flags are just for optimization.
A normal use case for the UpdateAction is frequent operations that should be as fast as possible. E.g. the user hides or shows a part, a user selects an object (part, cutting plane, isosurface, isovolume) either with highlight (halo) (using the HIGHLIGHT UpdateAction) or with changing the color or opacity (using the COLOR_AND_OPACITY UpdateAction) action.
Another use case is for sliders on scalar ranges, where the update of the model can be very fast if only the SCALAR_SETTINGS UpdateAction is used.
If you do operations that involve multiple UpdateActions, just call updateVisualization(UnstructGridModel::NORMAL)
You should try to avoid unnecessary calls to updateVisualization() as it will take some time even if there are no changes. Try to structure the code and only call this once if you change several settings.
|
virtual |
Updates the visualization for the given frame.
See startUpdateVisualizationPerFrame() for more information on how to do per-frame update of the visualization.
bool cee::ug::UnstructGridModel::vectorRange | ( | int | resultId, |
double * | min, | ||
double * | max | ||
) | const |
Queries the model for the min and max of the specified vector result.
The min/max returned is the minimum and maximum of the currently loaded time steps, and is not necessarily the global minimum and maximum.
Returns true if result values were found.
VectorSettings * cee::ug::UnstructGridModel::vectorSettings | ( | int | resultId | ) |
Returns the vector settings for the vector result with resultId.
Will create a settings object if no settings exists yet. This allows usage of this function before the visualization has been updated.