jET
1.0alpha4


org.jet.tracks
Class Switch

java.lang.Object
  |
  +--org.jet.tracks.Track
        |
        +--org.jet.tracks.Switch
All Implemented Interfaces:
Componentable, java.io.Serializable

public class Switch
extends Track
implements Componentable

Switch entity.

See Also:
Serialized Form

Field Summary
protected  javax.vecmath.Point3d node3
          End point of reversible track.
protected  double radiusSwitched
          Radius of reversible track.
protected  double roll3
          Roll at end point of reversible track.
protected  double rollSwitched
          Roll at start point of reversible track.
protected  javax.vecmath.Vector3d vec3
          Vector mounted at end point of reversible track to start point of track.
protected  javax.vecmath.Vector3d vecSwitched
          Vector mounted at start point to the reversible track.
 
Fields inherited from class org.jet.tracks.Track
CANYON, damage, enviroment, FLAT, friction, length, MOUNTAINS, name, node1, node2, quality, radius, roll1, roll2, secondTexture, tapDistance, texHeight, texSlope, texture, textureLength, texWidth, TUNNEL, vec1, vec2, visibility, width
 
Constructor Summary
Switch()
          Dummy constructor.
Switch(double length, double switchedRadius)
          Creates switch with length and radius for switched track.
Switch(double length, double switchedRadius, double mainRadius)
          Creates the arc switch.
 
Method Summary
 boolean equals(java.lang.Object o)
          Test if two switches are equal.
 float getAngle(java.awt.Point p)
          Get rotate angle for specified handle.
 java.awt.Point[] getHandles()
          Gets array of points in component coordinates where to put handles.
 javax.vecmath.Point3d getPoint3()
          Gets end point of switch.
 java.awt.Rectangle getRenderedRectangle()
          Gets rectangle where the icon is contained.
 double getRoll3()
          Gets the roll at end point of reversible track.
 double getSwitchedRadius()
          Gets radius of reversible track.
 double getSwitchedRoll()
          Gets the roll at start point of reversible track.
 javax.vecmath.Vector3d getSwitchedVector()
          Gets the vector mounted at start point to the end of reversible track.
 java.lang.String getToolTip()
          Contents of component used as a formant.
 javax.vecmath.Vector3d getVector3()
          Gets the vector mounted at the end of reversible track.
 void paintComponent(java.awt.Graphics g)
          Paints icon of the element on the component.
 void setPoint3(double[] array)
          Sets the end point of the reversible track of switch.
 void setPoint3(double x, double y, double z)
          Sets the end point of the reversible track of switch.
 void setPoint3(javax.vecmath.Point3d p)
          Sets the end point of the reversible track of switch.
 void setRoll3(double d)
          Sets the roll at end pointof reversible track.
 void setSwitchedRadius(double d)
          Sets radius of reversible track.
 void setSwitchedRoll(double d)
          Sets the roll at start point of reversible track.
 void setSwitchedVector(double[] array)
          Sets the vector mounted at start point to the end of reversible track.
 void setSwitchedVector(double x, double y, double z)
          Sets the vector mounted at start point to the end of reversible track.
 void setSwitchedVector(javax.vecmath.Vector3d v)
          Sets the vector mounted at start point to the end of reversible track.
 void setVector3(double[] array)
          Sets the vector mounted at the end of reversible track.
 void setVector3(double x, double y, double z)
          Sets the vector mounted at the end of reversible track.
 void setVector3(javax.vecmath.Vector3d v)
          Sets the vector mounted at the end of reversible track.
 java.lang.String toString()
          Gets description.
 
Methods inherited from class org.jet.tracks.Track
getDamage, getEnviroment, getFriction, getIncline, getLength, getName, getPoint1, getPoint2, getQuality, getRadius, getRoll1, getRoll2, getSecondTexture, getTap, getTexture, getTextureHeight, getTextureLength, getTextureSlope, getTextureWidth, getVector1, getVector2, getWidth, isVisible, setDamage, setEnviroment, setFriction, setLength, setName, setPoint1, setPoint1, setPoint1, setPoint2, setPoint2, setPoint2, setQuality, setRadius, setRoll1, setRoll2, setSecondTexture, setTap, setTexture, setTextureHeight, setTextureLength, setTextureSlope, setTextureWidth, setVector1, setVector1, setVector1, setVector2, setVector2, setVector2, setVisible, setWidth
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

node3

protected javax.vecmath.Point3d node3
End point of reversible track.


