GeometryModel is a subclass of Model that can handle a large number of parts efficiently. More...
Public Member Functions | |
GeometryModel () | |
Constructs an empty model. More... | |
virtual BoundingBox | boundingBox () |
Returns the bounding box of the model. More... | |
virtual Str | modelInfo () const |
Returns information about the model. More... | |
virtual void | update (bool forceRecreate) |
Updates the model, optimizing it's rendering. More... | |
const Mat4d & | transformation () const |
Returns the transformation matrix used for the whole model. More... | |
void | setTransformation (const Mat4d &transformMatrix) |
Transforms the entire model using the given transformation matrix. More... | |
size_t | partCount () const |
Returns the number of geometry parts. More... | |
size_t | partIndex (Part *part) const |
Gets part index. Returns UNDEFINED_SIZE_T if not present. More... | |
Part * | part (size_t index) |
Returns the geometry part at the given index. More... | |
const Part * | part (size_t index) const |
Returns the geometry part at the given index. More... | |
Part * | partById (int id) |
Returns the geometry part with the given id or NULL if not present. More... | |
const Part * | partById (int id) const |
Returns the geometry part with the given id or NULL if not present. More... | |
void | addPart (Part *part) |
Adds geometry part to model. More... | |
void | removePart (Part *part) |
Removes geometry part from model. More... | |
void | removeAllParts () |
Removes all geometry parts from model. More... | |
bool | hasPart (Part *part) const |
Returns true if the part is in the model. More... | |
bool | rayIntersect (int x, int y, const vis::View &view, HitItem *hitItem) |
Does picking at the given screen coordinates, returning true if anything was hit. More... | |
bool | regionIntersect (int x, int y, unsigned int width, unsigned int height, const vis::View &view, bool acceptPartiallyContainedParts, std::vector< Part * > *partList) |
Finds the parts that are (partially) inside the given region. More... | |
bool | regionIntersectPartItems (int x, int y, unsigned int width, unsigned int height, const vis::View &view, bool acceptPartiallyContainedItems, std::vector< PartHitItems > *hitItems) |
Finds the parts that are (partially) inside the given region. More... | |
bool | polygonIntersect (const std::vector< Vec2f > &polygonInWindowCoordinates, const vis::View &view, bool acceptPartiallyContainedParts, std::vector< Part * > *partList) |
Finds the parts that are (partially) inside the given region. More... | |
bool | rayIntersect (const Ray &ray, const vis::View &view, HitItem *hitItem) |
Does picking based on a ray in world coordinates, returning true if anything was hit. More... | |
size_t | renderedPartCount () const |
Returns the number of unique parts being rendered by the Visualization component for this 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... | |
GeometryModel is a subclass of Model that can handle a large number of parts efficiently.
This model is especially very well suited if the parts provided have equal/shared attributes/effects like color, line width and so on.
Each Part may be built up from either Points, Indexed Polylines, Indexed Triangles, Triangle Fans or Triangle Strips and with relevant Effects like color, textures, opacity/transparency, size/width, halo/silhouetted edges, lighting etc.
cee::geo::GeometryModel::GeometryModel | ( | ) |
Constructs an empty model.
void cee::geo::GeometryModel::addPart | ( | Part * | part | ) |
Adds geometry part to model.
Part must not already be present in the model
|
virtual |
Returns the bounding box of the model.
Implements cee::vis::Model.
bool cee::geo::GeometryModel::hasPart | ( | Part * | part | ) | const |
Returns true if the part is in the model.
|
virtual |
Returns information about the model.
Reimplemented from cee::vis::Model.
Part * cee::geo::GeometryModel::part | ( | size_t | index | ) |
Returns the geometry part at the given index.
const Part * cee::geo::GeometryModel::part | ( | size_t | index | ) | const |
Returns the geometry part at the given index.
Part * cee::geo::GeometryModel::partById | ( | int | id | ) |
Returns the geometry part with the given id or NULL if not present.
const Part * cee::geo::GeometryModel::partById | ( | int | id | ) | const |
Returns the geometry part with the given id or NULL if not present.
size_t cee::geo::GeometryModel::partCount | ( | ) | const |
Returns the number of geometry parts.
size_t cee::geo::GeometryModel::partIndex | ( | Part * | part | ) | const |
Gets part index. Returns UNDEFINED_SIZE_T if not present.
bool cee::geo::GeometryModel::polygonIntersect | ( | const std::vector< Vec2f > & | polygonInWindowCoordinates, |
const vis::View & | view, | ||
bool | acceptPartiallyContainedParts, | ||
std::vector< Part * > * | partList | ||
) |
Finds the parts that are (partially) inside the given region.
The partList 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.
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 (partList.size() > 0)
bool cee::geo::GeometryModel::rayIntersect | ( | int | x, |
int | y, | ||
const vis::View & | view, | ||
HitItem * | hitItem | ||
) |
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::geo::GeometryModel::rayIntersect | ( | const Ray & | ray, |
const vis::View & | view, | ||
HitItem * | hitItem | ||
) |
Does picking based on a ray in world coordinates, returning true if anything was hit.
The hit item object describes where the ray hit the model. See HitItem for a listing of available hit information.
Returns true if something was hit.
bool cee::geo::GeometryModel::regionIntersect | ( | int | x, |
int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
const vis::View & | view, | ||
bool | acceptPartiallyContainedParts, | ||
std::vector< Part * > * | partList | ||
) |
Finds the parts that are (partially) inside the given region.
The partList 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.
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. Both height and width must be > 0.
Returns true if any parts was accepted (partList.size() > 0)
bool cee::geo::GeometryModel::regionIntersectPartItems | ( | int | x, |
int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
const vis::View & | view, | ||
bool | acceptPartiallyContainedItems, | ||
std::vector< PartHitItems > * | hitItemArr | ||
) |
Finds the parts that are (partially) inside the given region.
The partList 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.
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. Both height and width must be > 0.
Returns true if any parts was accepted (hitItemArr->size() > 0)
void cee::geo::GeometryModel::removeAllParts | ( | ) |
Removes all geometry parts from model.
void cee::geo::GeometryModel::removePart | ( | Part * | part | ) |
Removes geometry part from model.
Part must already be present in the model
size_t cee::geo::GeometryModel::renderedPartCount | ( | ) | const |
Returns the number of unique parts being rendered by the Visualization component for this model.
Note: This is only used for reference and does not correspond to the number of parts in this model. The GeometryModel will try to minimized the number of rendered parts by combining parts with the same visual appearance. This is transparent for the user and cannot be controlled.
void cee::geo::GeometryModel::setTransformation | ( | const Mat4d & | transformMatrix | ) |
Transforms the entire model using the given transformation matrix.
This matrix is combined with any local transformation matrices for each part.
const cee::Mat4d & cee::geo::GeometryModel::transformation | ( | ) | const |
Returns the transformation matrix used for the whole model.
|
virtual |
Updates the model, optimizing it's rendering.