com.ericsson.tic.vi
Class GraphNode

java.lang.Object
  extended by com.ericsson.tic.vi.Pickable
      extended by com.ericsson.tic.vi.GraphNode
All Implemented Interfaces:
Cloneable

public class GraphNode
extends Pickable
implements Cloneable

A node in a graph which is mapped onto a plane or onto a sphere/globe.

Version:
1.0 (2008-12-04)
Author:
Sami Matilainen

Field Summary
 float[] colorf
          Color as a 3f value (RGB)
 boolean expanded
          Indicates wheter this node is expanded or not.
 int id
          A unique identifier for this node.
 Label label
          A label associated with this node.
 float lat
          Latitude in degrees.
 float lon
          Longitutude in degrees.
 float rad
          Radius of globe.
 float speed
          The speed of this node.
 String title
           
 NodeType type
          The type of this node.
private  float weight
          The weight of this node (used for calculating tention between nodes)
 float x
          Current coordinate.
 float xPlanar
          Planar Coordinate (default -2 <= x < 2)
private  float xSpeed
          The speed of this node.
private  float xTarget
          The travel-target of this node.
 float xTex
          Texture coordinate (should correspond to planar coordinate)
 float xUser
          User Planar Coordinate (default -2 <= x < 2)
 float y
          Current coordinate.
 float yPlanar
          Planar Coordinate (default -1 <= y < 1)
private  float ySpeed
          The speed of this node.
private  float yTarget
          The travel-target of this node.
 float yTex
          Texture coordinate (should correspond to planar coordinate)
 float yUser
          User Planar Coordinate (default -1 <= y < 1)
 float z
          Current coordinate.
 float zPlanar
          Planar Coordinate (default z = 0.0)
private  float zSpeed
          The speed of this node.
private  float zTarget
          The travel-target of this node.
 float zUser
          User Planar Coordinate (default z = 0.0)
 
Fields inherited from class com.ericsson.tic.vi.Pickable
highlighted, pid
 
Constructor Summary
GraphNode(int id, NodeType type, String title)
          Creates a node at coordinate 0, 0, 0 (on the map) Which corresponds to a longitude latitude position of 0 degrees lat, 0 degrees long.
GraphNode(int id, NodeType type, String title, float x, float y, float z)
          Creates a node at coordinate x, y, z (on the map)
 
Method Summary
 Object clone()
          Clones this graph node.
 void moveTowardsTarget()
          Take a step towards the target.
private  void planarFromSpherical()
          Sets the planar coordinates from the spherical coordinates.
private  void planarFromTexture()
          Sets the planar coordinates from the texture coordinates.
 void print()
          Print out some of the more important attributes.
 void setPlanar(float xPlanar, float yPlanar, float zPlanar)
          Sets the coordinates of the node by using planar coordinates.
 void setSpeed(float speed)
          Set the speed of this node.
private  void setSpeedVector()
          Set the speedvector.
 void setSpeedVector(float speed)
          Set the speedvector.
 void setSpherical(float lon, float lat, float rad)
          Sets the coordinates of the node by using spherical coordinates.
 void setTarget(float xTarget, float yTarget, float zTarget)
          Sets the traveling target of this node.
 void setTargetOnGlobe()
          Sets the target on the globe surface.
 void setTargetOnPlane()
          Sets the target on the plane.
 void setUser(float xUser, float yUser, float zUser)
          Sets the user coordinates.
 float[] sphericalAsCarteesian()
          Return carteesian coordinates from spherical once.
private  void sphericalFromPlanar()
          Sets the spherical coordinates from the planar coordinates.
 void stopMoving()
          Stops moving.
private  void textureFromPlanar()
          Sets the texture coordinates from the planar coordinates.
 
Methods inherited from class com.ericsson.tic.vi.Pickable
newPID
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public int id
A unique identifier for this node.


type

public NodeType type
The type of this node.


colorf

public float[] colorf
Color as a 3f value (RGB)


x

public float x
Current coordinate.


y

public float y
Current coordinate.


z

public float z
Current coordinate.


label

public Label label
A label associated with this node.


xPlanar

public float xPlanar
Planar Coordinate (default -2 <= x < 2)


yPlanar

public float yPlanar
Planar Coordinate (default -1 <= y < 1)


zPlanar

public float zPlanar
Planar Coordinate (default z = 0.0)


xUser

public float xUser
User Planar Coordinate (default -2 <= x < 2)


yUser

public float yUser
User Planar Coordinate (default -1 <= y < 1)


zUser

public float zUser
User Planar Coordinate (default z = 0.0)


xTex

public float xTex
Texture coordinate (should correspond to planar coordinate)


yTex

public float yTex
Texture coordinate (should correspond to planar coordinate)


lon

public float lon
Longitutude in degrees.


lat

public float lat
Latitude in degrees.


rad

public float rad
Radius of globe.


xTarget

private float xTarget
The travel-target of this node.


yTarget

private float yTarget
The travel-target of this node.


zTarget

private float zTarget
The travel-target of this node.


speed

public float speed
The speed of this node.


xSpeed

private float xSpeed
The speed of this node.


ySpeed

private float ySpeed
The speed of this node.


zSpeed

private float zSpeed
The speed of this node.


weight

private float weight
The weight of this node (used for calculating tention between nodes)


expanded

public boolean expanded
Indicates wheter this node is expanded or not.


title

public String title
Constructor Detail

GraphNode

public GraphNode(int id,
                 NodeType type,
                 String title)
Creates a node at coordinate 0, 0, 0 (on the map) Which corresponds to a longitude latitude position of 0 degrees lat, 0 degrees long.

Parameters:
id - the id of this node.
type - the type of this node.

GraphNode

public GraphNode(int id,
                 NodeType type,
                 String title,
                 float x,
                 float y,
                 float z)
Creates a node at coordinate x, y, z (on the map)

Parameters:
id - the id of this node.
type - the type of this node.
title - The Title of the node.
x - The x-coordinate. [-2 < x < 2]
y - The y-coordinate. [-1 < y < 1]
z - The z-coordinate should be 0
Method Detail

setUser

public void setUser(float xUser,
                    float yUser,
                    float zUser)
Sets the user coordinates.

Parameters:
xUser - The x coordinate.
yUser - The y coordinate.
zUser - The z coordinate.

setPlanar

public void setPlanar(float xPlanar,
                      float yPlanar,
                      float zPlanar)
Sets the coordinates of the node by using planar coordinates.

Parameters:
xPlanar - The x coordinate.
yPlanar - The y coordinate.
zPlanar - The z coordinate.

setSpherical

public void setSpherical(float lon,
                         float lat,
                         float rad)
Sets the coordinates of the node by using spherical coordinates.

Parameters:
lon - The longitude.
lat - The latitude.
rad - The radious of the Sphere/Globe/Earth..

planarFromSpherical

private void planarFromSpherical()
Sets the planar coordinates from the spherical coordinates.


sphericalFromPlanar

private void sphericalFromPlanar()
Sets the spherical coordinates from the planar coordinates.


textureFromPlanar

private void textureFromPlanar()
Sets the texture coordinates from the planar coordinates.


planarFromTexture

private void planarFromTexture()
Sets the planar coordinates from the texture coordinates.


setSpeed

public void setSpeed(float speed)
Set the speed of this node.

Parameters:
speed - The speed.

setSpeedVector

public void setSpeedVector(float speed)
Set the speedvector.

Parameters:
speed - The speed.

setSpeedVector

private void setSpeedVector()
Set the speedvector.


setTarget

public void setTarget(float xTarget,
                      float yTarget,
                      float zTarget)
Sets the traveling target of this node.

Parameters:
xTarget - The x coordinate of the target.
yTarget - The y coordinate of the target.
zTarget - The z coordinate of the target.

setTargetOnGlobe

public void setTargetOnGlobe()
Sets the target on the globe surface.


setTargetOnPlane

public void setTargetOnPlane()
Sets the target on the plane.


sphericalAsCarteesian

public float[] sphericalAsCarteesian()
Return carteesian coordinates from spherical once.

Returns:
A triple of carteesian coordinates. (x, y, z)

moveTowardsTarget

public void moveTowardsTarget()
Take a step towards the target. How long the step is depends on the speed.


stopMoving

public void stopMoving()
Stops moving.


print

public void print()
Print out some of the more important attributes. For debugging.


clone

public Object clone()
             throws CloneNotSupportedException
Clones this graph node.

Overrides:
clone in class Object
Throws:
CloneNotSupportedException