jmri.jmrit.display.layoutEditor
Class LayoutTurntable

java.lang.Object
  extended by jmri.jmrit.display.layoutEditor.LayoutTurntable

public class LayoutTurntable
extends Object

A LayoutTurntable is a representation used by LayoutEditor to display a turntable.

A LayoutTurntable has a variable number of connection points, called RayTracks, each radiating from the center of the turntable. Each of these points should be connected to a TrackSegment.

Each radiating segment (RayTrack) gets its Block information from its connected track segment.

Each radiating segment (RayTrack) has a unique connection index. The connection index is set when the RayTrack is created, and cannot be changed. This connection index is used to maintain the identity of the radiating segment to its connected Track Segment as ray tracks are added and deleted by the user.

The radius of the turntable circle is variable by the user.

Each radiating segment (RayTrack) connecting point is a fixed distance from the center of the turntable. The user may vary the angle of the radiating segment. Angles are measured from the vertical (12 o'clock) position in a clockwise manner. For example, 30 degrees is 1 o'clock, 60 degrees is 2 o'clock, 90 degrees is 3 o'clock, etc.

Each radiating segment is drawn from its connection point to the turntable circle in the direction of the turntable center.

Author:
Dave Duchamp Copyright (c) 2007

Constructor Summary
LayoutTurntable(String id, Point2D c, LayoutEditor myPanel)
          constructor method
 
Method Summary
protected  jmri.jmrit.display.layoutEditor.LayoutTurntable.RayTrack addRay(double angle)
           
 void addRayTrack(double angle, int index, String name)
           
 double diffAngle(double a, double b)
           
protected  void editTurntable(LayoutTurntable x)
          Edit a Turntable
 Point2D getCoordsCenter()
           
 String getID()
          Accessor methods
 int getNumberRays()
           
 double getRadius()
           
 double getRayAngle(int i)
           
 TrackSegment getRayConnectIndexed(int index)
           
 TrackSegment getRayConnectOrdered(int i)
           
 Point2D getRayCoordsIndexed(int index)
           
 Point2D getRayCoordsOrdered(int i)
           
 int getRayIndex(int i)
           
 boolean isActive()
          "active" means that the object is still displayed, and should be stored.
 boolean isMainlineIndexed(int index)
          Methods to test if ray is a mainline track or not Returns true if connecting track segment is mainline Defaults to not mainline if connecting track segment is missing
 boolean isMainlineOrdered(int i)
           
 double normalizeAngle(double a)
           
 void scaleCoords(float xFactor, float yFactor)
           
 void setCoordsCenter(Point2D p)
          Modify coordinates methods
 void setObjects(LayoutEditor p)
          Initialization method The name of each track segment connected to a ray track is initialized by by LayoutTurntableXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects.
 void setRadius(double r)
           
 void setRayConnect(TrackSegment tr, int index)
           
 void setRayCoordsIndexed(double x, double y, int index)
           
protected  void showPopUp(MouseEvent e)
          Display popup menu for information and editing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutTurntable

public LayoutTurntable(String id,
                       Point2D c,
                       LayoutEditor myPanel)
constructor method

Method Detail

getID

public String getID()
Accessor methods


getCoordsCenter

public Point2D getCoordsCenter()

getRadius

public double getRadius()

setRadius

public void setRadius(double r)

addRay

protected jmri.jmrit.display.layoutEditor.LayoutTurntable.RayTrack addRay(double angle)

addRayTrack

public void addRayTrack(double angle,
                        int index,
                        String name)

getRayConnectIndexed

public TrackSegment getRayConnectIndexed(int index)

getRayConnectOrdered

public TrackSegment getRayConnectOrdered(int i)

setRayConnect

public void setRayConnect(TrackSegment tr,
                          int index)

getNumberRays

public int getNumberRays()

getRayIndex

public int getRayIndex(int i)

getRayAngle

public double getRayAngle(int i)

getRayCoordsIndexed

public Point2D getRayCoordsIndexed(int index)

getRayCoordsOrdered

public Point2D getRayCoordsOrdered(int i)

setRayCoordsIndexed

public void setRayCoordsIndexed(double x,
                                double y,
                                int index)

isMainlineIndexed

public boolean isMainlineIndexed(int index)
Methods to test if ray is a mainline track or not Returns true if connecting track segment is mainline Defaults to not mainline if connecting track segment is missing


isMainlineOrdered

public boolean isMainlineOrdered(int i)

setCoordsCenter

public void setCoordsCenter(Point2D p)
Modify coordinates methods


scaleCoords

public void scaleCoords(float xFactor,
                        float yFactor)

setObjects

public void setObjects(LayoutEditor p)
Initialization method The name of each track segment connected to a ray track is initialized by by LayoutTurntableXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects.


showPopUp

protected void showPopUp(MouseEvent e)
Display popup menu for information and editing


editTurntable

protected void editTurntable(LayoutTurntable x)
Edit a Turntable


isActive

public boolean isActive()
"active" means that the object is still displayed, and should be stored.


normalizeAngle

public double normalizeAngle(double a)

diffAngle

public double diffAngle(double a,
                        double b)


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads