This class is the base class to describe a node in the data graph. More...
Classes | |
class | All |
This node predicate returns true for all nodes. More... | |
class | GetClass |
This node getter returns the class name of the node. More... | |
class | GetDocument |
This node getter returns the document the node belongs to. More... | |
class | GetElement |
This node getter returns the SAMSON Element defining the node. More... | |
class | GetElementUUID |
This node getter returns the UUID of the SAMSON Element defining the node. More... | |
class | GetFlags |
This node getter returns the flags of the node. More... | |
class | GetHighlightingFlag |
This node getter returns the highlighting flag of the node. More... | |
class | GetNextNode |
This node getter returns the next node in the parent's children. More... | |
class | GetNodeIndex |
This node getter returns the index of the node. More... | |
class | GetParent |
This node getter returns the parent of the node. More... | |
class | GetPreviousNode |
This node getter returns the previous node in the parent's children. More... | |
class | GetProxy |
This node getter returns the pointer to the class proxy of the node. More... | |
class | GetRoot |
This node getter returns the root of the node. More... | |
class | GetSelectionFlag |
This node getter returns the selection flag of the node. More... | |
class | GetThis |
This node getter returns the pointer to the node. More... | |
class | GetType |
This node getter returns the type of the node. More... | |
class | GetVisibilityFlag |
This node getter returns the visibility flag of the node. More... | |
class | HasOneOf |
This node predicate returns true if the node is an ancestor of a node in a given node indexer. More... | |
class | IsCreated |
This node predicate returns true for created nodes. More... | |
class | IsDynamicalModel |
This node predicate is true when the node is a dynamical model. More... | |
class | IsErased |
This node predicate returns true for erased nodes. More... | |
class | IsHighlighted |
This node predicate returns true for highlighted nodes. More... | |
class | IsIn |
This node predicate returns true if the node descends from a given node or node indexer. More... | |
class | IsInteractionModel |
This node predicate is true when the node is an interaction model. More... | |
class | IsModel |
This node predicate is true when the node is a model, i.e. is a structural, visual, dynamical, interaction or property model. More... | |
class | IsOneOf |
This node predicate returns true for nodes in a given node indexer. More... | |
class | IsPropertyModel |
This node predicate is true when the node is a property model. More... | |
class | IsSelected |
This node predicate returns true for selected nodes. More... | |
class | IsSerializable |
This node predicate returns true for serializable nodes. More... | |
class | IsSimulator |
This node predicate is true when the node is a simulator. More... | |
class | IsStructuralModel |
This node predicate is true when the node is a structural model. More... | |
class | IsStructuralParticle |
This node predicate is true when the node is a structural particle (an atom or a pseudo-atom). More... | |
class | IsType |
This node predicate compares the node type with a given type. More... | |
class | IsVisible |
This node predicate returns true for visible nodes. More... | |
class | IsVisualModel |
This node predicate is true when the node is a visual model. More... | |
Serialization | |
virtual bool | isSerializable () const |
Returns true when the class is serializable. More... | |
virtual void | serialize (SBCSerializer *serializer, const SBNodeIndexer &nodeIndexer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber &classVersionNumber=SBVersionNumber(1, 0, 0)) const |
Serializes the node. More... | |
virtual void | unserialize (SBCSerializer *serializer, const SBNodeIndexer &nodeIndexer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber &classVersionNumber=SBVersionNumber(1, 0, 0)) |
Unserializes the node. More... | |
Topology | |
SBDDataGraphNode * | getParent () const |
Returns the parent of the node. More... | |
SBDDataGraphNode * | getThisNode () const |
Returns the pointer to this node. More... | |
SBDDataGraphNode * | getNextNode () const |
Returns the pointer to the next node in the children of the node's parent. More... | |
SBDDataGraphNode * | getPreviousNode () const |
Returns the pointer to the previous node in the children of the node's parent. More... | |
SBDDataGraphNode * | getNextNode (SBDDataGraphNode::Type nodeType) const |
Returns the pointer to the next node with type nodeType in the children of the node's parent. More... | |
SBDDataGraphNode * | getPreviousNode (SBDDataGraphNode::Type nodeType) const |
Returns the pointer to the previous node with type nodeType in the children of the node's parent. More... | |
SBDDocument * | getDocument () const |
Returns the document the node belongs to. More... | |
virtual bool | canAddChild (SBDDataGraphNode *node, SBDDataGraphNode *nextNode=0) const |
Returns whether this node can add node as a child. More... | |
virtual bool | canAddChildType (SBDDataGraphNode::Type nodeType) const |
Returns whether this node can add a node with type nodeType as a child. More... | |
virtual bool | addChild (SBDDataGraphNode *node, SBDDataGraphNode *nextNode=0) |
Adds a child to the node. More... | |
virtual bool | removeChild (SBDDataGraphNode *node) |
Removes a child from the node. More... | |
bool | hasOneOf (const SBNodeIndexer &nodeIndexer) const |
Returns true if and only if this node is one of the nodes of the nodeIndexer , or is the ancestor of one of them. More... | |
bool | isIn (SBDDataGraphNode *node) const |
Returns true if and only if this node is node , or descends from it. More... | |
bool | isIn (const SBNodeIndexer &nodeIndexer) const |
Returns true if and only if this node is one of the nodes of the nodeIndexer , or descends from one of them. More... | |
bool | isIn (SBPointerIndexer< SBDDataGraphNode > *nodePointerIndexer) const |
Returns true if and only if this node is one of the nodes of the nodePointerIndexer , or descends from one of them. More... | |
bool | isOneOf (const SBNodeIndexer &nodeIndexer) const |
Returns true if and only if this node is one of the nodes of the nodeIndexer . More... | |
bool | isOneOf (SBPointerIndexer< SBDDataGraphNode > *nodePointerIndexer) const |
Returns true if and only if this node is one of the nodes of the nodePointerIndexer . More... | |
SBDDataGraphNode * | getRoot () const |
Returns the root of the hierarchy the node belongs to. More... | |
virtual SBDDataGraphNode * | clone () |
Returns a copy of the node and its descendants. More... | |
Identity | |
unsigned int | getNodeIndex () const |
Returns the node index (unique in the whole data graph, but non-persistent) More... | |
virtual Type | getType () const |
Returns the type of the data graph node. More... | |
bool | isType (Type type) const |
Returns true when the type of the node corresponds to type . | |
bool | isModel () const |
Returns true when the node is a model. | |
bool | isStructuralModel () const |
Returns true when the node is a structural model. | |
bool | isVisualModel () const |
Returns true when the node is a visual model. | |
bool | isDynamicalModel () const |
Returns true when the node is a dynamical model. | |
bool | isInteractionModel () const |
Returns true when the node is a interaction model. | |
bool | isPropertyModel () const |
Returns true when the node is a property model. | |
bool | isSimulator () const |
Returns true when the node is a simulator. | |
bool | isStructuralParticle () const |
Returns true when the node is a structural particle (an atom or a pseudo-atom) | |
static SBDDataGraphNode * | getNode (unsigned int nodeIndex) |
Returns the unique node corresponding to the node index nodeIndex . More... | |
static std::string | getTypeString (Type type) |
Returns a string describing the type of the data graph node. More... | |
Lifecycle | |
bool | isCreated () const |
Returns true if and only if the node is created. More... | |
void | create () |
Creates the node. More... | |
bool | isErased () const |
Returns true if and only if the node is erased. More... | |
void | erase () |
Erases the node. More... | |
Flags | |
unsigned int | getFlags () const |
Returns the flags. More... | |
unsigned int | getInheritedFlags () const |
Returns the inherited flags. More... | |
Selection | |
bool | isSelected () const |
Returns whether the node is selected. More... | |
bool | getSelected () const |
Returns whether the node is visible. | |
bool | getSelectionFlag () const |
Returns the selection flag. More... | |
void | setSelectionFlag (bool flag) |
Sets the selection flag. More... | |
Visibility | |
bool | isVisible () const |
Returns whether the node is visible. More... | |
bool | getVisible () const |
Returns whether the node is visible. | |
bool | getVisibilityFlag () const |
Returns the visibility flag. More... | |
void | setVisibilityFlag (bool flag) |
Sets the visibility flag. More... | |
Highlighting | |
bool | isHighlighted () const |
Returns whether the node is highlighted. More... | |
bool | getHighlightingFlag () const |
Returns the highlighting flag. More... | |
void | setHighlightingFlag (bool flag) |
Sets the highlighting flag. More... | |
Messaging | |
void | connectBaseSignalToSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBBaseEvent *), SBCReferenceTarget *nextReferenceTarget=0, void(SBCReferenceTarget::*nextFunctionPointer)(SBBaseEvent *)=0) |
Connects the base signal to a slot. More... | |
bool | baseSignalIsConnectedToSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBBaseEvent *)) const |
Returns true when the base signal is connected to a slot. | |
void | disconnectBaseSignalFromSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBBaseEvent *)) |
Disconnects the base signal from a slot. | |
Selection functions | |
virtual void | getNodes (SBNodeIndexer &nodeIndexer, const SBNodePredicate &selectionPredicate=SBDDataGraphNode::All(), const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false) |
Collects nodes into nodeIndexer , based on a selectionPredicate and a visitPredicate , with our without dependencies. More... | |
unsigned int | countNodes (const SBNodePredicate &selectionPredicate=SBDDataGraphNode::All(), const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false) |
Collects nodes into nodeIndexer , based on a selectionPredicate and a visitPredicate , with our without dependencies. More... | |
Visitor functions | |
virtual void | forEachNodeDepthFirst (void(*action)(SBDDataGraphNode *node)) |
Performs an action on each node. | |
virtual void | forEachNodeDepthFirst (SBCClass *object, void(SBCClass::*action)(SBDDataGraphNode *node)) |
Performs an action on each node. | |
static void | forEachNodeInSelection (SBNodeIndexer &nodeIndexer, void(*action)(SBDDataGraphNode *node)) |
Performs an action for each node in a selection. | |
static void | forEachNodeInSelection (SBNodeIndexer &nodeIndexer, SBCClass *object, void(SBCClass::*action)(SBDDataGraphNode *node)) |
Performs an action for each node in a selection. | |
Rendering | |
bool | addMaterial (SBDDataGraphNodeMaterial *material) |
Adds a material. More... | |
bool | removeMaterial () |
Removes the material. More... | |
SBDDataGraphNodeMaterial * | getMaterial () const |
Returns the material. More... | |
SBDDataGraphNode * | getMaterialOwner () const |
Returns the node whose material is inherited. More... | |
Debugging | |
virtual void | print (unsigned int offset=0) const |
Prints some debugging information. | |
Constructors and destructors | |
SBDDataGraphNode () | |
Builds a data graph node. More... | |
SBDDataGraphNode (SBDDataGraphNodeData *dataPointer) | |
Builds a data graph node. | |
virtual | ~SBDDataGraphNode () |
Destroys the node. More... | |
Additional Inherited Members | |
Public Member Functions inherited from SBCReferenceTarget | |
SBCReferenceTarget () | |
virtual | ~SBCReferenceTarget () |
unsigned int | getMemoryFootprint () const |
void | printReferencesToOwners () const |
The data graph contains everything directly or indirectly added by the user through SAMSON's user interface, plugins, etc. A data graph node has basic pre-defined data and functionalities to manage the data (models, apps, etc.).
All nodes in SAMSON's data graph, e.g. atoms (SBAtom), bonds (SBBond), etc., derive from SBDDataGraphNode. The figure below shows the document view, which is a view of SAMSON's data graph structure.
Short name: SBNode
SAMSON's data graph is a directed graph, where each node has one and only one parent (with the exception of documents, which have no parent), and possibly some children. The parent of a node can never be directly set, but can be retrieved using the getParent function. Children are managed using the addChild and removeChild functions.
In SAMSON, a data graph node may go through four lifecycle stages:
new
operator)As reference targets, data graph nodes should not be destructed using the delete
operator, because objects that are referencing them need to stop doing so before the node is deleted. Thus, when a node needs to be deleted (in the C++ sense), a SAMSON pointer must be used:
Each node in the data graph has a type, which may be retrieved using the getType function. For example, the type returned by the SBAtom class, which derives from the SBDDataGraphNode class, is SBNode::Atom, while the type returned by the SBStructuralModel class is SBNode::StructuralModel. The getTypeString function is a convenience function that may be used to obtain a type as a string.
Types may be used, for example, to rapidly search the data graph:
Each data graph node also has a unique index, that is managed internally by SAMSON. All indices are contiguous unsigned integers between 0
and n-1
, where n
is the number of data graph nodes. As a result, the node index is not permanent: when node i
is deleted (and i
is different from n-1
), then node n-1
becomes node i
. Node indices are used for example when picking objects in a viewport, by writing integers into the framebuffer instead of colors. The unique node index can be retrieved using getNodeIndex.
Each data graph node has four flags:
These flags are accessed through functions of SBDDataGraphNode and, except for the highlighting flag which has temporary purposes, changing these flags' values is undoable.
The getFlags function returns an unsigned int
that combines the highlighting and selection flags, as well as the mobility flag of particles (atoms and pseudo-atoms).
Each data graph node may have a material, which may affect its rendering in the viewport. A material may be applied to a node with the addMaterial function. When a material is added to a node, it affects the node itself and all its descendants (unless they have a material themselves, which then has priority). Precisely, the getMaterial function returns the material directly applied to the node (if the addMaterial function was called), or determines the deepest ancestor that has a material applied (by examining the node's parent, then its parent's parent, etc.). If no material is found, the getMaterial function returns 0.
Each material has a color scheme which may be modified and used to associate a color to a node or a spatial position.
The SBDDataGraphNode class defines a series of node predicates, i.e. functors that may be used to e.g. collect nodes in the data graph. For example, the SBNode::IsType predicate may be used to collect nodes by type:
and the SBNode::IsSelected predicate may be used to collect all nodes that are selected (directly, because their selection flag is true, or because one of their ancestors is selected):
Predicates may be combined through logical operations. For example, collecting selected atoms may be achieved with:
Please refer to Functors for more information.
The SBDDataGraphNode class also defines a series of node getters, i.e. functors that may be used to collect nodes in the data graph. For example, the SBNode::GetType getter may be used to retrieve the type of a node instead of through the getType function:
Node getters may be used to construct node predicates through comparison operators, so that collecting all atoms may also be achieved with:
since the statement SBNode::GetType() == SBNode::Atom
constructs a node predicate that is passed to the getNodes function.
In general, node getters have the same name as the corresponding getter function, but the first letter of their name is capitalized, since they are classes. For example, just like the SBNode::GetType getter corresponds to the SBNode::getType function, the SBAtom::GetTemperatureFactor getter corresponds to the SBAtom::getTemperatureFactor function.
Node predicates and node getters may be used to collect nodes from potentially complex rules:
Node predicates and node getters constitute the foundation of SAMSON's Node Specification Language.
Data graph nodes support serialization through the serialize and unserialize functions. Serialization is used in SAMSON to e.g. copy, paste, save, load, etc. data graph nodes. Please refer to Serialization in SAMSON for more information.
|
protected |
This (protected) constructor is indirectly called when constructing instances of derived classes, and assigns a unique index to the new node. By default, the created flag, the selection flag and the highlighting flag are set to false
, whereas the visibility flag is set to true
.
|
protectedvirtual |
This (protected) destructor is indirectly called when deleting instances of derived classes. The destructor releases the node's unique index. When this destructor completes, the SBBaseEvent::NodeDeleted event is emitted.
|
virtual |
node | A pointer to the child that should be added |
nextNode | A pointer to the node before which the child should be added |
This functions adds node
as a child of this node, immediately before node nextNode
. By default, nextNode
is 0 and the child is added at the end of the list of this node's children. This function is reimplemented in derived classes. When developing new data graph nodes types, with custom children management, this convention should be respected if it makes sense for the custom node, and the reimplemented function should be undoable. The function returns true if the child was added successfully.
This function is undoable
Reimplemented in SBDDocumentFolder.
bool SBDDataGraphNode::addMaterial | ( | SBDDataGraphNodeMaterial * | material | ) |
This functions adds a material to the node. A node may have at most one material, and a material may be applied to at most one node. The function returns true when the material is successfully added.
Please see Materials for more information
This function is undoable
|
virtual |
node | A pointer to a potential child |
nextNode | A pointer to the node before which the child should be added |
This functions returns a boolean that indicates whether node
can be added as a child of this node, immediately before node nextNode
.
|
virtual |
nodeType | A node type |
This functions returns a boolean that indicates whether a node with type nodeType
can be added as a child of this node.
Reimplemented in SBMStructuralModelNodeResidue, SBDDocumentFolder, SBMStructuralModel, SBDController, SBMStructuralModelNodeBackbone, SBMStructuralModelNodeGroup, SBMStructuralModelNodeSideChain, SBMStructuralModelNodeRoot, SBMStructuralModelNodeSegment, SBMStructuralModelNodeChain, SBMStructuralModelNodeMolecule, and SBMDynamicalModelNodeGroup.
|
virtual |
This function returns a copy of the node and its descendants. In case the copy cannot be performed (for example if some nodes in the hierarchy have not been exposed through SAMSON's introspection mechanism), the function returns 0. Note that the highlighting flag, the selection flag, and the the created flag are not cloned. As a result, a clone must be created before insertion in the document:
Finally, note that cloning assumes that the serialize and unserialize functions have been implemented for each clone node.
Reimplemented in SBMStructuralModelNodeResidue, SBMStructuralModelNodeBond, SBDDocumentFolder, SBMStructuralModel, SBMStructuralModelNodeAtom, SBMStructuralModelPath, SBDController, SBMStructuralModelNodeBackbone, SBDDocument, SBMStructuralModelNodeGroup, SBMDynamicalModelNode, SBSSimulator, SBMStructuralModelConformation, SBDDocumentLabel, SBMStructuralModelNode, SBDDataGraphNodeGroup, SBMStructuralModelNodeSideChain, SBSStateUpdater, SBDDocumentCamera, SBMStructuralModelNodeSegment, SBMModel, SBDControllerNode, SBMStructuralModelNodeChain, SBMStructuralModelNodeMolecule, SBMStructuralModelNodeRoot, SBMDynamicalModelNodeGroup, SBMDynamicalModel, SBSStateUpdaterParticleSystem, SBMModelNode, SBSSimulatorParticleSystem, and SBMDynamicalModelNodeRoot.
void SBDDataGraphNode::connectBaseSignalToSlot | ( | SBCReferenceTarget * | referenceTarget, |
void(SBCReferenceTarget::*)(SBBaseEvent *) | functionPointer, | ||
SBCReferenceTarget * | nextReferenceTarget = 0 , |
||
void(SBCReferenceTarget::*)(SBBaseEvent *) | nextFunctionPointer = 0 |
||
) |
referenceTarget | A pointer to the reference target that will receives the signal |
functionPointer | A pointer to the reference target's member function that will be called when the node's base signal is emitted |
nextReferenceTarget | A pointer to the next reference target; null by default |
nextFunctionPointer | A pointer to the next reference target's member function; null by default |
This function connects the node's base signal to a slot.
Please refer to Signals and slots for more information.
This function is undoable
unsigned int SBDDataGraphNode::countNodes | ( | const SBNodePredicate & | selectionPredicate = SBDDataGraphNode::All() , |
const SBNodePredicate & | visitPredicate = SBDDataGraphNode::All() , |
||
bool | includeDependencies = false |
||
) |
This function traverses the sub-tree for which visitPredicate
is true (depth-first), and counts the nodes for which the selectionPredicate
is true. Precisely, if the visitPredicate
returns false, a node is not visited, and neither are its descendants. if the visitPredicate
returns true, the node is visited, and the visitPredicate
will be used to decide whether its children are visited or not.
When includeDependencies
is true, the function also counts nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the selectionPredicate
and visitPredicate
, they are counted if includeDependencies
is true.
Among the node types defined in the SAMSON SDK, four have dependencies that are not children:
Some SAMSON Elements may define nodes that have non-child dependencies. For example, a visual model that references atoms should reimplement the getNodes function to add these dependencies to the nodeIndexer:
This function is a convenience function that internally calls getNodes.
void SBDDataGraphNode::create | ( | ) |
This function creates the node and all its descendants, i.e. sets their created flag to true
. Nodes which were not already created send the event SBEvent::NodeCreated. The created flag indicates whether the node is created or not, from SAMSON's point of view (as opposed to C++ object creation and destruction).
For more information, please refer to section Node lifecycle.
This function is undoable
void SBDDataGraphNode::erase | ( | ) |
This function erases the node and all its descendants. To perform custom erase operations (for example, a bond being erased will remove itself from its parent and disconnect from the base signal of its left and right atom), derived class may reimplement onErase, which is a private virtual function of SBDDataGraphNode. Because the objects that are connected to this node's base signal might want to perform some tasks before the node is erased, nodes being erased send three events: SBBaseEvent::NodeEraseBegin immediately before erasing begins, SBBaseEvent::NodeEraseEnd after erasing is complete, and finally SBBaseEvent::NodeErased. Precisely, the erase function sends the SBBaseEvent::NodeEraseBegin event, sets the selection flag of the node to false
, calls the virtual onErase function, removes the node from its parent, then sends the SBBaseEvent::NodeEraseEnd and the SBBaseEvent::NodeErased events. In the case of a bond, for example, the operations mentioned above are thus performed between the SBBaseEvent::NodeEraseBegin and SBBaseEvent::NodeEraseEnd events.
For more information, please refer to section Node lifecycle.
SBDDocument * SBDDataGraphNode::getDocument | ( | ) | const |
This function returns a pointer to the document the node belongs to. It goes up the ascendants of the node, and attempts to find a document node. If it doesn't find one, it returns 0.
unsigned int SBDDataGraphNode::getFlags | ( | ) | const |
This function returns an unsigned int that contains the flags of the node:
bool SBDDataGraphNode::getHighlightingFlag | ( | ) | const |
This function returns the highlighting flag of the node. Setting this flag to true instructs the renderer to highlight the node in the viewport.
unsigned int SBDDataGraphNode::getInheritedFlags | ( | ) | const |
This function returns an unsigned int that contains the inherited flags of the node:
SBDDataGraphNodeMaterial * SBDDataGraphNode::getMaterial | ( | ) | const |
This function returns the material associated to this node, if a material was added to the node itself or to one of its ancestors (in which case it returns the deepest ancestor with a material applied).
SBDDataGraphNode * SBDDataGraphNode::getMaterialOwner | ( | ) | const |
This function returns the node which owns the material associated to this node, i.e. the deepest ancestor with a material applied. The function returns 0 if no (direct or inherited) material is applied.
SBDDataGraphNode * SBDDataGraphNode::getNextNode | ( | ) | const |
This function returns a pointer to the next node in the children of the node's parent.
SBDDataGraphNode * SBDDataGraphNode::getNextNode | ( | SBDDataGraphNode::Type | nodeType | ) | const |
This function returns a pointer to the next node with type nodeType
in the children of the node's parent.
|
static |
This function returns the unique node of the data graph node corresponding to the nodeIndex
.
unsigned int SBDDataGraphNode::getNodeIndex | ( | ) | const |
This function returns the unique index of the data graph node. At any time, each data graph node has a unique index, that is managed internally by SAMSON. All indices are contiguous unsigned integers between 0
and n-1
, where n
is the number of data graph nodes. As a result, the node index is not permanent: when node i
is deleted (and i
is different from n-1
), then node n-1
becomes node i
. Node indices are used for example when picking objects in a viewport, by writing integers into the framebuffer instead of colors.
|
virtual |
This function traverses the sub-tree for which visitPredicate
is true (depth-first), and stores in nodeIndexer
the nodes for which the selectionPredicate
is true. Precisely, if the visitPredicate
returns false, a node is not visited, and neither are its descendants. if the visitPredicate
returns true, the node is visited, and the visitPredicate
will be used to decide whether its children are visited or not.
When includeDependencies
is true, the function also adds to nodeIndexer
nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the selectionPredicate
and visitPredicate
, they are added to the nodeIndexer
if includeDependencies
is true.
Among the node types defined in the SAMSON SDK, four have dependencies that are not children:
Some SAMSON Elements may define nodes that have non-child dependencies. For example, a visual model that references atoms should reimplement the getNodes function to add these dependencies to the nodeIndexer:
Note that the nodeIndexer
is not cleared when entering this function.
Reimplemented in SBMStructuralModel, SBDDocumentFolder, SBDController, SBMStructuralModelNodeBond, SBMStructuralModelNodeGroup, SBMDynamicalModel, SBMStructuralModelNode, SBMStructuralModelPath, SBMDynamicalModelNode, SBDDataGraphNodeGroup, SBSSimulatorParticleSystem, SBMStructuralModelConformation, and SBDControllerNode.
SBDDataGraphNode * SBDDataGraphNode::getParent | ( | ) | const |
The data graph node has a hierarchical structure, in which each node has zero or one parent.
SBDDataGraphNode * SBDDataGraphNode::getPreviousNode | ( | ) | const |
This function returns a pointer to the previous node in the children of the node's parent.
SBDDataGraphNode * SBDDataGraphNode::getPreviousNode | ( | SBDDataGraphNode::Type | nodeType | ) | const |
This function returns a pointer to the previous node with type nodeType
in the children of the node's parent.
SBDDataGraphNode * SBDDataGraphNode::getRoot | ( | ) | const |
This function returns the root of the hierarchy the node belongs to. In general, this returns a pointer to the document that contains the node. However, if the node is not yet inserted in a document, this may return a node with a different type. In case the node has not been added as a child to another node, this function returns a pointer to the node itself.
bool SBDDataGraphNode::getSelectionFlag | ( | ) | const |
This function returns the selection flag of the data graph node. The selection flag is true if and only if the node is currently selected. Please refer to SBDDocument for more information about the way selection works in SAMSON.
SBDDataGraphNode * SBDDataGraphNode::getThisNode | ( | ) | const |
This function returns a pointer to this node. This is mostly useful for inspectors, in order to make it easy for users to select the inspected node.
|
virtual |
Each node in the data graph has a type, which can be used, for example, to rapidly search the data graph:
Reimplemented in SBMStructuralModelNodeResidue, SBDDocumentFolder, SBMStructuralModelNodeBond, SBMStructuralModel, SBMStructuralModelNodeAtom, SBMStructuralModelPath, SBDController, SBMStructuralModelNodeBackbone, SBDDocument, SBMStructuralModelNodeGroup, SBMDynamicalModelNode, SBSSimulator, SBMStructuralModelConformation, SBDDocumentLabel, SBMStructuralModelNode, SBDDataGraphNodeGroup, SBMStructuralModelNodeSideChain, SBSStateUpdater, SBDDocumentCamera, SBMStructuralModelNodeRoot, SBMStructuralModelNodeSegment, SBMModel, SBDControllerNode, SBMStructuralModelNodeChain, SBMStructuralModelNodeMolecule, SBMVisualModel, SBMDynamicalModelNodeGroup, SBMInteractionModel, SBMDynamicalModel, SBMStructuralModelNodeParticle, SBMStructuralModelNodePseudoAtom, SBSStateUpdaterParticleSystem, SBMModelNode, SBSSimulatorParticleSystem, SBMDynamicalModelRigidBodySystem, SBMDynamicalModelParticleSystem, SBMDynamicalModelNodeRoot, SBMInteractionModelParticleSystem, SBMInteractionModelArticulatedBodySystem, SBMInteractionModelRigidBodySystem, SBMPropertyModel, SBMDynamicalModelArticulatedBodySystem, SBMPropertyModelBaseFunction, SBMDynamicalModelNodeArticulatedBody, SBMDynamicalModelNodeParticle, and SBMDynamicalModelNodeRigidBody.
|
static |
This function is a convenience function used to produce a string corresponding to a given type
.
bool SBDDataGraphNode::getVisibilityFlag | ( | ) | const |
This function returns the visibility flag of the node. The visibility flag is true if and only if the node is visible in viewports. In other words, setting this flag to false instructs the renderer to not display the node (in case it has a visual representation).
bool SBDDataGraphNode::hasOneOf | ( | const SBNodeIndexer & | nodeIndexer | ) | const |
This function returns true if and only if this node is one of the nodes of the nodeIndexer
, or is the ancestor of one of them
bool SBDDataGraphNode::isCreated | ( | ) | const |
For more information, please refer to section Node lifecycle.
bool SBDDataGraphNode::isErased | ( | ) | const |
This function returns true when the node is erased (i.e. when the node is not created). For more information, please refer to section Node lifecycle.
bool SBDDataGraphNode::isHighlighted | ( | ) | const |
This function returns whether the node is highlighted directly (because its highlighting flag is true) or indirectly (because the highlighting flag of one of its ancestors is true).
bool SBDDataGraphNode::isIn | ( | SBDDataGraphNode * | node | ) | const |
This function returns true if and only if this node is node
, or descends from it. If node
contains groups, then the function returns true if this node belongs to them.
bool SBDDataGraphNode::isIn | ( | const SBNodeIndexer & | nodeIndexer | ) | const |
This function returns true if and only if this node is one of the nodes of the nodeIndexer
, or descends from one of them. If a node of the nodeIndexer
contains groups, then the function returns true if this node belongs to them.
bool SBDDataGraphNode::isIn | ( | SBPointerIndexer< SBDDataGraphNode > * | nodePointerIndexer | ) | const |
This function returns true if and only if this node is one of the nodes of the nodePointerIndexer
, or descends from one of them. If a node of the nodePointerIndexer
contains groups, then the function returns true if this node belongs to them.
bool SBDDataGraphNode::isOneOf | ( | const SBNodeIndexer & | nodeIndexer | ) | const |
This function returns true if and only if this node is one of the nodes of the nodeIndexer
bool SBDDataGraphNode::isOneOf | ( | SBPointerIndexer< SBDDataGraphNode > * | nodePointerIndexer | ) | const |
This function returns true if and only if this node is one of the nodes of the nodePointerIndexer
bool SBDDataGraphNode::isSelected | ( | ) | const |
This function returns whether the node is selected directly (because its selection flag is true) or indirectly (because the selection flag of one of its ancestors is true). Please refer to SBDDocument for more information about the way selection works in SAMSON.
|
virtual |
This function returns true when the node is serializable. By default, custom nodes are not serializable (i.e. the function returns false
). If the node should be serializable (for example to make it possible to copy and paste the node, and save and load it), this function should be overloaded to return true
.
Reimplemented in SBDDocumentFolder, SBMStructuralModelPath, SBMStructuralModelNodeAtom, SBDDocument, SBMStructuralModelConformation, SBDController, SBMStructuralModelNodeResidue, SBSSimulator, SBDDataGraphNodeGroup, SBMStructuralModelNodeBond, SBSStateUpdater, SBDDocumentLabel, SBMDynamicalModelNode, SBMStructuralModelNodeBackbone, SBMVisualModel, SBMInteractionModel, SBMStructuralModel, SBMStructuralModelNodeGroup, SBMStructuralModelNodeSideChain, SBDDocumentCamera, SBMStructuralModelNodeParticle, SBMStructuralModelNode, SBDControllerNode, SBMStructuralModelNodePseudoAtom, SBMStructuralModelNodeRoot, SBMStructuralModelNodeSegment, SBMModel, SBMStructuralModelNodeChain, SBMStructuralModelNodeMolecule, SBMPropertyModel, SBMDynamicalModel, and SBMModelNode.
bool SBDDataGraphNode::isVisible | ( | ) | const |
This function returns whether the node is visible, which happens when the node and all its ancestors have their visibility flag set to true.
|
virtual |
node | A pointer to the child that should be removed |
This functions removes node
from the children of this node. This function is reimplemented in derived classes. When developing new data graph nodes types, with custom children management, the reimplemented function should be undoable. The function returns true if the child was removed successfully.
This function is undoable
Reimplemented in SBDDocumentFolder.
bool SBDDataGraphNode::removeMaterial | ( | ) |
This functions removes a material from the node. Please see Materials for more information
This function is undoable
|
virtual |
serializer | A pointer to a serializer |
nodeIndexer | A node indexer used to retrieve indices associated to nodes |
sdkVersionNumber | A version number of the SDK |
classVersionNumber | A version number of the class |
This function serializes the node. Please refer to the page about serialization for more information.
Reimplemented in SBDDocumentFolder, SBMStructuralModelPath, SBMStructuralModelNodeAtom, SBDDocument, SBMStructuralModelConformation, SBDController, SBMStructuralModelNodeResidue, SBSSimulator, SBDDataGraphNodeGroup, SBMStructuralModelNodeBond, SBSStateUpdater, SBDDocumentLabel, SBMDynamicalModelNode, SBMStructuralModelNodeBackbone, SBMVisualModel, SBMInteractionModel, SBMStructuralModel, SBMStructuralModelNodeGroup, SBMStructuralModelNodeSideChain, SBDDocumentCamera, SBMStructuralModelNodeParticle, SBMStructuralModelNode, SBDControllerNode, SBMStructuralModelNodePseudoAtom, SBMStructuralModelNodeRoot, SBMStructuralModelNodeSegment, SBMModel, SBMStructuralModelNodeChain, SBMStructuralModelNodeMolecule, SBMPropertyModel, SBMDynamicalModel, and SBMModelNode.
void SBDDataGraphNode::setHighlightingFlag | ( | bool | flag | ) |
This function sets the highlighting flag of the node. Setting this flag to true instructs the renderer to highlight the node in the viewport.
This function is undoable
void SBDDataGraphNode::setSelectionFlag | ( | bool | flag | ) |
This function sets the selection flag of the data graph node. The selection flag is true if and only if the node is currently selected. Please refer to SBDDocument for more information about the way selection works in SAMSON.
This function is undoable
void SBDDataGraphNode::setVisibilityFlag | ( | bool | flag | ) |
This function sets the visibility flag of the node.
This function is undoable
|
virtual |
serializer | A pointer to a serializer |
nodeIndexer | A node indexer used to retrieve indices associated to nodes |
sdkVersionNumber | A version number of the SDK |
classVersionNumber | A version number of the class |
This function unserializes the node. Please refer to the page about serialization for more information.
Reimplemented in SBDDocumentFolder, SBMStructuralModelPath, SBMStructuralModelNodeAtom, SBDDocument, SBMStructuralModelConformation, SBDController, SBMStructuralModelNodeResidue, SBSSimulator, SBDDataGraphNodeGroup, SBMStructuralModelNodeBond, SBSStateUpdater, SBDDocumentLabel, SBMDynamicalModelNode, SBMStructuralModelNodeBackbone, SBMVisualModel, SBMInteractionModel, SBMStructuralModel, SBMStructuralModelNodeGroup, SBMStructuralModelNodeSideChain, SBDDocumentCamera, SBMStructuralModelNodeParticle, SBMStructuralModelNode, SBDControllerNode, SBMStructuralModelNodePseudoAtom, SBMStructuralModelNodeRoot, SBMStructuralModelNodeSegment, SBMModel, SBMStructuralModelNodeChain, SBMStructuralModelNodeMolecule, SBMPropertyModel, SBMDynamicalModel, and SBMModelNode.