jmri.jmrit.display.layoutEditor
Class TrackSegment

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

public class TrackSegment
extends Object

TrackSegment is a segment of track on a layout linking two nodes of the layout. A node may be a LayoutTurnout, a LevelXing or a PositionablePoint.

PositionablePoints have 1 or 2 connection points. LayoutTurnouts have 3 or 4 (crossovers) connection points, designated A, B, C, and D. LevelXing's have 4 connection points, designated A, B, C, and D.

TrackSegments carry the connectivity information between the three types of nodes. Track Segments serve as the lines in a graph which shows layout connectivity. For the connectivity graph to be valid, all connections between nodes must be via TrackSegments.

TrackSegments carry Block information, as do LayoutTurnouts and LevelXings.

TrackSegments may be drawn as dashed lines or solid lines. In addition TrackSegments may be hidden when the panel is not in EditMode.

Author:
Dave Duchamp Copyright (c) 2004-2009

Field Summary
 String tBlockName
           
 String tConnect1Name
           
 String tConnect2Name
           
 
Constructor Summary
TrackSegment(String id, Object c1, int t1, Object c2, int t2, boolean dash, boolean main, LayoutEditor myPanel)
           
TrackSegment(String id, String c1Name, int t1, String c2Name, int t2, boolean dash, boolean main, boolean hide, LayoutEditor myPanel)
           
 
Method Summary
protected  void editTrackSegment()
          Edit a Track Segment
 double getAngle()
           
 boolean getArc()
           
 String getBlockName()
           
 double getCentreX()
           
 double getCentreY()
           
 double getCH()
           
 double getChordLength()
           
 boolean getCircle()
           
 Object getConnect1()
           
 String getConnect1Name()
           
 Object getConnect2()
           
 String getConnect2Name()
           
 Point2D getCoordsCenterCircle()
           
 double getCW()
           
 double getCX()
           
 double getCY()
           
 boolean getDashed()
           
 boolean getFlip()
           
 boolean getHidden()
           
 String getID()
          Accessor methods
 LayoutBlock getLayoutBlock()
           
 boolean getMainline()
           
 double getStartadj()
           
 double getTmpAngle()
           
 Point2D getTmpPt1()
           
 Point2D getTmpPt2()
           
 int getType1()
           
 int getType2()
           
 boolean isActive()
          "active" means that the object is still displayed, and should be stored.
 void setAngle(double x)
           
 void setArc(boolean boo)
           
 void setCentreX(double CentreX)
           
 void setCentreY(double CentreY)
           
 void setCH(double CH)
           
 void setChordLength(double chord)
           
 void setCircle(boolean boo)
           
 void setCW(double CW)
           
 void setCX(double CX)
           
 void setCY(double CY)
           
 void setDashed(boolean dash)
           
 void setFlip(boolean boo)
           
 void setHidden(boolean hide)
           
 void setLayoutBlock(LayoutBlock b)
          Set Up a Layout Block for a Track Segment
 void setLayoutBlockByName(String name)
           
 void setMainline(boolean main)
           
 void setObjects(LayoutEditor p)
          Initialization method The above variables are initialized by PositionablePointXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects.
 void setStartadj(double Startadj)
           
 void setTmpAngle(double TmpAngle)
           
 void setTmpPt1(Point2D Pt1)
           
 void setTmpPt2(Point2D Pt2)
           
protected  void showPopUp(MouseEvent e)
          Display popup menu for information and editing
 boolean trackNeedsRedraw()
           
 void trackRedrawn()
           
protected  void updateBlockInfo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tBlockName

public String tBlockName

tConnect1Name

public String tConnect1Name

tConnect2Name

public String tConnect2Name
Constructor Detail

TrackSegment

public TrackSegment(String id,
                    Object c1,
                    int t1,
                    Object c2,
                    int t2,
                    boolean dash,
                    boolean main,
                    LayoutEditor myPanel)

TrackSegment

public TrackSegment(String id,
                    String c1Name,
                    int t1,
                    String c2Name,
                    int t2,
                    boolean dash,
                    boolean main,
                    boolean hide,
                    LayoutEditor myPanel)
Method Detail

getID

public String getID()
Accessor methods


getBlockName

public String getBlockName()

getType1

public int getType1()

getType2

public int getType2()

getConnect1

public Object getConnect1()

getConnect2

public Object getConnect2()

getDashed

public boolean getDashed()

setDashed

public void setDashed(boolean dash)

getHidden

public boolean getHidden()

setHidden

public void setHidden(boolean hide)

getMainline

public boolean getMainline()

setMainline

public void setMainline(boolean main)

getArc

public boolean getArc()

setArc

public void setArc(boolean boo)

getCircle

public boolean getCircle()

setCircle

public void setCircle(boolean boo)

getFlip

public boolean getFlip()

setFlip

public void setFlip(boolean boo)

getAngle

public double getAngle()

setAngle

public void setAngle(double x)

trackNeedsRedraw

public boolean trackNeedsRedraw()

trackRedrawn

public void trackRedrawn()

getLayoutBlock

public LayoutBlock getLayoutBlock()

getConnect1Name

public String getConnect1Name()

getConnect2Name

public String getConnect2Name()

setObjects

public void setObjects(LayoutEditor p)
Initialization method The above variables are initialized by PositionablePointXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects.


setLayoutBlock

public void setLayoutBlock(LayoutBlock b)
Set Up a Layout Block for a Track Segment


setLayoutBlockByName

public void setLayoutBlockByName(String name)

updateBlockInfo

protected void updateBlockInfo()

showPopUp

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


editTrackSegment

protected void editTrackSegment()
Edit a Track Segment


isActive

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


getTmpPt1

public Point2D getTmpPt1()

getTmpPt2

public Point2D getTmpPt2()

setTmpPt1

public void setTmpPt1(Point2D Pt1)

setTmpPt2

public void setTmpPt2(Point2D Pt2)

getCX

public double getCX()

setCX

public void setCX(double CX)

getCY

public double getCY()

setCY

public void setCY(double CY)

getCW

public double getCW()

setCW

public void setCW(double CW)

getCH

public double getCH()

setCH

public void setCH(double CH)

getStartadj

public double getStartadj()

setStartadj

public void setStartadj(double Startadj)

getCentreX

public double getCentreX()

setCentreX

public void setCentreX(double CentreX)

getCentreY

public double getCentreY()

setCentreY

public void setCentreY(double CentreY)

getTmpAngle

public double getTmpAngle()

setTmpAngle

public void setTmpAngle(double TmpAngle)

getCoordsCenterCircle

public Point2D getCoordsCenterCircle()

getChordLength

public double getChordLength()

setChordLength

public void setChordLength(double chord)


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