EDU.auburn.VGJ.graph
Class Node

java.lang.Object
  extended byEDU.auburn.VGJ.graph.Node
All Implemented Interfaces:
java.lang.Cloneable, java.awt.image.ImageObserver
Direct Known Subclasses:
AbstractConcept

public class Node
extends java.lang.Object
implements java.lang.Cloneable, java.awt.image.ImageObserver

A Node class for use in a Graph, and for display.

Here is the source.

Author:
Larry Barowski, Dennis Wagelaar

Field Summary
static int BELOW
           
static int CENTER
           
 java.lang.Object data
          A general purpose data field.
 java.util.Hashtable data_
           
static java.lang.String[] defaultDataTypes_
          Just change this list to change the data types.
static Node defaults
          The default node.
protected  double depth_
           
protected  boolean groupActive_
           
protected  DDimension3 groupbox_
           
protected  Node groupNode_
           
protected  int groupNodeId_
           
protected  DPoint3 grouppos_
           
protected  boolean haveId_
           
protected  double height_
           
protected  int id_
           
static int IN
           
protected  boolean inActiveGroup_
           
protected  int index_
           
protected  boolean isDummy_
           
protected  boolean isGroup_
           
protected  java.lang.String[] label_
          The label is split up per line.
protected  DDimension3 oldbox_
           
protected  DPoint3 oldpos_
           
static int OVAL
           
static int RECTANGLE
           
static java.lang.String[] shapeNames
           
protected  double width_
           
protected  double x_
           
protected  double y_
           
protected  double z_
           
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Node()
          Create a Node with default attributes.
Node(boolean dummy)
          Create a Node with default attributes, that may be a dummy node.
Node(GMLobject gml)
           
 
Method Summary
 void clearChild(int child)
           
 java.lang.Object clone()
           
 void copyAttributes(Node node_to_copy)
          Copy attributes from another Node.
 void draw(java.awt.Component comp, java.awt.Graphics graphics, Matrix44 transform, int quality)
           
 int firstChild()
          Returns the index of the lowest numbered child, -1 if there are no children.
 DDimension getBoundingBox()
           
 DDimension3 getBoundingBox3()
           
 Set getChildren()
           
static boolean getDefaultLabel()
           
 void getDrawBounds_(double scale, Matrix44 transform, DPoint width, DPoint height)
           
 int getId()
           
 java.lang.Integer getIdObject()
           
 java.awt.Image getImage()
           
static int[] getImagePixels(java.awt.Image image, int wd, int ht)
           
 java.lang.String getImageSource()
           
 java.lang.String getImageType()
           
 int getIndex()
           
 java.lang.String getLabel()
           
 int getLabelPosition()
           
 DPoint getPosition()
           
 DPoint3 getPosition3()
           
 boolean getSelected()
           
 int getShape()
           
 double getTemp()
           
 Node getVisibleGroupRoot()
           
 boolean groupActive()
           
 boolean hasChild(int child)
           
 boolean hasChild(Node child)
           
static java.lang.String imagePS(java.awt.Image image)
           
 boolean imageUpdate(java.awt.Image image, int info, int x, int y, int w, int h)
           
 boolean inGroup()
           
 DPoint3 intersectWithLineTo(DPoint3 to, boolean inplane, int quality)
           
 boolean isGroup()
           
 boolean isVisible()
           
 int nextChild()
          Returns the index of the next child, -1 if there is none.
 int numberOfChildren()
           
protected  java.lang.String PSnum_(double num)
          Formats a number for use in Postscript.
protected  java.lang.StringBuffer psString_(java.lang.String source)
          Add escape characters for PostScript.
 void saveState()
           
 void scale(double scalex, double scaley, double scalez)
           
 int searchNextChild(int n)
          Return the next child with index >= n, or -1 if n is the last.
 void setBoundingBox(DDimension new_bbox)
           
 void setBoundingBox(DDimension3 new_bbox)
           
 void setBoundingBox(double new_width, double new_height)
           
 void setBoundingBox(double new_width, double new_height, double new_depth)
           
 void setChild(int child)
           
static void setContext(java.net.URL context)
           
static void setDefaultLabel(boolean use_default)
           
 void setGMLvalues(GMLobject gml)
           
 void setGroup()
           
 void setId(int id)
           
 void setImage(java.awt.Component comp, boolean set_w, boolean set_h)
           
 void setImageSource(java.lang.String image_source)
           
 void setImageType(java.lang.String image_type)
           
 void setLabel(java.lang.String label)
           
 void setLabelPosition(java.lang.String label_position)
           
 void setPosition(double new_x, double new_y)
           
 void setPosition(double new_x, double new_y, double new_z)
           
 void setPosition(DPoint new_position)
           
 void setPosition(DPoint3 new_position)
           
 void setSelected(boolean selected)
           
 void setShape(int shape)
           
 void setTemp(double temp)
           
static void setToolkit(java.awt.Toolkit toolkit)
           
 void slide(Matrix44 moveTransform, Matrix44 viewTransform, int xoffs, int yoffs)
           
 java.lang.String toPS(Matrix44 transform)
          Generate PostScript code for the node.
 java.lang.String toPSimage(int number, Matrix44 transform)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x_

protected double x_

y_

protected double y_

z_

protected double z_

oldpos_

protected DPoint3 oldpos_

grouppos_

protected DPoint3 grouppos_

oldbox_

protected DDimension3 oldbox_

groupbox_

protected DDimension3 groupbox_

width_

protected double width_

height_

protected double height_

depth_

protected double depth_

label_

protected java.lang.String[] label_
The label is split up per line. Was private, made protected by Dennis Wagelaar.


isDummy_

protected boolean isDummy_

index_

protected int index_

id_

protected int id_

haveId_

protected boolean haveId_

groupNodeId_

protected int groupNodeId_

groupNode_

protected Node groupNode_

isGroup_

protected boolean isGroup_

groupActive_

protected boolean groupActive_

inActiveGroup_

protected boolean inActiveGroup_

data

public java.lang.Object data
A general purpose data field. Algorithms that operate on Nodes can store any necessary data here.


OVAL

public static final int OVAL
See Also:
Constant Field Values

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

BELOW

public static final int BELOW
See Also:
Constant Field Values

IN

public static final int IN
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

shapeNames

public static final java.lang.String[] shapeNames

defaultDataTypes_

public static java.lang.String[] defaultDataTypes_
Just change this list to change the data types.


data_

public java.util.Hashtable data_

defaults

public static Node defaults
The default node. Created nodes are initialized with the fields of this node. Default attributes can be changed by modifying it, in the same way those attributes are changed for other nodes.

For Example: If Node.defaults.setPosition(1.0, 1.0) is called, (1.0, 1.0) becomes the default position for all Nodes created thereafter.

Do not assign defaults to null, but it can be assigned to another Node.

Constructor Detail

Node

public Node()
Create a Node with default attributes.


Node

public Node(boolean dummy)
Create a Node with default attributes, that may be a dummy node. Graph.dummysToEdgePaths() will convert the dummy nodes to edge paths.


Node

public Node(GMLobject gml)
Method Detail

searchNextChild

public int searchNextChild(int n)
Return the next child with index >= n, or -1 if n is the last.


setGMLvalues

public void setGMLvalues(GMLobject gml)

setId

public void setId(int id)

getIdObject

public java.lang.Integer getIdObject()

getId

public int getId()

setPosition

public void setPosition(double new_x,
                        double new_y)

setPosition

public void setPosition(DPoint new_position)

setPosition

public void setPosition(double new_x,
                        double new_y,
                        double new_z)

setPosition

public void setPosition(DPoint3 new_position)

getPosition

public DPoint getPosition()

getPosition3

public DPoint3 getPosition3()

setBoundingBox

public void setBoundingBox(double new_width,
                           double new_height)

setBoundingBox

public void setBoundingBox(DDimension new_bbox)

getBoundingBox

public DDimension getBoundingBox()

setBoundingBox

public void setBoundingBox(double new_width,
                           double new_height,
                           double new_depth)

setBoundingBox

public void setBoundingBox(DDimension3 new_bbox)

getBoundingBox3

public DDimension3 getBoundingBox3()

setShape

public void setShape(int shape)

getShape

public int getShape()

setTemp

public void setTemp(double temp)

getTemp

public double getTemp()

setLabel

public void setLabel(java.lang.String label)

getLabel

public java.lang.String getLabel()

setDefaultLabel

public static void setDefaultLabel(boolean use_default)

getDefaultLabel

public static boolean getDefaultLabel()

setSelected

public void setSelected(boolean selected)

getSelected

public boolean getSelected()

setChild

public void setChild(int child)

clearChild

public void clearChild(int child)

getChildren

public Set getChildren()

firstChild

public int firstChild()
Returns the index of the lowest numbered child, -1 if there are no children.

This resets the iterator nextChild().


nextChild

public int nextChild()
Returns the index of the next child, -1 if there is none.


getIndex

public int getIndex()

hasChild

public boolean hasChild(int child)

hasChild

public boolean hasChild(Node child)

numberOfChildren

public int numberOfChildren()

copyAttributes

public void copyAttributes(Node node_to_copy)
Copy attributes from another Node. This will not change the children or the data.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

draw

public void draw(java.awt.Component comp,
                 java.awt.Graphics graphics,
                 Matrix44 transform,
                 int quality)

intersectWithLineTo

public DPoint3 intersectWithLineTo(DPoint3 to,
                                   boolean inplane,
                                   int quality)

toPS

public java.lang.String toPS(Matrix44 transform)
Generate PostScript code for the node.


psString_

protected java.lang.StringBuffer psString_(java.lang.String source)
Add escape characters for PostScript. Make this part of a static utility later. Was private, made protected by Dennis Wagelaar.

Parameters:
source - The string to format.
Returns:
The formatted string.

toPSimage

public java.lang.String toPSimage(int number,
                                  Matrix44 transform)

PSnum_

protected java.lang.String PSnum_(double num)
Formats a number for use in Postscript. Was private, made protected by Dennis Wagelaar. Removed bug (>0 has become >= 0).

Parameters:
num - The number to format.
Returns:
The formatted number.

getDrawBounds_

public void getDrawBounds_(double scale,
                           Matrix44 transform,
                           DPoint width,
                           DPoint height)

saveState

public void saveState()

slide

public void slide(Matrix44 moveTransform,
                  Matrix44 viewTransform,
                  int xoffs,
                  int yoffs)

scale

public void scale(double scalex,
                  double scaley,
                  double scalez)

setToolkit

public static void setToolkit(java.awt.Toolkit toolkit)

setContext

public static void setContext(java.net.URL context)

imageUpdate

public boolean imageUpdate(java.awt.Image image,
                           int info,
                           int x,
                           int y,
                           int w,
                           int h)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

setLabelPosition

public void setLabelPosition(java.lang.String label_position)

getLabelPosition

public int getLabelPosition()

setImageType

public void setImageType(java.lang.String image_type)

getImageType

public java.lang.String getImageType()

setImageSource

public void setImageSource(java.lang.String image_source)

getImageSource

public java.lang.String getImageSource()

setImage

public void setImage(java.awt.Component comp,
                     boolean set_w,
                     boolean set_h)

getImagePixels

public static int[] getImagePixels(java.awt.Image image,
                                   int wd,
                                   int ht)

getImage

public java.awt.Image getImage()

imagePS

public static java.lang.String imagePS(java.awt.Image image)

inGroup

public boolean inGroup()

isGroup

public boolean isGroup()

groupActive

public boolean groupActive()

isVisible

public boolean isVisible()

getVisibleGroupRoot

public Node getVisibleGroupRoot()

setGroup

public void setGroup()