Class TrackSegmentView
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutTrackView
-
- jmri.jmrit.display.layoutEditor.TrackSegmentView
-
- All Implemented Interfaces:
InlineLogixNG
public class TrackSegmentView extends LayoutTrackView
MVC View component for the TrackSegment class.Arrows and bumpers are visual, presentation aspects handled in the View.
-
-
Field Summary
Fields Modifier and Type Field Description static intHIDECONstatic intHIDECONALLstatic intMAX_BUMPER_LENGTHMaximum length of the bumper decoration.static intMAX_BUMPER_WIDTHstatic intMIN_BUMPER_LENGTHstatic intMIN_BUMPER_WIDTHstatic intSHOWCONintshowConstructionLinejava.lang.StringtConnect1Namejava.lang.StringtConnect2Namejava.lang.StringtLayoutBlockName-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
decorations, layoutEditor, NUM_ARROW_TYPES
-
-
Constructor Summary
Constructors Constructor Description TrackSegmentView(TrackSegment track, LayoutEditor layoutEditor)TrackSegmentView(TrackSegment track, LayoutEditor layoutEditor, boolean arc, boolean flip, boolean circle)constructor method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateTrackSegmentAngle()booleancanRemove()Check for active block boundaries.(package private) voidchangeType(int choice)java.util.List<HitPointType>checkForFreeConnections()return a list of the available connections for this layout trackvoidcheckForNonContiguousBlocks(java.util.HashMap<java.lang.String,java.util.List<java.util.Set<java.lang.String>>> blockNamesToTrackNameSetsMap)check this track and its neighbors for non-contiguous blocksbooleancheckForUnAssignedBlocks()determine if all the appropriate blocks have been assigned to this trackvoidcollectContiguousTracksNamesInBlockNamed(java.lang.String blockName, java.util.Set<java.lang.String> TrackNameSet)recursive routine to check for all contiguous tracks in this blockNamevoiddispose()Clean up when this object is no longer needed.protected voiddraw1(java.awt.Graphics2D g2, boolean isMain, boolean isBlock)draw one line (Ballast, ties, center or 3rd rail, block lines)protected voiddraw2(java.awt.Graphics2D g2, boolean isMain, float railDisplacement)draw two lines (rails)protected voiddrawDecorations(java.awt.Graphics2D g2)Draw track decorationsprotected voiddrawEditControls(java.awt.Graphics2D g2)draw the edit controlsprotected voiddrawTurnoutControls(java.awt.Graphics2D g2)Draw the turnout controlsprotected HitPointTypefindHitPointType(java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)find the hit (location) type for a pointdoublegetAngle()java.awt.ColorgetArrowColor()intgetArrowGap()intgetArrowLength()intgetArrowLineWidth()intgetArrowStyle()Arrow decoration accessor.java.awt.geom.Point2DgetBezierControlPoint(int index)java.util.ArrayList<java.awt.geom.Point2D>getBezierControlPoints()java.lang.StringgetBlockName()java.awt.geom.Rectangle2DgetBounds()intgetBridgeApproachWidth()java.awt.ColorgetBridgeColor()intgetBridgeDeckWidth()intgetBridgeLineWidth()java.awt.ColorgetBumperColor()intgetBumperLength()intgetBumperLineWidth()java.awt.geom.Point2DgetCentre()java.awt.geom.Point2DgetCentreSeg()doublegetCentreSegX()doublegetCentreSegY()doublegetCentreX()doublegetCentreY()doublegetCH()doublegetChordLength()LayoutTrackgetConnect1()java.lang.StringgetConnect1Name()LayoutTrackgetConnect2()java.lang.StringgetConnect2Name()LayoutTrackgetConnection(HitPointType connectionType)get the LayoutTrack connected at the specified connection typejava.awt.geom.Point2DgetCoordsCenterCircle()get center coordinatesjava.awt.geom.Point2DgetCoordsForConnectionType(HitPointType connectionType)Get the coordinates for a specified connection type.doublegetCW()doublegetCX()doublegetCY()java.util.Map<java.lang.String,java.lang.String>getDecorations()Get current decorationsdoublegetDirectionDEG()Get the direction from end point 1 to 2.doublegetDirectionRAD()Get the direction from end point 1 to 2.LayoutBlockgetLayoutBlock()protected java.util.List<LayoutConnectivity>getLayoutConnectivity()get the layout connectivity for this trackintgetNumberOfBezierControlPoints()java.util.ArrayList<java.lang.String>getPointReferences(HitPointType type, LayoutTrack conn)doublegetStartAdj()doublegetTmpAngle()java.awt.geom.Point2DgetTmpPt1()java.awt.geom.Point2DgetTmpPt2()TrackSegmentgetTrackSegment()java.awt.ColorgetTunnelColor()intgetTunnelEntranceWidth()intgetTunnelFloorWidth()intgetTunnelLineWidth()HitPointTypegetType1()HitPointTypegetType2()booleanhasDecorations()booleanhideConstructionLines()voidhideConstructionLines(int hide)Method used by LayoutEditor.protected voidhighlightUnconnected(java.awt.Graphics2D g2, HitPointType selectedType)highlight unconnected connectionsbooleanisActive()Get state.booleanisArc()booleanisArrowDirIn()booleanisArrowDirOut()booleanisArrowEndStart()booleanisArrowEndStop()booleanisBezier()booleanisBridgeHasEntry()booleanisBridgeHasExit()booleanisBridgeSideLeft()booleanisBridgeSideRight()booleanisBumperEndStart()booleanisBumperEndStop()booleanisBumperFlipped()booleanisCircle()booleanisDashed()booleanisFlip()booleanisShowConstructionLines()booleanisTunnelHasEntry()booleanisTunnelHasExit()booleanisTunnelSideLeft()booleanisTunnelSideRight()protected voidreCalculateTrackSegmentAngle(double x, double y)voidreCheckBlockBoundary()abstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidremove()Remove this object from display and persistance.booleanreplaceTrackConnection(LayoutTrack oldTrack, LayoutTrack newTrack, HitPointType newType)replace old track connection with new track connectionvoidrotateCoords(double angleDEG)rotate this LayoutTrack's coordinates by angleDEG'svoidscaleCoords(double xFactor, double yFactor)scale this LayoutTrack's coordinates by the x and y factorsvoidsetAllLayoutBlocks(LayoutBlock layoutBlock)Assign all the layout blocks in this trackvoidsetAngle(double x)voidsetArc(boolean boo)voidsetArrowColor(java.awt.Color newVal)voidsetArrowDirIn(boolean newVal)voidsetArrowDirOut(boolean newVal)voidsetArrowEndStart(boolean newVal)voidsetArrowEndStop(boolean newVal)voidsetArrowGap(int newVal)voidsetArrowLength(int newVal)voidsetArrowLineWidth(int newVal)voidsetArrowStyle(int newVal)Set the arrow decoration.voidsetBezier(boolean bool)voidsetBezierControlPoint(java.awt.geom.Point2D p, int index)voidsetBridgeApproachWidth(int newVal)voidsetBridgeColor(java.awt.Color newVal)voidsetBridgeDeckWidth(int newVal)voidsetBridgeHasEntry(boolean newVal)voidsetBridgeHasExit(boolean newVal)voidsetBridgeLineWidth(int newVal)voidsetBridgeSideLeft(boolean newVal)voidsetBridgeSideRight(boolean newVal)voidsetBumperColor(java.awt.Color newVal)voidsetBumperEndStart(boolean newVal)voidsetBumperEndStop(boolean newVal)voidsetBumperFlipped(boolean newVal)voidsetBumperLength(int newVal)voidsetBumperLineWidth(int newVal)voidsetCentreSeg(java.awt.geom.Point2D p)voidsetCentreSegX(double x)voidsetCentreSegY(double y)voidsetCentreX(double x)voidsetCentreY(double y)voidsetCH(double CH)voidsetChordLength(double chord)voidsetCircle(boolean boo)voidsetConnection(HitPointType connectionType, LayoutTrack o, HitPointType type)set the LayoutTrack connected at the specified connection typevoidsetCoordsCenter(java.awt.geom.Point2D newCenterPoint)Set center coordinates.voidsetCoordsCenterCircle(java.awt.geom.Point2D p)set center coordinatesvoidsetCW(double CW)voidsetCX(double CX)voidsetCY(double CY)voidsetDashed(boolean dash)voidsetDecorations(java.util.Map<java.lang.String,java.lang.String> decorations)Set new decorations This is a complete replacement of the decorations, not an appending.voidsetFlip(boolean boo)voidsetLayoutBlock(LayoutBlock newLayoutBlock)Set up a LayoutBlock for this Track Segment.voidsetLayoutBlockByName(java.lang.String name)Set up a LayoutBlock for this Track Segment.protected voidsetNewConnect1(LayoutTrack connectTrack, HitPointType connectionType)set a new connection 1protected voidsetNewConnect2(LayoutTrack connectTrack, HitPointType connectionType)set a new connection 2voidsetStartAdj(double startAdj)voidsetTmpAngle(double a)voidsetTmpPt1(java.awt.geom.Point2D Pt1)voidsetTmpPt2(java.awt.geom.Point2D Pt2)voidsetTunnelColor(java.awt.Color newVal)voidsetTunnelEntranceWidth(int newVal)voidsetTunnelFloorWidth(int newVal)voidsetTunnelHasEntry(boolean newVal)voidsetTunnelHasExit(boolean newVal)voidsetTunnelLineWidth(int newVal)voidsetTunnelSideLeft(boolean newVal)voidsetTunnelSideRight(boolean newVal)protected voidshowBezierPopUp(JmriMouseEvent e, HitPointType hitPointType)Display popup menu for information and editing.protected javax.swing.JPopupMenushowPopup(JmriMouseEvent mouseEvent)show the popup menu for this layout trackvoidsplitTrackSegment()split a track segment into two track segments with an anchor point in between.java.lang.StringtoString()Get debugging string for the TrackSegment.booleantrackNeedsRedraw()Determine if we need to redraw a curved piece of track.voidtrackRedrawn()voidtranslateCoords(double xFactor, double yFactor)translate this LayoutTrack's coordinates by the x and y factorsvoidupdateBlockInfo()-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
addCommonPopupItems, displayRemoveWarningDialog, drawHidden, drawLayoutTrackText, findHitPointType, findHitPointType, getColorForTrackBlock, getColorForTrackBlock, getCoordsCenter, getEditorName, getId, getLayoutEditor, getLayoutEditorToolBarPanel, getLayoutTrack, getLogixNG, getName, getNameString, getTurnoutStateString, getTypeName, getX, getY, highlightUnconnected, isDisconnected, isHidden, loadArrowImageToJCBItem, removeInlineLogixNG, rotatePoint, setColorForTrackBlock, setColorForTrackBlock, setHidden, setIdent, setLogixNG, setLogixNG_SystemName, setLogixNGPositionableMenu, setupLogixNG, showPopup, showPopup, trackControlCircleAt, trackControlCircleRectAt, trackEditControlCircleAt
-
-
-
-
Field Detail
-
tConnect1Name
public java.lang.String tConnect1Name
-
tConnect2Name
public java.lang.String tConnect2Name
-
tLayoutBlockName
public java.lang.String tLayoutBlockName
-
MAX_BUMPER_LENGTH
public static final int MAX_BUMPER_LENGTH
Maximum length of the bumper decoration.- See Also:
- Constant Field Values
-
MIN_BUMPER_LENGTH
public static final int MIN_BUMPER_LENGTH
- See Also:
- Constant Field Values
-
MAX_BUMPER_WIDTH
public static final int MAX_BUMPER_WIDTH
- See Also:
- Constant Field Values
-
MIN_BUMPER_WIDTH
public static final int MIN_BUMPER_WIDTH
- See Also:
- Constant Field Values
-
SHOWCON
public static final int SHOWCON
- See Also:
- Constant Field Values
-
HIDECON
public static final int HIDECON
- See Also:
- Constant Field Values
-
HIDECONALL
public static final int HIDECONALL
- See Also:
- Constant Field Values
-
showConstructionLine
public int showConstructionLine
-
-
Constructor Detail
-
TrackSegmentView
public TrackSegmentView(@Nonnull TrackSegment track, @Nonnull LayoutEditor layoutEditor)
-
TrackSegmentView
public TrackSegmentView(@Nonnull TrackSegment track, @Nonnull LayoutEditor layoutEditor, boolean arc, boolean flip, boolean circle)
constructor method.- Parameters:
track- the track segment to viewlayoutEditor- for reference to toolsarc- specify displayflip- specify displaycircle- specify display
-
-
Method Detail
-
getTrackSegment
@Nonnull public TrackSegment getTrackSegment()
-
toString
public java.lang.String toString()
Get debugging string for the TrackSegment.- Overrides:
toStringin classjava.lang.Object- Returns:
- text showing id and connections of this segment
-
getBlockName
@Nonnull public java.lang.String getBlockName()
-
getType1
public HitPointType getType1()
-
getType2
public HitPointType getType2()
-
getConnect1
public LayoutTrack getConnect1()
-
getConnect2
public LayoutTrack getConnect2()
-
setNewConnect1
protected void setNewConnect1(@CheckForNull LayoutTrack connectTrack, HitPointType connectionType)
set a new connection 1- Parameters:
connectTrack- the track we want to connect toconnectionType- where on that track we want to be connected
-
setNewConnect2
protected void setNewConnect2(@CheckForNull LayoutTrack connectTrack, HitPointType connectionType)
set a new connection 2- Parameters:
connectTrack- the track we want to connect toconnectionType- where on that track we want to be connected
-
replaceTrackConnection
public boolean replaceTrackConnection(@CheckForNull LayoutTrack oldTrack, @CheckForNull LayoutTrack newTrack, HitPointType newType)
replace old track connection with new track connection- Parameters:
oldTrack- the old track connectionnewTrack- the new track connectionnewType- type of the new track connection- Returns:
- true if successful
-
isDashed
public boolean isDashed()
- Returns:
- true if track segment should be drawn dashed
-
setDashed
public void setDashed(boolean dash)
-
isArc
public boolean isArc()
- Returns:
- true if track segment is an arc
-
setArc
public void setArc(boolean boo)
-
isCircle
public boolean isCircle()
- Returns:
- true if track segment is circle
-
setCircle
public void setCircle(boolean boo)
-
isFlip
public boolean isFlip()
- Returns:
- true if track segment circle or arc should be drawn flipped
-
setFlip
public void setFlip(boolean boo)
-
isBezier
public boolean isBezier()
- Returns:
- true if track segment is a bezier curve
-
setBezier
public void setBezier(boolean bool)
- Parameters:
bool- Set true to turn on Bezier curve representation.
-
getAngle
public double getAngle()
-
setAngle
public void setAngle(double x)
-
getDirectionRAD
public double getDirectionRAD()
Get the direction from end point 1 to 2.Note: Goes CW from east (0) to south (PI/2) to west (PI) to north (PI*3/2), etc.
- Returns:
- The direction (in radians)
-
getDirectionDEG
public double getDirectionDEG()
Get the direction from end point 1 to 2.Note: Goes CW from east (0) to south (90) to west (180) to north (270), etc.
- Returns:
- the direction (in degrees)
-
trackNeedsRedraw
public boolean trackNeedsRedraw()
Determine if we need to redraw a curved piece of track. Saves having to recalculate the circle details each time.- Returns:
- true means needs to be (re)drawn
-
trackRedrawn
public void trackRedrawn()
-
getLayoutBlock
public LayoutBlock getLayoutBlock()
-
getConnect1Name
public java.lang.String getConnect1Name()
-
getConnect2Name
public java.lang.String getConnect2Name()
-
getConnection
public LayoutTrack getConnection(HitPointType connectionType) throws JmriException
Description copied from class:LayoutTrackViewget the LayoutTrack connected at the specified connection type- Specified by:
getConnectionin classLayoutTrackView- Parameters:
connectionType- where on us to get the connection- Returns:
- the LayoutTrack connected at the specified connection type
- Throws:
JmriException- - if the connectionType is invalid
-
setConnection
public void setConnection(HitPointType connectionType, @CheckForNull LayoutTrack o, HitPointType type) throws JmriException
set the LayoutTrack connected at the specified connection typeThis implementation does nothing because
setNewConnect1(jmri.jmrit.display.layoutEditor.LayoutTrack, jmri.jmrit.display.layoutEditor.HitPointType)andsetNewConnect2(jmri.jmrit.display.layoutEditor.LayoutTrack, jmri.jmrit.display.layoutEditor.HitPointType)should be used instead.- Specified by:
setConnectionin classLayoutTrackView- Parameters:
connectionType- where on us to set the connectiono- the LayoutTrack that is to be connectedtype- where on the LayoutTrack we are connected- Throws:
JmriException- - if connectionType or type are invalid
-
getNumberOfBezierControlPoints
public int getNumberOfBezierControlPoints()
-
getBezierControlPoint
public java.awt.geom.Point2D getBezierControlPoint(int index)
- Parameters:
index- If negative, this is index from the end i.e. -1 is the last element- Returns:
- Reference to the indexed control point
-
setBezierControlPoint
public void setBezierControlPoint(@CheckForNull java.awt.geom.Point2D p, int index)
- Parameters:
p- the location of the point to be setindex- If negative, this is index from the end i.e. -1 is the last element
-
getBezierControlPoints
@Nonnull public java.util.ArrayList<java.awt.geom.Point2D> getBezierControlPoints()
-
setLayoutBlock
public void setLayoutBlock(@CheckForNull LayoutBlock newLayoutBlock)
Set up a LayoutBlock for this Track Segment.- Parameters:
newLayoutBlock- the LayoutBlock to set
-
setLayoutBlockByName
public void setLayoutBlockByName(@CheckForNull java.lang.String name)
Set up a LayoutBlock for this Track Segment.- Parameters:
name- the name of the new LayoutBlock
-
scaleCoords
public void scaleCoords(double xFactor, double yFactor)
scale this LayoutTrack's coordinates by the x and y factors- Specified by:
scaleCoordsin classLayoutTrackView- Parameters:
xFactor- the amount to scale X coordinatesyFactor- the amount to scale Y coordinates
-
translateCoords
public void translateCoords(double xFactor, double yFactor)
translate this LayoutTrack's coordinates by the x and y factors- Specified by:
translateCoordsin classLayoutTrackView- Parameters:
xFactor- the amount to translate X coordinatesyFactor- the amount to translate Y coordinates
-
rotateCoords
public void rotateCoords(double angleDEG)
rotate this LayoutTrack's coordinates by angleDEG's- Specified by:
rotateCoordsin classLayoutTrackView- Parameters:
angleDEG- the amount to rotate in degrees
-
setCoordsCenter
public void setCoordsCenter(@Nonnull java.awt.geom.Point2D newCenterPoint)
Set center coordinates.- Overrides:
setCoordsCenterin classLayoutTrackView- Parameters:
newCenterPoint- the coordinates to set
-
updateBlockInfo
public void updateBlockInfo()
-
findHitPointType
protected HitPointType findHitPointType(java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)
find the hit (location) type for a point- Specified by:
findHitPointTypein classLayoutTrackView- Parameters:
hitPoint- the pointuseRectangles- whether to use (larger) rectangles or (smaller) circles for hit testingrequireUnconnected- whether to only return hit types for free connections- Returns:
- the location type for the point (or NONE)
-
getCoordsForConnectionType
public java.awt.geom.Point2D getCoordsForConnectionType(HitPointType connectionType)
Get the coordinates for a specified connection type.- Specified by:
getCoordsForConnectionTypein classLayoutTrackView- Parameters:
connectionType- the connection type- Returns:
- the coordinates for the specified connection type
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
- Specified by:
getBoundsin classLayoutTrackView- Returns:
- the bounds of this track segment
-
showPopup
@Nonnull protected javax.swing.JPopupMenu showPopup(@Nonnull JmriMouseEvent mouseEvent)
show the popup menu for this layout track- Specified by:
showPopupin classLayoutTrackView- Parameters:
mouseEvent- the mouse down event that triggered this popup- Returns:
- the popup menu for this layout track
-
canRemove
public boolean canRemove()
Check for active block boundaries.If any connection point of a layout track object has attached objects, such as signal masts, signal heads or NX sensors, the layout track object cannot be deleted.
- Specified by:
canRemovein classLayoutTrackView- Returns:
- true if the layout track object can be deleted.
-
getPointReferences
public java.util.ArrayList<java.lang.String> getPointReferences(HitPointType type, LayoutTrack conn)
-
splitTrackSegment
public void splitTrackSegment()
split a track segment into two track segments with an anchor point in between.
-
showBezierPopUp
protected void showBezierPopUp(JmriMouseEvent e, HitPointType hitPointType)
Display popup menu for information and editing.- Parameters:
e- The original event causing thishitPointType- the type of the underlying hit
-
changeType
void changeType(int choice)
-
dispose
public void dispose()
Clean up when this object is no longer needed.Should not be called while the object is still displayed.
- See Also:
remove()
-
remove
public void remove()
Remove this object from display and persistance.
-
isActive
public boolean isActive()
Get state. "active" means that the object is still displayed, and should be stored.- Returns:
- true if active
-
isShowConstructionLines
public boolean isShowConstructionLines()
- Returns:
- true if HIDECON is not set and HIDECONALL is not set
-
hideConstructionLines
public void hideConstructionLines(int hide)
Method used by LayoutEditor.If the argument is
- HIDECONALL then set HIDECONALL
- SHOWCON reset HIDECONALL is set, other wise set SHOWCON
- HIDECON or otherwise set HIDECON
- Parameters:
hide- The specification i.e. HIDECONALL, SHOWCON et al
-
hideConstructionLines
public boolean hideConstructionLines()
- Returns:
- true if SHOWCON is not set
-
getTmpPt1
public java.awt.geom.Point2D getTmpPt1()
-
getTmpPt2
public java.awt.geom.Point2D getTmpPt2()
-
setTmpPt1
public void setTmpPt1(java.awt.geom.Point2D Pt1)
-
setTmpPt2
public void setTmpPt2(java.awt.geom.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)
-
getCentreSegX
public double getCentreSegX()
-
setCentreSegX
public void setCentreSegX(double x)
-
getCentreSegY
public double getCentreSegY()
-
setCentreSegY
public void setCentreSegY(double y)
-
getCentreSeg
public java.awt.geom.Point2D getCentreSeg()
- Returns:
- the location of the middle of the segment (on the segment)
-
setCentreSeg
public void setCentreSeg(java.awt.geom.Point2D p)
-
getCentreX
public double getCentreX()
-
setCentreX
public void setCentreX(double x)
-
getCentreY
public double getCentreY()
-
setCentreY
public void setCentreY(double y)
-
getCentre
public java.awt.geom.Point2D getCentre()
-
getTmpAngle
public double getTmpAngle()
-
setTmpAngle
public void setTmpAngle(double a)
-
getCoordsCenterCircle
public java.awt.geom.Point2D getCoordsCenterCircle()
get center coordinates- Returns:
- the center coordinates
-
setCoordsCenterCircle
public void setCoordsCenterCircle(java.awt.geom.Point2D p)
set center coordinates- Parameters:
p- the coordinates to set
-
getChordLength
public double getChordLength()
-
setChordLength
public void setChordLength(double chord)
-
reCalculateTrackSegmentAngle
protected void reCalculateTrackSegmentAngle(double x, double y)
-
calculateTrackSegmentAngle
protected void calculateTrackSegmentAngle()
-
draw1
protected void draw1(java.awt.Graphics2D g2, boolean isMain, boolean isBlock)
draw one line (Ballast, ties, center or 3rd rail, block lines)- Specified by:
draw1in classLayoutTrackView- Parameters:
g2- the graphics contextisMain- true if drawing mainlinesisBlock- true if drawing block lines
-
draw2
protected void draw2(java.awt.Graphics2D g2, boolean isMain, float railDisplacement)
draw two lines (rails)- Specified by:
draw2in classLayoutTrackView- Parameters:
g2- the graphics contextisMain- true if drawing mainlinesrailDisplacement- the offset from center to draw the lines
-
highlightUnconnected
protected void highlightUnconnected(java.awt.Graphics2D g2, HitPointType selectedType)
highlight unconnected connections- Specified by:
highlightUnconnectedin classLayoutTrackView- Parameters:
g2- the graphics contextselectedType- the specific connection to draw (or NONE for all)
-
drawEditControls
protected void drawEditControls(java.awt.Graphics2D g2)
Description copied from class:LayoutTrackViewdraw the edit controls- Specified by:
drawEditControlsin classLayoutTrackView- Parameters:
g2- the graphics context
-
drawTurnoutControls
protected void drawTurnoutControls(java.awt.Graphics2D g2)
Description copied from class:LayoutTrackViewDraw the turnout controls- Specified by:
drawTurnoutControlsin classLayoutTrackView- Parameters:
g2- the graphics context
-
reCheckBlockBoundary
public void reCheckBlockBoundary()
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundaryin classLayoutTrackView
-
drawDecorations
protected void drawDecorations(java.awt.Graphics2D g2)
Draw track decorations- Specified by:
drawDecorationsin classLayoutTrackView- Parameters:
g2- the graphics context
-
hasDecorations
public boolean hasDecorations()
- Overrides:
hasDecorationsin classLayoutTrackView- Returns:
- true if this track segment has decorations
-
getDecorations
public java.util.Map<java.lang.String,java.lang.String> getDecorations()
Get current decorations- Overrides:
getDecorationsin classLayoutTrackView- Returns:
- the decorations
-
setDecorations
public void setDecorations(@Nonnull java.util.Map<java.lang.String,java.lang.String> decorations)
Set new decorations This is a complete replacement of the decorations, not an appending.- Overrides:
setDecorationsin classLayoutTrackView- Parameters:
decorations- A map from strings ("arrow", "bridge", "bumper",..) to specific value strings ("single", "entry;right", ), perhaps including multiple values separated by semicolons.
-
getArrowStyle
public int getArrowStyle()
Arrow decoration accessor. The 0 (none) and 1 through 5 arrow decorations are keyed to files like program:resources/icons/decorations/ArrowStyle1.png et al.- Returns:
- Style number
-
setArrowStyle
public void setArrowStyle(int newVal)
Set the arrow decoration. The 0 (none) and 1 through 5 arrow decorations are keyed to files like program:resources/icons/decorations/ArrowStyle1.png et al.- Parameters:
newVal- the new style number
-
isArrowEndStart
public boolean isArrowEndStart()
-
setArrowEndStart
public void setArrowEndStart(boolean newVal)
-
isArrowEndStop
public boolean isArrowEndStop()
-
setArrowEndStop
public void setArrowEndStop(boolean newVal)
-
isArrowDirIn
public boolean isArrowDirIn()
-
setArrowDirIn
public void setArrowDirIn(boolean newVal)
-
isArrowDirOut
public boolean isArrowDirOut()
-
setArrowDirOut
public void setArrowDirOut(boolean newVal)
-
getArrowColor
public java.awt.Color getArrowColor()
-
setArrowColor
public void setArrowColor(java.awt.Color newVal)
-
getArrowLineWidth
public int getArrowLineWidth()
-
setArrowLineWidth
public void setArrowLineWidth(int newVal)
-
getArrowLength
public int getArrowLength()
-
setArrowLength
public void setArrowLength(int newVal)
-
getArrowGap
public int getArrowGap()
-
setArrowGap
public void setArrowGap(int newVal)
-
isBridgeSideRight
public boolean isBridgeSideRight()
-
setBridgeSideRight
public void setBridgeSideRight(boolean newVal)
-
isBridgeSideLeft
public boolean isBridgeSideLeft()
-
setBridgeSideLeft
public void setBridgeSideLeft(boolean newVal)
-
isBridgeHasEntry
public boolean isBridgeHasEntry()
-
setBridgeHasEntry
public void setBridgeHasEntry(boolean newVal)
-
isBridgeHasExit
public boolean isBridgeHasExit()
-
setBridgeHasExit
public void setBridgeHasExit(boolean newVal)
-
getBridgeColor
public java.awt.Color getBridgeColor()
-
setBridgeColor
public void setBridgeColor(java.awt.Color newVal)
-
getBridgeDeckWidth
public int getBridgeDeckWidth()
-
setBridgeDeckWidth
public void setBridgeDeckWidth(int newVal)
-
getBridgeLineWidth
public int getBridgeLineWidth()
-
setBridgeLineWidth
public void setBridgeLineWidth(int newVal)
-
getBridgeApproachWidth
public int getBridgeApproachWidth()
-
setBridgeApproachWidth
public void setBridgeApproachWidth(int newVal)
-
isBumperEndStart
public boolean isBumperEndStart()
-
setBumperEndStart
public void setBumperEndStart(boolean newVal)
-
isBumperEndStop
public boolean isBumperEndStop()
-
setBumperEndStop
public void setBumperEndStop(boolean newVal)
-
getBumperColor
public java.awt.Color getBumperColor()
-
setBumperColor
public void setBumperColor(java.awt.Color newVal)
-
getBumperLineWidth
public int getBumperLineWidth()
-
setBumperLineWidth
public void setBumperLineWidth(int newVal)
-
getBumperLength
public int getBumperLength()
-
setBumperLength
public void setBumperLength(int newVal)
-
isBumperFlipped
public boolean isBumperFlipped()
-
setBumperFlipped
public void setBumperFlipped(boolean newVal)
-
isTunnelSideRight
public boolean isTunnelSideRight()
-
setTunnelSideRight
public void setTunnelSideRight(boolean newVal)
-
isTunnelSideLeft
public boolean isTunnelSideLeft()
-
setTunnelSideLeft
public void setTunnelSideLeft(boolean newVal)
-
isTunnelHasEntry
public boolean isTunnelHasEntry()
-
setTunnelHasEntry
public void setTunnelHasEntry(boolean newVal)
-
isTunnelHasExit
public boolean isTunnelHasExit()
-
setTunnelHasExit
public void setTunnelHasExit(boolean newVal)
-
getTunnelColor
public java.awt.Color getTunnelColor()
-
setTunnelColor
public void setTunnelColor(java.awt.Color newVal)
-
getTunnelFloorWidth
public int getTunnelFloorWidth()
-
setTunnelFloorWidth
public void setTunnelFloorWidth(int newVal)
-
getTunnelLineWidth
public int getTunnelLineWidth()
-
setTunnelLineWidth
public void setTunnelLineWidth(int newVal)
-
getTunnelEntranceWidth
public int getTunnelEntranceWidth()
-
setTunnelEntranceWidth
public void setTunnelEntranceWidth(int newVal)
-
getLayoutConnectivity
@Nonnull protected java.util.List<LayoutConnectivity> getLayoutConnectivity()
get the layout connectivity for this track- Specified by:
getLayoutConnectivityin classLayoutTrackView- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
@Nonnull public java.util.List<HitPointType> checkForFreeConnections()
return a list of the available connections for this layout track- Specified by:
checkForFreeConnectionsin classLayoutTrackView- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
public boolean checkForUnAssignedBlocks()
determine if all the appropriate blocks have been assigned to this track- Specified by:
checkForUnAssignedBlocksin classLayoutTrackView- Returns:
- true if all appropriate blocks have been assigned
-
checkForNonContiguousBlocks
public void checkForNonContiguousBlocks(@Nonnull java.util.HashMap<java.lang.String,java.util.List<java.util.Set<java.lang.String>>> blockNamesToTrackNameSetsMap)
check this track and its neighbors for non-contiguous blocksFor each (non-null) blocks of this track do: #1) If it's got an entry in the blockNamesToTrackNameSetMap then #2) If this track is not in one of the TrackNameSets for this block #3) add a new set (with this block/track) to blockNamesToTrackNameSetMap and #4) check all the connections in this block (by calling the 2nd method below)
Basically, we're maintaining contiguous track sets for each block found (in blockNamesToTrackNameSetMap)
- Specified by:
checkForNonContiguousBlocksin classLayoutTrackView- Parameters:
blockNamesToTrackNameSetsMap- hashmap of key:block names to lists of track name sets for those blocks
-
collectContiguousTracksNamesInBlockNamed
public void collectContiguousTracksNamesInBlockNamed(@Nonnull java.lang.String blockName, @Nonnull java.util.Set<java.lang.String> TrackNameSet)
recursive routine to check for all contiguous tracks in this blockName- Specified by:
collectContiguousTracksNamesInBlockNamedin classLayoutTrackView- Parameters:
blockName- the block that we're checking forTrackNameSet- the set of track names in this block
-
setAllLayoutBlocks
public void setAllLayoutBlocks(LayoutBlock layoutBlock)
Assign all the layout blocks in this track- Specified by:
setAllLayoutBlocksin classLayoutTrackView- Parameters:
layoutBlock- to this layout block (used by the Tools menu's "Assign block to selection" item)
-
-