Represents a node in the visual scene graph. More...
Public Types | |
typedef cadex::internal::ModelPrs_SceneNodeImpl | ImplType |
Public Member Functions | |
ModelPrs_SceneNode () | |
Constructor. | |
ModelPrs_SceneNode (initialized) | |
Constructor. | |
ModelPrs_SceneNode | Parent () const |
Returns a parent of this. | |
bool | Detach () |
Detachs from parent and returns a result. | |
bool | AddChildNode (ModelPrs_SceneNode &theNode) |
Adds theNode to children. Returns false if the node already has a parent, otherwise returns true. | |
bool | RemoveChildNode (ModelPrs_SceneNode &theNode) |
Removes theNode from children. | |
void | RemoveChildrenNodes () |
Removes all children. | |
ModelPrs_Geometry | Geometry () const |
Returns a geometry attribute. | |
void | SetGeometry (const ModelPrs_Geometry &theGeometry) |
Sets geometry attribute or nullify it if ModelPrs_Geometry::IsNull() returns true for theGeometry. | |
ModelData_Appearance | Appearance () const |
Returns appearance. | |
void | SetAppearance (const ModelData_Appearance &theAppearance) |
ModelData_Transformation | Transformation () const |
Returns transformation. | |
void | SetTransformation (const ModelData_Transformation &theTransformation) |
ModelPrs_DisplayMode | DisplayMode () const |
Returns display mode. | |
void | SetDisplayMode (ModelPrs_DisplayMode theMode) |
Sets theMode as display mode. | |
ModelPrs_SelectionMode | SelectionMode () const |
Returns selection mode. | |
void | SetSelectionMode (ModelPrs_SelectionMode theMode) |
Sets theMode as selection mode. | |
ModelPrs_VisibilityMode | VisibilityMode () const |
Returns visibility mode. | |
void | SetVisibilityMode (ModelPrs_VisibilityMode theMode) |
Sets theMode as visibility mode. | |
std::shared_ptr< Data > | UserData () const |
Returns pointer to user data if exist or nullptr otherwise. | |
void | SetUserData (const std::shared_ptr< Data > &theUserData) |
Sets user data or nullify it if theUserData is nullptr. | |
void | Accept (ModelPrs_SceneNodeVisitor &theVisitor) const |
Accepts a visitor. | |
void | Invalidate () |
Marks scene node to update. | |
ModelPrs_SceneNode (ImplType *theImpl) | |
Constructor (reserved for internal use). | |
![]() | |
void | Nullify () |
Resets reference to implementation object. | |
bool | IsNull () const |
Returns true if the object is nullified. | |
operator bool () const | |
Casts the object to the bool type. | |
internal::Base_HandledObject * | Impl () const |
Return a handle to backend (reserved for internal use). | |
Additional Inherited Members | |
![]() | |
Base_PublicObject (const internal::Base_HandledObject *theObject) | |
Constructor (reserved for internal use). | |
template<typename T > | |
T * | GetOrCreateImpl () |
Reserved for internal use. | |
Represents a node in the visual scene graph.
Scene nodes constitute hierarchy of the logical objects on the 3D scene. A node has a single parent node and may have zero, one or multiple child nodes.
The scene node is not typed: ModelPrs_SceneNode may not have subclasses. Semantics is determined by the application.
Each node can carry various data items that define how the object or a sub-tree is displayed. These include:
Implementation has been optimized to allocate memory only for those data items that have been explicitly created (e.g. transformation matrix or a material). When data items are not explicitly defined then no extra memory footprint is incurred.
Scene nodes may not be shared among parents, sharing of heavy-weight data (e.g. geometry) is provided via shareable data attributes. For instance, two instances of the same part in an assembly will be mapped to two scene nodes referring to the same geometry and distinct transformations.
Refer Creating a scene graph and ModelPrs_SceneGraphFactory.
Traversal of the sub-tree starting with the given scene node can be done with the help of visitors. Each scene node accepts a visitor which must be a subclass of an abstract class ModelPrs_SceneNodeVisitor with overridden methods. If the redefined VisitEnter() method returns false then the respective subgraph will not be visited.
A scene node contains a shared pointer to its internal implementation, so simple copying an object will just copy a shared pointer. Therefore any modification of the copied object will propagate to original object.
cadex::ModelPrs_SceneNode::ModelPrs_SceneNode | ( | ) |
Constructor.
Creates a null object (see IsNull()).
cadex::ModelPrs_SceneNode::ModelPrs_SceneNode | ( | initialized | ) |
Constructor.
Creates an object with implementation (IsNull() is false).
bool cadex::ModelPrs_SceneNode::AddChildNode | ( | ModelPrs_SceneNode & | theNode | ) |
Adds theNode to children. Returns false if the node already has a parent, otherwise returns true.
bool cadex::ModelPrs_SceneNode::Detach | ( | ) |
Detachs from parent and returns a result.
Returns true if parent exists and false otherwise.
ModelPrs_DisplayMode cadex::ModelPrs_SceneNode::DisplayMode | ( | ) | const |
Returns display mode.
ModelPrs_DM_Undefined display mode means that it inherits from parent.
ModelPrs_Geometry cadex::ModelPrs_SceneNode::Geometry | ( | ) | const |
Returns a geometry attribute.
Will return an empty object (see ModelPrs_Geometry::IsNull()) if geometry is not exist.
ModelPrs_SceneNode cadex::ModelPrs_SceneNode::Parent | ( | ) | const |
Returns a parent of this.
Will return null object (see IsNull()) if parent is not exist.
bool cadex::ModelPrs_SceneNode::RemoveChildNode | ( | ModelPrs_SceneNode & | theNode | ) |
Removes theNode from children.
true
value invalidates the instance of ModelPrs_SceneNodeVisitor over scene node's children, making further behavior of these objects undefined. ModelPrs_SelectionMode cadex::ModelPrs_SceneNode::SelectionMode | ( | ) | const |
Returns selection mode.
ModelPrs_SM_Undefined selection mode means that it inherits from parent.
void cadex::ModelPrs_SceneNode::SetAppearance | ( | const ModelData_Appearance & | theAppearance | ) |
Sets theAppearance as appearance or nullify it if ModelData_Appearance::IsNull() for theAppearance return true.
void cadex::ModelPrs_SceneNode::SetTransformation | ( | const ModelData_Transformation & | theTransformation | ) |
Sets theTransformation as transformation or nullify it if ModelData_Transformation::IsIdentity() for theTransformation returns true;
ModelPrs_VisibilityMode cadex::ModelPrs_SceneNode::VisibilityMode | ( | ) | const |
Returns visibility mode.
ModelPrs_VM_Undefined visibility mode means that it inherits from parent.