cee::geo::GeometryModel Class Reference

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 Mat4dtransformation () 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...
 
Partpart (size_t index)
 Returns the geometry part at the given index. More...
 
const Partpart (size_t index) const
 Returns the geometry part at the given index. More...
 
PartpartById (int id)
 Returns the geometry part with the given id or NULL if not present. More...
 
const PartpartById (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...
 
- Public Member Functions inherited from cee::vis::Model
 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...
 
- Public Member Functions inherited from cee::RefCountedObject
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

- Protected Types inherited from cee::vis::Model
enum  NotifyAction { NO_ACTION, MODEL_CHANGED }
 Notification sent to the view. More...
 
- Protected Member Functions inherited from cee::vis::Model
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...
 
Inheritance diagram for cee::geo::GeometryModel:
cee::vis::Model cee::RefCountedObject

Detailed Description

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.

See also
Part
PartSettings
Data
Effect

Constructor & Destructor Documentation

cee::geo::GeometryModel::GeometryModel ( )

Constructs an empty model.

Member Function Documentation

void cee::geo::GeometryModel::addPart ( Part part)

Adds geometry part to model.

Part must not already be present in the model

Note
A part can only be in one model at a time
cee::BoundingBox cee::geo::GeometryModel::boundingBox ( )
virtual

Returns the bounding box of the model.

Note
update() must have been called at least once, either manually or automatically, for this to return a valid bounding box.
See also
update()

Implements cee::vis::Model.

bool cee::geo::GeometryModel::hasPart ( Part part) const

Returns true if the part is in the model.

See also
partIndex
Str cee::geo::GeometryModel::modelInfo ( ) const
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.

Note
The index must be valid
const Part * cee::geo::GeometryModel::part ( size_t  index) const

Returns the geometry part at the given index.

Note
The index must be valid
Part * cee::geo::GeometryModel::partById ( int  id)

Returns the geometry part with the given id or NULL if not present.

Note
The part id's are set by the user and do not have to be unique. This function will return the first part it finds with the given id.
See also
cee::geo::Part::id()
cee::geo::Part::setId()
const Part * cee::geo::GeometryModel::partById ( int  id) const

Returns the geometry part with the given id or NULL if not present.

Note
The part id's are set by the user and do not have to be unique. This function will return the first part it finds with the given id.
See also
cee::geo::Part::id()
cee::geo::Part::setId()
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.

Warning
The index may be changed internally at any time.
Needs to update internal structures if parts have been added and/or removed.
See also
hasPart
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.

See also
Ray
cee::geo::HitItem
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.

See also
Ray
cee::geo::HitItem
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.

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.

Returns true if any parts was accepted (partList.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.

See also
setTransformation
void cee::geo::GeometryModel::update ( bool  forceRecreate)
virtual

Updates the model, optimizing it's rendering.

Note
This may take some time dependent how much data the part contains
This is mandatory and will be automatically run before rendering if not already done so