Package com.aspose.threed
Class Node
- java.lang.Object
-
- com.aspose.threed.A3DObject
-
- com.aspose.threed.Node
-
public class Node extends A3DObject
Represents an element in the scene graph. A scene graph is a tree of Node objects. The tree management services are self contained in this class. Note the Aspose.3D SDK does not test the validity of the constructed scene graph. It is the responsibility of the caller to make sure that it does not generate cyclic graphs in a node hierarchy. Besides the tree management, this class defines all the properties required to describe the position of the object in the scene. This information include the basic Translation, Rotation and Scaling properties and the more advanced options for pivots, limits, and IK joints attributes such the stiffness and dampening. When it is first created, the Node object is "empty" (i.e: it is an object without any graphical representation that only contains the position information). In this state, it can be used to represent parents in the node tree structure but not much more. The normal use of this type of objects is to add them an entity that will specialize the node (see the "Entity"). The entity is an object in itself and is connected to the the Node. This also means that the same entity can be shared among multiple nodes. Camera, Light, Mesh, etc... are all entities and they all derived from the base class Entity.
-
-
Method Summary
Modifier and Type Method Description boolean
accept(NodeVisitor visitor)
Walks through all descendant nodes(including the current node) and call the visitor with the node.void
addChildNode(Node node)
Add a child node to this nodevoid
addEntity(Entity entity)
Add an entity to the node.Node
createChildNode()
Creates a child nodeNode
createChildNode(Entity entity)
Create a new child node with given entity attachedNode
createChildNode(java.lang.String nodeName)
Create a new child node with given node nameNode
createChildNode(java.lang.String nodeName, Entity entity)
Create a new child node with given node nameNode
findNode(java.lang.String name)
Deprecated.Use SelectSingleObject instead.AssetInfo
getAssetInfo()
Per-node asset infoBoundingBox
getBoundingBox()
Calculate the bounding box of the nodeNode
getChild(int index)
Gets the child node at specified index.Node
getChild(java.lang.String nodeName)
Gets the child node with the specified namejava.util.List<Node>
getChildNodes()
Gets the children nodes.java.util.List<Entity>
getEntities()
Gets all node entities.Entity
getEntity()
Gets the first entity attached to this node, if sets, will clear other entities.boolean
getExcluded()
Gets wheather to exclude this node and all child nodes/entities during exporting.GlobalTransform
getGlobalTransform()
Gets the global transform.Material
getMaterial()
Gets the first material associated with this node, if sets, will clear other materialsjava.util.List<Material>
getMaterials()
Gets the materials associated with this node.java.util.List<CustomObject>
getMetaDatas()
Gets the meta data defined in this node.Node
getParentNode()
Gets the parent node.Transform
getTransform()
Gets the local transform.boolean
getVisible()
Gets to show the nodejava.util.ArrayList<A3DObject>
selectObjects(java.lang.String path)
Select multiple objects under current node using XPath-like query syntax.A3DObject
selectSingleObject(java.lang.String path)
Select single object under current node using XPath-like query syntax.void
setAssetInfo(AssetInfo value)
Per-node asset infovoid
setEntity(Entity value)
Sets the first entity attached to this node, if sets, will clear other entities.void
setExcluded(boolean value)
Sets wheather to exclude this node and all child nodes/entities during exporting.void
setMaterial(Material value)
Sets the first material associated with this node, if sets, will clear other materialsvoid
setParentNode(Node value)
Sets the parent node.void
setVisible(boolean value)
Sets to show the nodejava.lang.String
toString()
Gets the string reprensentation of this node.-
Methods inherited from class com.aspose.threed.A3DObject
findProperty, getName, getProperty, removeProperty, removeProperty, setName, setProperty
-
-
-
-
Constructor Detail
-
Node
public Node()
Initializes a new instance of theNode
class.
-
Node
public Node(java.lang.String name, Entity entity)
Initializes a new instance of theNode
class.- Parameters:
name
- Name.entity
- Default entity.
-
Node
public Node(java.lang.String name)
Initializes a new instance of theNode
class.- Parameters:
name
- Name.
-
-
Method Detail
-
getAssetInfo
public AssetInfo getAssetInfo()
Per-node asset info
-
setAssetInfo
public void setAssetInfo(AssetInfo value)
Per-node asset info- Parameters:
value
- New value
-
getVisible
public boolean getVisible()
Gets to show the node
-
setVisible
public void setVisible(boolean value)
Sets to show the node- Parameters:
value
- New value
-
getChildNodes
public java.util.List<Node> getChildNodes()
Gets the children nodes.
-
createChildNode
public Node createChildNode()
Creates a child node- Returns:
- The new child node.
-
createChildNode
public Node createChildNode(java.lang.String nodeName)
Create a new child node with given node name- Parameters:
nodeName
- The new child node's name- Returns:
- The new child node.
-
createChildNode
public Node createChildNode(Entity entity)
Create a new child node with given entity attached- Parameters:
entity
- Default entity attached to the node- Returns:
- The new child node.
-
createChildNode
public Node createChildNode(java.lang.String nodeName, Entity entity)
Create a new child node with given node name- Parameters:
nodeName
- The new child node's nameentity
- Default entity attached to the node- Returns:
- The new child node.
-
getEntity
public Entity getEntity()
Gets the first entity attached to this node, if sets, will clear other entities.
-
setEntity
public void setEntity(Entity value)
Sets the first entity attached to this node, if sets, will clear other entities.- Parameters:
value
- New value
-
getExcluded
public boolean getExcluded()
Gets wheather to exclude this node and all child nodes/entities during exporting.
-
setExcluded
public void setExcluded(boolean value)
Sets wheather to exclude this node and all child nodes/entities during exporting.- Parameters:
value
- New value
-
getEntities
public java.util.List<Entity> getEntities()
Gets all node entities.
-
getMetaDatas
public java.util.List<CustomObject> getMetaDatas()
Gets the meta data defined in this node.
-
getMaterials
public java.util.List<Material> getMaterials()
Gets the materials associated with this node.
-
getMaterial
public Material getMaterial()
Gets the first material associated with this node, if sets, will clear other materials
-
setMaterial
public void setMaterial(Material value)
Sets the first material associated with this node, if sets, will clear other materials- Parameters:
value
- New value
-
getParentNode
public Node getParentNode()
Gets the parent node.
-
setParentNode
public void setParentNode(Node value)
Sets the parent node.- Parameters:
value
- New value
-
getTransform
public Transform getTransform()
Gets the local transform.
-
getGlobalTransform
public GlobalTransform getGlobalTransform()
Gets the global transform.
-
getChild
public Node getChild(int index)
Gets the child node at specified index.- Parameters:
index
- Index.- Returns:
- The child.
-
getChild
public Node getChild(java.lang.String nodeName)
Gets the child node with the specified name- Parameters:
nodeName
- The child name to find.- Returns:
- The child.
-
accept
public boolean accept(NodeVisitor visitor)
Walks through all descendant nodes(including the current node) and call the visitor with the node. Visitor can break the walkthrough by returning false- Parameters:
visitor
- Visitor callback to visit the node- Returns:
- true means visitor has broke the walk through.
-
toString
public java.lang.String toString()
Gets the string reprensentation of this node.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string representation of this node for debugging.
-
getBoundingBox
public BoundingBox getBoundingBox()
Calculate the bounding box of the node
-
addEntity
public void addEntity(Entity entity)
Add an entity to the node.- Parameters:
entity
- The entity to be attached to the node
-
addChildNode
public void addChildNode(Node node)
Add a child node to this node- Parameters:
node
- The child node to be attached
-
findNode
@Deprecated public Node findNode(java.lang.String name)
Deprecated.Use SelectSingleObject instead.Find child node by its name or return null if no matched node found- Parameters:
name
-
-
selectSingleObject
public A3DObject selectSingleObject(java.lang.String path) throws ParseException
Select single object under current node using XPath-like query syntax.- Parameters:
path
-- Throws:
ParseException
- ParseException will be thrown if the path contains malformed query.
-
selectObjects
public java.util.ArrayList<A3DObject> selectObjects(java.lang.String path) throws ParseException
Select multiple objects under current node using XPath-like query syntax.- Parameters:
path
-- Throws:
ParseException
- ParseException will be thrown if the path contains malformed query.
-
-