visual.entity
Class Entity3d

java.lang.Object
  extended by visual.entity.Entity3d
Direct Known Subclasses:
Link3d, Node3d

public abstract class Entity3d
extends java.lang.Object

Created by IntelliJ IDEA. User: andy Date: Apr 8, 2010 An abstract class for creating and displaying experiment.Entity objects in the 3d canvas. Every Entity object (Node/Link) that is or is going to be displayed, is bound to an Entity3d object and visa versa.


Nested Class Summary
static class Entity3d.SCALE
          Defines allowed scale operations.
 
Field Summary
protected  Entity entity
           
protected static double factor
           
protected  javax.media.j3d.TransformGroup TG
           
 
Constructor Summary
Entity3d(Entity entity)
          Default Constructor.
 
Method Summary
abstract  javax.media.j3d.Appearance createAppearance()
          Define the appearance of the 3d Entity.
static Entity3d get(Entity entity)
          As soon an Entity3d is constructed, it is saved to the entity3dSet.
 Entity getEntity()
           
 javax.media.j3d.TransformGroup getTG()
           
abstract  void hide()
          If an entity has been constructed during experiment visualization, then in case of seeking or stop, when the rewire() method is called, it may be that even though the entity3d is displayed, it has not yet been constracted.
abstract  void move(Position p)
          Move the 3d Entity to a new Position.
protected  javax.vecmath.Vector3d normalize(javax.vecmath.Vector3d vector3d)
          Normalize entity positions to achieve better view of the experiment.
abstract  void reden()
          Makes the 3d entity object flash red.
static void rewire(ExperimentState state)
          Is called during a seeking operation or after a reset operation to update and rewire each Entity, Entity3d correlation.
abstract  void scale(Entity3d.SCALE mode)
          Either enlarges or shrinks the 3d entity.
static void setFactor(ExperimentState state)
          Calculate the normalization factor.
abstract  void show()
          If during experiment visualization a new Entity is added and the corresponding Entity3d is hidden, show the Entity3d.
abstract  void updateStatus()
          Makes a 3d Entity appear as enabled or disabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entity

protected Entity entity

factor

protected static double factor

TG

protected javax.media.j3d.TransformGroup TG
Constructor Detail

Entity3d

public Entity3d(Entity entity)
Default Constructor. Associates a 3d representation with its corresponding Entity.

Parameters:
entity - the corresponding experiment entity.
Method Detail

createAppearance

public abstract javax.media.j3d.Appearance createAppearance()
Define the appearance of the 3d Entity.

Returns:
an Appearance object.

get

public static Entity3d get(Entity entity)
As soon an Entity3d is constructed, it is saved to the entity3dSet. Even if it may not be seen, or if it is not associated with an Entity it still exists. This usually occurs when the user seeks backward. When a new Entity is constructed with the same id, the Entity3d is rewired and re-seen again.

Parameters:
entity - holds the experiment information
Returns:
the 3d information associated with the experiment information.

getEntity

public Entity getEntity()
Returns:
the experiment.Entity object that is associated with this 3d entity.

getTG

public javax.media.j3d.TransformGroup getTG()
Returns:
the tranform Group containing the 3d entity's positioning information.

hide

public abstract void hide()
If an entity has been constructed during experiment visualization, then in case of seeking or stop, when the rewire() method is called, it may be that even though the entity3d is displayed, it has not yet been constracted. In this case the entity3d is hidden until the entity is reconstructed.


move

public abstract void move(Position p)
Move the 3d Entity to a new Position.

Parameters:
p - is the new experiment.entity.Position where the 3d Entity is going to be moved.

normalize

protected javax.vecmath.Vector3d normalize(javax.vecmath.Vector3d vector3d)
Normalize entity positions to achieve better view of the experiment.

Parameters:
vector3d - the actual position of the entity.
Returns:
the normalized position.

reden

public abstract void reden()
Makes the 3d entity object flash red.


rewire

public static void rewire(ExperimentState state)
Is called during a seeking operation or after a reset operation to update and rewire each Entity, Entity3d correlation.

Parameters:
state - the new ExperimentState containing all updated Entity instances.

scale

public abstract void scale(Entity3d.SCALE mode)
Either enlarges or shrinks the 3d entity. It is used with picking and is called by FrontEnd when the monitored entity changes.

Parameters:
mode - enlarge or shrink?

setFactor

public static void setFactor(ExperimentState state)
Calculate the normalization factor. The factor is calculated so that the furthest node is positioned at the edge of the plane.

Parameters:
state - the experiment state conatining all node data.

show

public abstract void show()
If during experiment visualization a new Entity is added and the corresponding Entity3d is hidden, show the Entity3d.


updateStatus

public abstract void updateStatus()
Makes a 3d Entity appear as enabled or disabled.