Package com.openinventor.inventor
Interface SoGeneralPath
-
public interface SoGeneralPath
Manage a full path or a regular path.see
SoPath
- Author:
- Jean-Michel Godinaud
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
append(int childIndex)
Adds node to end of chain.void
append(SoNode childNode)
Adds node to end of chain.void
append(SoPath fromPath)
Adds all nodes in fromPath's chain to end of chain.boolean
containsNode(SoNode node)
Returns true if the node is found anywhere in the path chain.boolean
containsNode(java.lang.Class type)
Returns true if the node type is found anywhere in the path chain.boolean
containsPath(SoPath path)
Returns true if the nodes in the given path argument are contained (in consecutive order) in this path.SoPath
copy(int startFromNodeIndex)
Creates and returns a new path that is a copy of some or all of this path.SoPath
copy(int startFromNodeIndex, int numNodes)
Creates and returns a new path that is a copy of some or all of this path.int
findFork(SoPath path)
If the two paths have different head nodes, this returns -1.SoNode
getHead()
Return the first node in a path chainint
getIndex(int i)
Return the index of the i'th node (within its parent) in the chain.int
getIndex(java.lang.Class type)
Returns the index in the chain of the first node the given type from the head of chain.int
getIndexFromTail(int i)
Return the index of the i'th node (within its parent) in the chain, counting backward from the tail node.int
getInstanceIndex(int i)
Returns the index of the instance inside the parent SoMultipleInstance, SoMultipleCopy or SoArray group.int
getInstanceIndexFromTail(int i)
Returns the index of the i'th node instance (within its parent, if it is a SoMultipleInstance, SoMultipleCopy or SoArray group in the chain, counting backward from the tail node.int
getLength()
Returns length of path chain (number of nodes).SoNode
getNode(int i)
Return the i'th node in the chain.SoNode
getNode(java.lang.Class type)
Returns the first node from the head of the given type in the chain.SoNode
getNodeFromTail(int i)
Return the i'th node in the chain, counting backward from the tail node.SoNode
getTail()
Return the last node in a path chainvoid
pop()
Pop the last node off.void
push(int childIndex)
Push a node at the end of the chain.void
setHead(SoNode node)
Sets head node (first node in chain).void
truncate(int start)
Truncates the path chain, removing all nodes from index start on.
-
-
-
Method Detail
-
setHead
void setHead(SoNode node)
Sets head node (first node in chain). The head node must be set before the append() or push() methods may be called.
-
append
void append(int childIndex)
Adds node to end of chain. The node is the childIndex'th child of the current tail node.
-
append
void append(SoNode childNode)
Adds node to end of chain. Uses the first occurrence of childNode as child of current tail node. If the path is empty, this is equivalent to setHead(childNode).
-
append
void append(SoPath fromPath)
Adds all nodes in fromPath's chain to end of chain. The head node of fromPath must be the same as or a child of the current tail node.
-
push
void push(int childIndex)
Push a node at the end of the chain. Allows a path to be treated as a stack.- See Also:
pop()
-
pop
void pop()
Pop the last node off. Allows a path to be treated as a stack.- See Also:
push(int)
-
getHead
SoNode getHead()
Return the first node in a path chain
-
getTail
SoNode getTail()
Return the last node in a path chain
-
getNode
SoNode getNode(int i)
Return the i'th node in the chain. Calling getNode(0) is equivalent to calling getHead().
-
getNode
SoNode getNode(java.lang.Class type) throws java.lang.IllegalArgumentException
Returns the first node from the head of the given type in the chain. null is returned if no node of the given type is found.- Parameters:
type
- must be any class inherited from SoNode- Throws:
java.lang.IllegalArgumentException
- when type is not a class inherited from SoNode- See Also:
getIndex(Class)
-
getIndex
int getIndex(java.lang.Class type) throws java.lang.IllegalArgumentException
Returns the index in the chain of the first node the given type from the head of chain. -1 is returned if no node of the given type is found.- Parameters:
type
- must be any class inherited from SoNode- Throws:
java.lang.IllegalArgumentException
- when type is not a class inherited from SoNode- See Also:
getIndex(Class)
-
getIndex
int getIndex(int i)
Return the index of the i'th node (within its parent) in the chain.
-
getNodeFromTail
SoNode getNodeFromTail(int i)
Return the i'th node in the chain, counting backward from the tail node. Calling getNodeFromTail(0) is equivalent to calling getTail().
-
getIndexFromTail
int getIndexFromTail(int i)
Return the index of the i'th node (within its parent) in the chain, counting backward from the tail node.
-
getLength
int getLength()
Returns length of path chain (number of nodes).
-
truncate
void truncate(int start)
Truncates the path chain, removing all nodes from index start on. Calling truncate(0) empties the path entirely.
-
containsNode
boolean containsNode(SoNode node)
Returns true if the node is found anywhere in the path chain.
-
containsNode
boolean containsNode(java.lang.Class type) throws java.lang.IllegalArgumentException
Returns true if the node type is found anywhere in the path chain.- Parameters:
type
- must be any class inherited from SoNode- Throws:
java.lang.IllegalArgumentException
-
containsPath
boolean containsPath(SoPath path)
Returns true if the nodes in the given path argument are contained (in consecutive order) in this path.
-
findFork
int findFork(SoPath path)
If the two paths have different head nodes, this returns -1. Otherwise, it returns the path chain index of the last node (starting at the head) that is the same for both paths.
-
copy
SoPath copy(int startFromNodeIndex)
Creates and returns a new path that is a copy of some or all of this path. Copying starts from the given index (0 is the head node) to the end.- Returns:
- null on error.
-
copy
SoPath copy(int startFromNodeIndex, int numNodes)
Creates and returns a new path that is a copy of some or all of this path. Copying starts at the given index (0 is the head node). A numNodes of 0 means copy all nodes from the starting index to the end.- Returns:
- null on error.
-
getInstanceIndex
int getInstanceIndex(int i)
Returns the index of the instance inside the parent SoMultipleInstance, SoMultipleCopy or SoArray group. The returned value is -1 for other parent nodes.
-
getInstanceIndexFromTail
int getInstanceIndexFromTail(int i)
Returns the index of the i'th node instance (within its parent, if it is a SoMultipleInstance, SoMultipleCopy or SoArray group in the chain, counting backward from the tail node. Passing 0 for i returns the instance index of the tail node.
-
-