|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultSceneNode
cz.cuni.jagrlib.CSGCommonNode
public abstract class CSGCommonNode
Common code for CSG nodes. Contains support for scene hierarchy and attribute machinery.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
attr
Attribute dictionary (hashing table of [key,value] pairs). |
protected int |
order
Order in the parent node. |
protected SceneNode |
parent
Handle of node's parent (or null for root-node). |
protected boolean |
root
Root-property. |
Fields inherited from class cz.cuni.jagrlib.DefaultSceneNode |
---|
serial |
Fields inherited from interface cz.cuni.jagrlib.SceneNode |
---|
ATTR_BSSRDF, ATTR_COLOR, ATTR_TEXTURE |
Constructor Summary | |
---|---|
protected |
CSGCommonNode()
Default initializing constructor. |
Method Summary | |
---|---|
int |
assertAttributes(MicroFacet mf,
java.lang.Object tmp,
int attributes)
Asserts validity of the given intersection-attributes. |
java.lang.Object |
getAttribute(java.lang.String key)
Returns the given attribute (defined in this SceneNode or inherited from
some parent node). |
java.util.List<java.lang.Object> |
getAttributes(java.lang.String key)
Returns the whole inherence-sequence for the given attribute. |
int |
getOrder()
Returns order of this SceneNode in its parent. |
SceneNode |
getParent()
Returns the parent of this node. |
boolean |
isObjectRoot()
Returns true if this node is root of object (component) hierarchy. |
boolean |
selfAttribute(java.lang.String key)
Is the given attribute defined in the node itself or is it inherited? |
java.lang.Object |
setAttribute(java.lang.String key,
java.lang.Object value)
Defines the given attribute (key-value pair) in the node. |
void |
setObjectRoot(boolean root)
Sets this node as root for the object (component). |
void |
setOrder(int ord)
Sets order of this SceneNode in its parent. |
void |
setParent(SceneNode par)
Sets handle to the parent node. |
Methods inherited from class cz.cuni.jagrlib.DefaultSceneNode |
---|
getChild, getChildMatrix, getChildMatrixInv, getSerial, children, insertChild, intersection, removeChild, setSerial |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<java.lang.String,java.lang.Object> attr
protected SceneNode parent
null
for root-node).
protected int order
protected boolean root
Constructor Detail |
---|
protected CSGCommonNode()
Method Detail |
---|
public java.lang.Object getAttribute(java.lang.String key)
SceneNode
or inherited from
some parent node).
Returned object can be an original data object and must not be altered
outside this SceneNode
instance.
getAttribute
in interface SceneNode
getAttribute
in class DefaultSceneNode
key
- Key-string.
null
. Must not be altered!getAttributes(java.lang.String)
,
setAttribute(java.lang.String, java.lang.Object)
,
selfAttribute(java.lang.String)
public boolean selfAttribute(java.lang.String key)
selfAttribute
in interface SceneNode
selfAttribute
in class DefaultSceneNode
key
- Key-string.
true
if the node defines the given attribute.getAttribute(java.lang.String)
,
setAttribute(java.lang.String, java.lang.Object)
,
getAttributes(java.lang.String)
public java.lang.Object setAttribute(java.lang.String key, java.lang.Object value)
setAttribute
in interface SceneNode
setAttribute
in class DefaultSceneNode
key
- Key-string.value
- Attribute value (arbitrary type).
null
.getAttribute(java.lang.String)
,
selfAttribute(java.lang.String)
,
getAttributes(java.lang.String)
public java.util.List<java.lang.Object> getAttributes(java.lang.String key)
getAttributes
in interface SceneNode
getAttributes
in class DefaultSceneNode
key
- Key-string.
result[0]
.. definition in the node itself,
result[1]
.. definition in parent node,
result[2]
.. definition in "grand-parent" node, etc.getAttribute(java.lang.String)
,
setAttribute(java.lang.String, java.lang.Object)
,
selfAttribute(java.lang.String)
public SceneNode getParent()
getParent
in interface SceneNode
getParent
in class DefaultSceneNode
null
for scene-root.setParent(cz.cuni.jagrlib.SceneNode)
,
getOrder()
,
DefaultSceneNode.children()
,
DefaultSceneNode.getChild(int)
public void setParent(SceneNode par)
setParent
in interface SceneNode
setParent
in class DefaultSceneNode
par
- Parent node (or null
).getParent()
public int getOrder()
SceneNode
in its parent.
getOrder
in interface SceneNode
getOrder
in class DefaultSceneNode
-1
for scene-root).setOrder(int)
,
getParent()
public void setOrder(int ord)
SceneNode
in its parent.
setOrder
in interface SceneNode
setOrder
in class DefaultSceneNode
ord
- The new order.getOrder()
public boolean isObjectRoot()
true
if this node is root of object (component) hierarchy.
isObjectRoot
in interface SceneNode
isObjectRoot
in class DefaultSceneNode
setObjectRoot(boolean)
public void setObjectRoot(boolean root)
setObjectRoot
in interface SceneNode
setObjectRoot
in class DefaultSceneNode
root
- Should this node be treated as root?isObjectRoot()
public int assertAttributes(MicroFacet mf, java.lang.Object tmp, int attributes)
VALID_TO_WORLD
,
VALID_TO_OBJECT
,
VALID_TEXTURES
,
VALID_BRDF
,
VALID_MATERIAL
,
VALID_COLOR
.
assertAttributes
in interface IntersectionAttributes
assertAttributes
in class DefaultSceneNode
mf
- The checked intersection.tmp
- Non-mandatory object holding state-information for deferred computations.attributes
- Attribute mask (required attributes - see
MicroFacet.VALID_*
).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |