de.fhg.igd.earth.model.graph
Class Node

java.lang.Object
  extended byde.fhg.igd.earth.model.graph.ProjectorObject
      extended byde.fhg.igd.earth.model.graph.ModelGraphObject
          extended byde.fhg.igd.earth.model.graph.Node
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
Group, Leaf

public abstract class Node
extends ModelGraphObject
implements Serializable, Cloneable

This class represents a node. A node can have a parent. It can be collidable, pickable and boundless. Collidable isn't implemented yet. If pickable is true this node can get the focus from a projector. Boundless means that there is no bounding box to show. The icon you can define is for visualizing this node on a tree projector. Title : Earth Copyright : Copyright (c) 2001 Organisation : IGD FhG

Version:
: 1.0
Author:
: Werner Beutel
See Also:
Serialized Form

Field Summary
protected  boolean boundless_
          boundless flag
protected  boolean collidable_
          collidable flag
protected  String icon_
          the filename of the icon for this node
protected  Node parent_
          the parent of this node (can be null if this node is the root)
protected  boolean pickable_
          pickable flag
 
Fields inherited from class de.fhg.igd.earth.model.graph.ModelGraphObject
CHANGE_AddChild, CHANGE_Anything, CHANGE_Appearance, CHANGE_Color, CHANGE_Create, CHANGE_Delete, CHANGE_Focus, CHANGE_HistoryGroup, CHANGE_InfoTable, CHANGE_Object, CHANGE_RemoveChild, CHANGE_Shape, CHANGE_Trace, CHANGE_Update, CHANGE_Visibility, changes_, infoTable_, mutable_, name_, subChanges_, SUBTYPE_BackGround, SUBTYPE_Box, SUBTYPE_BranchGroup, SUBTYPE_Cone, SUBTYPE_Cylinder, SUBTYPE_DetailGroup, SUBTYPE_DistanceDetailGroup, SUBTYPE_Group, SUBTYPE_HistoryGroup, SUBTYPE_LatchGroup, SUBTYPE_ModelGraph, SUBTYPE_Polygon, SUBTYPE_Primitive, SUBTYPE_Sphere, SUBTYPE_Text, SUBTYPE_TransformGroup, SUBTYPE_WireBoxGroup, timeStamp_, trace_, traceable_, TYPE_Group, TYPE_Leaf
 
Fields inherited from class de.fhg.igd.earth.model.graph.ProjectorObject
projectorObject_
 
Constructor Summary
Node()
          Constructs and initializes a default node.
 
Method Summary
 void broadcastCreation()
          Sets the CHANGE_CREATE flag of all sub nodes
protected  void broadcastResetChanges()
          Resets all changes in all sub nodes.
protected abstract  void calcBoundingBox(cBoundingBox boundingBox)
          Calculates the bounding box of this node.
 Object clone()
          Clones this node
protected abstract  void createLeafList(Vector list)
          Inserts all sub leafs to a given Vector.
protected  void createParentGroupList(Vector list)
          Inserts all parent groups to a given Vector.
protected abstract  void createSubGroupList(Vector list)
          Inserts all sub groups to a given Vector.
protected abstract  void createSubNodeList(Vector list)
          Inserts all subnodes to a given Vector.
 boolean delete()
          Delete this Node.
 boolean delete(String group, String name)
          Deletes the node with the given group and name.
protected abstract  void detach()
          This method sets the CHANGED_DELETED flag of this node and all sub nodes.
 cBoundingBox getBoundingBox()
          Returnes the bounding box of this node.
 boolean getBoundless()
          Returns the boundless flag.
 BranchGroup getBranchGroup()
          Returns the BranchGroup of this node.
 boolean getCollidable()
          Returns the collidable flag.
 String getGroup()
          Returns the "group" of this node.
 String getIcon()
          Returns the filename of the icon.
 Vector getLeafList()
          Returns a Vector witch includes all sub leafs.
 ModelGraph getModelGraph()
          Returns the root node (ModelGraph).
 Node getParent()
          Returns the parent of this node
 Vector getParentGroupList()
          Returns a Vector witch includes all related parent groups.
 boolean getPickable()
          Returns the pickable flag.
 Vector getSubGroupList()
          Returns a Vector witch includes all sub groups.
 Vector getSubNodeList()
          Returns a Vector witch includes all subnodes.
 boolean isFocused()
          Returnes true if this node has got the focus.
 boolean move(double x, double y, double z)
          move this graphic object relatively to the current position.
 boolean move(String group, String name, double x, double y, double z)
          search a node and move it.
 boolean moveTo(double x, double y, double z)
          move this graphic object to the given position.
protected  void publishChanges(int c)
          All changes of this node will be published to the parent.
 void resetProjectorObject(Object p)
          Removes all projector object entries in all subnodes with the given projector.
abstract  Enumeration searchDown(int type)
          Search method which walks down the tree and searches by type.
abstract  Node searchDown(int type, int subType)
          Search method which walks down the tree and searches by type and subtype.
abstract  Enumeration searchDown(String group)
          Search method which walks down the tree and searches by group.
abstract  Node searchDown(String group, String name)
          Search method which walks down the tree and searches by group and name.
protected abstract  void searchDownInserter(int type, Vector result)
          This method inserts all nodes with the given type into the result Vector.
protected abstract  void searchDownInserter(String group, Vector result)
          This method inserts all nodes with the given group name into the result Vector.
 Enumeration searchUp(int type)
          Search method which walks up the tree and searches by type.
 Node searchUp(int type, int subType)
          Search method which walks up the tree and searches by type and subtype.
 Enumeration searchUp(String group)
          Search method which walks up the tree and searches by group.
 Node searchUp(String group, String name)
          Search method which walks up the tree and searches by group and name.
 void setBoundless(boolean boundless)
          Sets the boundless flag.
 boolean setCollidable(boolean c)
          Sets the collidable flag (blocked by mutable).
abstract  boolean setColor(Color c)
          Sets the color of all leafs.
abstract  boolean setHighLight(boolean on)
          Sets the HighLight flag of all leafs.
 boolean setIcon(String icon)
          Sets the filename of the icon (blocked by mutable).
protected  void setParent(Node p)
          Defines the parent of this node
 boolean setPickable(boolean p)
          Sets the pickable flag (blocked by mutable).
abstract  void setVisible(boolean v)
          Sets the visibility of this node and all subnodes.
 
Methods inherited from class de.fhg.igd.earth.model.graph.ModelGraphObject
anyChanges, anySubChanges, getChanges, getChanges, getInfoTable, getInfoTableElements, getInfoTableKeys, getInfoTableSize, getInfoTableValues, getMutable, getName, getSubChanges, getSubChanges, getSubType, getSubTypeName, getTimeStamp, getTrace, getTraceable, getType, putInfo, resetChanges, setChanges, setInfoTable, setMutable, setName, setSubChanges, setTrace, VectorClone
 
Methods inherited from class de.fhg.igd.earth.model.graph.ProjectorObject
getProjectorObject, setProjectorObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent_

protected Node parent_
the parent of this node (can be null if this node is the root)


icon_

protected String icon_
the filename of the icon for this node


collidable_

protected boolean collidable_
collidable flag


pickable_

protected boolean pickable_
pickable flag


boundless_

protected boolean boundless_
boundless flag

Constructor Detail

Node

public Node()
Constructs and initializes a default node. Default means that this node will be a root node, not collidable, not pickable, boundless and has no icon.

Method Detail

setParent

protected void setParent(Node p)
Defines the parent of this node

Parameters:
p - Parent node

getParent

public Node getParent()
Returns the parent of this node

Returns:
Parent node

getGroup

public String getGroup()
Returns the "group" of this node. The group is the name of the parent. If there is no parent "MODEL" will be returned.

Returns:
group name

searchDown

public abstract Node searchDown(String group,
                                String name)
Search method which walks down the tree and searches by group and name. It returns a node which has the given name and group. The search includes this node.

Parameters:
group - The searched group
name - The searched name
Returns:
node or null

searchDown

public abstract Enumeration searchDown(String group)
Search method which walks down the tree and searches by group. It returns an Enumeration of nodes which has the given group. The search includes this node.

Parameters:
group - The searched group
Returns:
Enumeration of nodes

searchDownInserter

protected abstract void searchDownInserter(String group,
                                           Vector result)
This method inserts all nodes with the given group name into the result Vector. The search includes this node.

Parameters:
group - The searched group
result - The Vector to insert into

searchUp

public Node searchUp(String group,
                     String name)
Search method which walks up the tree and searches by group and name. It returns a node which has the given name and group. The search DOESN'T include this node.

Parameters:
group - The searched group
name - The searched name
Returns:
node or null

searchUp

public Enumeration searchUp(String group)
Search method which walks up the tree and searches by group. It returns an Enumeration of nodes which has the given group. The search DOESN'T include this node.

Parameters:
group - The searched group
Returns:
Enumeration of nodes

searchDown

public abstract Node searchDown(int type,
                                int subType)
Search method which walks down the tree and searches by type and subtype. It returns a node which has the given type and subtype. The search includes this node.

Parameters:
type - The searched type
Returns:
node or null

searchDown

public abstract Enumeration searchDown(int type)
Search method which walks down the tree and searches by type. It returns an Enumeration of nodes which has the given type. The search includes this node.

Returns:
Enumeration of nodes

searchDownInserter

protected abstract void searchDownInserter(int type,
                                           Vector result)
This method inserts all nodes with the given type into the result Vector. The search includes this node.

Parameters:
type - The searched type
result - The Vector to insert into

searchUp

public Node searchUp(int type,
                     int subType)
Search method which walks up the tree and searches by type and subtype. It returns a node which has the given type and subtype. The search DOESN'T include this node.

Parameters:
type - The searched type
Returns:
node or null

searchUp

public Enumeration searchUp(int type)
Search method which walks up the tree and searches by type. It returns an Enumeration of nodes which has the given type. The search DOESN'T include this node.

Parameters:
type - The searched type
Returns:
Enumeration of nodes

publishChanges