vecSwitched

protected javax.vecmath.Vector3d vecSwitched
Vector mounted at start point to the reversible track.


vec3

protected javax.vecmath.Vector3d vec3
Vector mounted at end point of reversible track to start point of track.


rollSwitched

protected double rollSwitched
Roll at start point of reversible track.


roll3

protected double roll3
Roll at end point of reversible track.


radiusSwitched

protected double radiusSwitched
Radius of reversible track.

Constructor Detail

Switch

public Switch()
Dummy constructor.


Switch

public Switch(double length,
              double switchedRadius)
Creates switch with length and radius for switched track.

Parameters:
length - Length of the switch (the same for straight and reversible track).
switchedRadius - Radius for reversible track. When the value is positive it means that switch is right reversible. Negative values means that switch will be left reversible.

Switch

public Switch(double length,
              double switchedRadius,
              double mainRadius)
Creates the arc switch.

Parameters:
length - Length of the switch (the same for straight and reversible track).
switchedRadius - Radius for reversible track.
mainRadius - Radius for straight track.
Method Detail

getPoint3

public javax.vecmath.Point3d getPoint3()
Gets end point of switch.


setPoint3

public void setPoint3(javax.vecmath.Point3d p)
Sets the end point of the reversible track of switch.


setPoint3

public void setPoint3(double x,
                      double y,
                      double z)
Sets the end point of the reversible track of switch.


setPoint3

public void setPoint3(double[] array)
Sets the end point of the reversible track of switch.


getSwitchedVector

public javax.vecmath.Vector3d getSwitchedVector()
Gets the vector mounted at start point to the end of reversible track.


setSwitchedVector

public void setSwitchedVector(javax.vecmath.Vector3d v)
Sets the vector mounted at start point to the end of reversible track.


setSwitchedVector

public void setSwitchedVector(double x,
                              double y,
                              double z)
Sets the vector mounted at start point to the end of reversible track.


setSwitchedVector

public void setSwitchedVector(double[] array)
Sets the vector mounted at start point to the end of reversible track.


getVector3

public javax.vecmath.Vector3d getVector3()
Gets the vector mounted at the end of reversible track.


setVector3

public void setVector3(javax.vecmath.Vector3d v)
Sets the vector mounted at the end of reversible track.


setVector3

public void setVector3(double x,
                       double y,
                       double z)
Sets the vector mounted at the end of reversible track.


setVector3

public void setVector3(double[] array)
Sets the vector mounted at the end of reversible track.


getSwitchedRoll

public double getSwitchedRoll()
Gets the roll at start point of reversible track.


setSwitchedRoll

public void setSwitchedRoll(double d)
Sets the roll at start point of reversible track.


getRoll3

public double getRoll3()
Gets the roll at end point of reversible track.


setRoll3

public void setRoll3(double d)
Sets the roll at end pointof reversible track.


getSwitchedRadius

public double getSwitchedRadius()
Gets radius of reversible track.


setSwitchedRadius

public void setSwitchedRadius(double d)
Sets radius of reversible track.


equals

public boolean equals(java.lang.Object o)
Test if two switches are equal.

Overrides:
equals in class Track
Parameters:
o - Object to check.
Returns:
True if they are.

toString

public java.lang.String toString()
Gets description.

Overrides:
toString in class Track

getToolTip

public java.lang.String getToolTip()
Description copied from interface: Componentable
Contents of component used as a formant.

Specified by:
getToolTip in interface Componentable

getHandles

public java.awt.Point[] getHandles()
Description copied from interface: Componentable
Gets array of points in component coordinates where to put handles.

Specified by:
getHandles in interface Componentable

getRenderedRectangle

public java.awt.Rectangle getRenderedRectangle()
Description copied from interface: Componentable
Gets rectangle where the icon is contained.

Specified by:
getRenderedRectangle in interface Componentable
See Also:
Componentable.paintComponent(java.awt.Graphics)

getAngle

public float getAngle(java.awt.Point p)
Description copied from interface: Componentable
Get rotate angle for specified handle.

Specified by:
getAngle in interface Componentable
Parameters:
p - Handle specified by point coordinates.
See Also:
Componentable.getHandles()

paintComponent

public void paintComponent(java.awt.Graphics g)
Description copied from interface: Componentable
Paints icon of the element on the component.

Specified by:
paintComponent in interface Componentable
Parameters:
g - Graphics to paint.

jET
1.0alpha4