protected void publishChanges(int c)
All changes of this node will be published to the parent. Overwrites the abstract method in the ModelGraphObject.

Specified by:
publishChanges in class ModelGraphObject
Parameters:
c - change

getBranchGroup

public BranchGroup getBranchGroup()
Returns the BranchGroup of this node. A BranchGroup is this child of the root witch is related to this node.

Returns:
BranchGroup or null

getModelGraph

public ModelGraph getModelGraph()
Returns the root node (ModelGraph).

Returns:
ModelGraph or null

setCollidable

public boolean setCollidable(boolean c)
Sets the collidable flag (blocked by mutable). Released changes: CHANGE_UPDATE

Parameters:
c - New collidable flag
Returns:
true on success

getCollidable

public boolean getCollidable()
Returns the collidable flag.

Returns:
The collidable flag

setPickable

public boolean setPickable(boolean p)
Sets the pickable flag (blocked by mutable). Released changes: CHANGE_UPDATE

Returns:
true on success

getPickable

public boolean getPickable()
Returns the pickable flag.

Returns:
The pickable flag

calcBoundingBox

protected abstract void calcBoundingBox(cBoundingBox boundingBox)
Calculates the bounding box of this node. This method is used by getBoundingBox().

Parameters:
boundingBox - which will be combined with

getBoundingBox

public cBoundingBox getBoundingBox()
Returnes the bounding box of this node.

Returns:
boundingBox

delete

public boolean delete()
Delete this Node. This node will be removed from its parent.


delete

public boolean delete(String group,
                      String name)
Deletes the node with the given group and name.

Parameters:
group - The group of the node to delete
name - The name of the node to delete
Returns:
true on success

move

public boolean move(double x,
                    double y,
                    double z)
move this graphic object relatively to the current position.

Returns:
true on success

moveTo

public boolean moveTo(double x,
                      double y,
                      double z)
move this graphic object to the given position.

Returns:
true on success

move

public boolean move(String group,
                    String name,
                    double x,
                    double y,
                    double z)
search a node and move it.

Parameters:
group - The group
name - The name
Returns:
true on success

detach

protected abstract void detach()
This method sets the CHANGED_DELETED flag of this node and all sub nodes. It is used by removeChild()


setVisible

public abstract void setVisible(boolean v)
Sets the visibility of this node and all subnodes.

Parameters:
v - visibility

getIcon

public String getIcon()
Returns the filename of the icon.

Returns:
filename of the icon

setIcon

public boolean setIcon(String icon)
Sets the filename of the icon (blocked by mutable). Released changes: CHANGE_UPDATE

Parameters:
icon - filename
Returns:
true on success

isFocused

public boolean isFocused()
Returnes true if this node has got the focus.

Returns:
Status of focus

setBoundless

public void setBoundless(boolean boundless)
Sets the boundless flag.

Parameters:
boundless - The new boundless flag

getBoundless

public boolean getBoundless()
Returns the boundless flag.

Returns:
The boundless flag

setColor

public abstract boolean setColor(Color c)
Sets the color of all leafs.

Parameters:
c - Color
Returns:
true on success

setHighLight

public abstract boolean setHighLight(boolean on)
Sets the HighLight flag of all leafs. (under construction)

Parameters:
on - The new HighLight flag
Returns:
true on success

getSubNodeList

public Vector getSubNodeList()
Returns a Vector witch includes all subnodes. The current node will be included.

Returns:
Vector with all subnodes

createSubNodeList

protected abstract void createSubNodeList(Vector list)
Inserts all subnodes to a given Vector. This method is used by getSubNodeList().

Parameters:
list - Vector to add into

getSubGroupList

public Vector getSubGroupList()
Returns a Vector witch includes all sub groups. The current node will be included if it is a group.

Returns:
Vector with all sub groups

createSubGroupList

protected abstract void createSubGroupList(Vector list)
Inserts all sub groups to a given Vector. This method is used by getSubGroupList().

Parameters:
list - Vector to add into

getLeafList

public Vector getLeafList()
Returns a Vector witch includes all sub leafs. The current node will be included if it is a leaf.

Returns:
Vector with all sub leafs

createLeafList

protected abstract void createLeafList(Vector list)
Inserts all sub leafs to a given Vector. This method is used by getSubLeafList().

Parameters:
list - Vector to add into

getParentGroupList

public Vector getParentGroupList()
Returns a Vector witch includes all related parent groups. It's the path from this node to the root. This node isn't included.

Returns:
Vector with all parents

createParentGroupList

protected void createParentGroupList(Vector list)
Inserts all parent groups to a given Vector. This method is used by getParentGroupList().

Parameters:
list - Vector to add into

broadcastResetChanges

protected void broadcastResetChanges()
Resets all changes in all sub nodes. This method is called by ModelGraph.reset()


broadcastCreation

public void broadcastCreation()
Sets the CHANGE_CREATE flag of all sub nodes


resetProjectorObject

public void resetProjectorObject(Object p)
Removes all projector object entries in all subnodes with the given projector.

Parameters:
p - projector

clone

public Object clone()
Clones this node

Overrides:
clone in class ModelGraphObject


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.