Package jmri.jmrit.display.layoutEditor
Class LayoutSlipView
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutTrackView
-
- jmri.jmrit.display.layoutEditor.LayoutTurnoutView
-
- jmri.jmrit.display.layoutEditor.LayoutSlipView
-
- All Implemented Interfaces:
InlineLogixNG
- Direct Known Subclasses:
LayoutDoubleSlipView
,LayoutSingleSlipView
public class LayoutSlipView extends LayoutTurnoutView
MVC View component for the LayoutSlip class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LayoutSlipView.TurnoutState
-
Field Summary
Fields Modifier and Type Field Description int
currentState
(package private) javax.swing.JPopupMenu
popup
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnoutView
connectAName, connectBName, connectCName, connectDName, dispA, dispB, editAdditionalMenu, editor, INCONSISTENT, namedLayoutBlockA, namedLayoutBlockB, namedLayoutBlockC, namedLayoutBlockD, namedTurnout, pointA, pointB, pointC, pointD, secondNamedTurnout, signalA1HeadNamed, signalA2HeadNamed, signalA3HeadNamed, signalB1HeadNamed, signalB2HeadNamed, signalC1HeadNamed, signalC2HeadNamed, signalD1HeadNamed, signalD2HeadNamed, STATE_AC, STATE_AD, STATE_BC, STATE_BD, tBlockAName, tBlockBName, tBlockCName, tBlockDName, turnoutBXDefault, turnoutCXDefault, turnoutWidDefault, UNKNOWN, viewAdditionalMenu, xOverHWidDefault, xOverLongDefault, xOverShortDefault
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
decorations, layoutEditor, NUM_ARROW_TYPES
-
-
Constructor Summary
Constructors Constructor Description LayoutSlipView(LayoutSlip slip, java.awt.geom.Point2D c, double rot, LayoutEditor layoutEditor)
Constructor method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<HitPointType>
checkForFreeConnections()
return a list of the available connections for this layout trackvoid
dispose()
Clean up when this object is no longer needed.protected void
draw1(java.awt.Graphics2D g2, boolean drawMain, boolean isBlock)
draw one line (Ballast, ties, center or 3rd rail, block lines)protected void
draw2(java.awt.Graphics2D g2, boolean drawMain, float railDisplacement)
draw two lines (rails)protected void
drawTurnoutControls(java.awt.Graphics2D g2)
Draw the turnout controlsprotected HitPointType
findHitPointType(java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)
find the hit (location) type for a pointjava.lang.String[]
getBlockBoundaries()
java.awt.geom.Rectangle2D
getBounds()
LayoutTrack
getConnection(HitPointType connectionType)
get the LayoutTrack connected at the specified connection typeprotected int
getConnectivityStateForLayoutBlocks(LayoutBlock thisLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress)
java.awt.geom.Point2D
getCoordsA()
java.awt.geom.Point2D
getCoordsB()
java.awt.geom.Point2D
getCoordsC()
java.awt.geom.Point2D
getCoordsD()
java.awt.geom.Point2D
getCoordsForConnectionType(HitPointType connectionType)
return the coordinates for the specified connection type(package private) java.awt.geom.Point2D
getCoordsLeft()
(package private) java.awt.geom.Point2D
getCoordsRight()
java.lang.String
getDisplayName()
protected java.util.List<LayoutConnectivity>
getLayoutConnectivity()
get the layout connectivity for this trackLayoutSlip
getSlip()
int
getSlipState()
LayoutTurnout.TurnoutType
getSlipType()
Turnout
getTurnoutB()
java.lang.String
getTurnoutBName()
int
getTurnoutBState(int state)
int
getTurnoutState(int state)
int
getTurnoutState(Turnout turn, int state)
protected void
highlightUnconnected(java.awt.Graphics2D g2, HitPointType specificType)
highlight unconnected connectionsvoid
reCheckBlockBoundary()
abstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoid
remove()
Removes this object from display and persistancevoid
setConnection(HitPointType connectionType, LayoutTrack o, HitPointType type)
set the LayoutTrack connected at the specified connection typevoid
setCoordsA(java.awt.geom.Point2D p)
void
setCoordsB(java.awt.geom.Point2D p)
void
setCoordsC(java.awt.geom.Point2D p)
void
setCoordsCenter(java.awt.geom.Point2D p)
set center coordinatesvoid
setCoordsD(java.awt.geom.Point2D p)
void
setTurnoutB(java.lang.String tName)
void
setTurnoutStates(int state, java.lang.String turnStateA, java.lang.String turnStateB)
protected javax.swing.JPopupMenu
showPopup(JmriMouseEvent mouseEvent)
show the popup menu for this layout trackvoid
toggleState(HitPointType selectedPointType)
Toggle slip states if clicked on, physical turnout exists, and not disabledjava.lang.String
toString()
void
updateBlockInfo()
-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnoutView
addEditPopUpMenu, addViewPopUpMenu, canRemove, checkForNonContiguousBlocks, checkForUnAssignedBlocks, collectContiguousTracksNamesInBlockNamed, drawDecorations, drawEditControls, getBeanReferences, getBlockBName, getBlockCName, getBlockDName, getBlockName, getConnectA, getConnectB, getConnectC, getConnectD, getContinuingSense, getLayoutBlock, getLayoutBlockB, getLayoutBlockC, getLayoutBlockD, getLayoutTurnout, getLinkedTurnoutName, getLinkType, getProtectedBlocks, getRotationDEG, getSecondTurnout, getSecondTurnoutName, getSensorA, getSensorAName, getSensorB, getSensorBName, getSensorC, getSensorCName, getSensorD, getSensorDName, getSignalA1, getSignalA1Name, getSignalA2, getSignalA2Name, getSignalA3, getSignalA3Name, getSignalAMast, getSignalAMastName, getSignalB1, getSignalB1Name, getSignalB2, getSignalB2Name, getSignalBMast, getSignalBMastName, getSignalC1, getSignalC1Name, getSignalC2, getSignalC2Name, getSignalCMast, getSignalCMastName, getSignalD1, getSignalD1Name, getSignalD2, getSignalD2Name, getSignalDMast, getSignalDMastName, getSignalHead, getState, getTurnout, getTurnoutName, getTurnoutType, getVersion, hasEnteringDoubleTrack, hasEnteringDoubleTrack, hasEnteringSingleTrack, hasEnteringSingleTrack, isActive, isDisabled, isDisabledWhenOccupied, isInContinuingSenseState, isMainlineA, isMainlineB, isMainlineC, isMainlineD, isTurnoutTypeSlip, isTurnoutTypeSlip, isTurnoutTypeTurnout, isTurnoutTypeTurnout, isTurnoutTypeXover, isTurnoutTypeXover, reCalculateCenter, removeBeanReference, removeSML, rotateCoords, scaleCoords, setAdditionalEditPopUpMenu, setAdditionalViewPopUpMenu, setAllLayoutBlocks, setConnectA, setConnectB, setConnectC, setConnectD, setContinuingSense, setDisabled, setDisableWhenOccupied, setLayoutBlock, setLayoutBlockB, setLayoutBlockBByName, setLayoutBlockByName, setLayoutBlockC, setLayoutBlockCByName, setLayoutBlockD, setLayoutBlockDByName, setLinkedTurnoutName, setLinkType, setSecondTurnout, setSecondTurnoutInverted, setSensorA, setSensorB, setSensorC, setSensorD, setSignalA1Name, setSignalA2Name, setSignalA3Name, setSignalAMast, setSignalB1Name, setSignalB2Name, setSignalBMast, setSignalC1Name, setSignalC2Name, setSignalCMast, setSignalD1Name, setSignalD2Name, setSignalDMast, setState, setTrackSegmentBlock, setTrackSegmentBlocks, setTurnout, setUpDefaultSize, setVersion, toggleTurnout, translateCoords, useBlockSpeed
-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
addCommonPopupItems, displayRemoveWarningDialog, drawHidden, drawLayoutTrackText, findHitPointType, findHitPointType, getColorForTrackBlock, getColorForTrackBlock, getCoordsCenter, getDecorations, getEditorName, getId, getLayoutEditor, getLayoutEditorToolBarPanel, getLayoutTrack, getLogixNG, getName, getNameString, getTurnoutStateString, getTypeName, getX, getY, hasDecorations, highlightUnconnected, isDisconnected, isHidden, loadArrowImageToJCBItem, removeInlineLogixNG, rotatePoint, setColorForTrackBlock, setColorForTrackBlock, setDecorations, setHidden, setIdent, setLogixNG, setLogixNG_SystemName, setLogixNGPositionableMenu, setupLogixNG, showPopup, showPopup, trackControlCircleAt, trackControlCircleRectAt, trackEditControlCircleAt
-
-
-
-
Field Detail
-
currentState
public int currentState
-
popup
javax.swing.JPopupMenu popup
-
-
Constructor Detail
-
LayoutSlipView
public LayoutSlipView(@Nonnull LayoutSlip slip, java.awt.geom.Point2D c, double rot, @Nonnull LayoutEditor layoutEditor)
Constructor method.- Parameters:
slip
- the layout sip to create view for.c
- 2D point.rot
- rotation.layoutEditor
- the layout editor.
-
-
Method Detail
-
getSlip
public LayoutSlip getSlip()
-
toString
public java.lang.String toString()
Description copied from class:LayoutTurnoutView
- Overrides:
toString
in classLayoutTurnoutView
-
getSlipType
public LayoutTurnout.TurnoutType getSlipType()
-
getSlipState
public int getSlipState()
-
getTurnoutBName
public java.lang.String getTurnoutBName()
-
getTurnoutB
public Turnout getTurnoutB()
-
setTurnoutB
public void setTurnoutB(@CheckForNull java.lang.String tName)
-
getConnection
public LayoutTrack getConnection(HitPointType connectionType) throws JmriException
get the LayoutTrack connected at the specified connection type- Overrides:
getConnection
in classLayoutTurnoutView
- 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 type- Overrides:
setConnection
in classLayoutTurnoutView
- 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
-
getDisplayName
public java.lang.String getDisplayName()
-
toggleState
public void toggleState(HitPointType selectedPointType)
Toggle slip states if clicked on, physical turnout exists, and not disabled- Parameters:
selectedPointType
- SeeLayoutSlip.toggleState(jmri.jmrit.display.layoutEditor.HitPointType)
for definition
-
getCoordsA
public java.awt.geom.Point2D getCoordsA()
- Overrides:
getCoordsA
in classLayoutTurnoutView
-
getCoordsB
public java.awt.geom.Point2D getCoordsB()
- Overrides:
getCoordsB
in classLayoutTurnoutView
-
getCoordsC
public java.awt.geom.Point2D getCoordsC()
- Overrides:
getCoordsC
in classLayoutTurnoutView
-
getCoordsD
public java.awt.geom.Point2D getCoordsD()
- Overrides:
getCoordsD
in classLayoutTurnoutView
-
getCoordsLeft
java.awt.geom.Point2D getCoordsLeft()
-
getCoordsRight
java.awt.geom.Point2D getCoordsRight()
-
getCoordsForConnectionType
public java.awt.geom.Point2D getCoordsForConnectionType(HitPointType connectionType)
return the coordinates for the specified connection type- Overrides:
getCoordsForConnectionType
in classLayoutTurnoutView
- Parameters:
connectionType
- the connection type- Returns:
- the Point2D coordinates
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
- Overrides:
getBounds
in classLayoutTurnoutView
- Returns:
- the bounds of this track
-
updateBlockInfo
public void updateBlockInfo()
- Overrides:
updateBlockInfo
in classLayoutTurnoutView
-
findHitPointType
protected HitPointType findHitPointType(@Nonnull java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)
find the hit (location) type for a point- Overrides:
findHitPointType
in classLayoutTurnoutView
- 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)
-
setCoordsCenter
public void setCoordsCenter(@Nonnull java.awt.geom.Point2D p)
set center coordinates- Overrides:
setCoordsCenter
in classLayoutTurnoutView
- Parameters:
p
- the coordinates to set
-
setCoordsA
public void setCoordsA(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsA
in classLayoutTurnoutView
-
setCoordsB
public void setCoordsB(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsB
in classLayoutTurnoutView
-
setCoordsC
public void setCoordsC(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsC
in classLayoutTurnoutView
-
setCoordsD
public void setCoordsD(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsD
in classLayoutTurnoutView
-
showPopup
@Nonnull protected javax.swing.JPopupMenu showPopup(@Nonnull JmriMouseEvent mouseEvent)
show the popup menu for this layout track- Overrides:
showPopup
in classLayoutTurnoutView
- Parameters:
mouseEvent
- the mouse down event that triggered this popup- Returns:
- the popup menu for this layout track
-
getBlockBoundaries
public java.lang.String[] getBlockBoundaries()
- Overrides:
getBlockBoundaries
in classLayoutTurnoutView
-
dispose
public void dispose()
Clean up when this object is no longer needed. Should not be called while the object is still displayed; see remove()- Overrides:
dispose
in classLayoutTurnoutView
-
remove
public void remove()
Removes this object from display and persistance- Overrides:
remove
in classLayoutTurnoutView
-
getTurnoutState
public int getTurnoutState(@Nonnull Turnout turn, int state)
-
getTurnoutState
public int getTurnoutState(int state)
-
getTurnoutBState
public int getTurnoutBState(int state)
-
setTurnoutStates
public void setTurnoutStates(int state, @Nonnull java.lang.String turnStateA, @Nonnull java.lang.String turnStateB)
-
draw1
protected void draw1(java.awt.Graphics2D g2, boolean drawMain, boolean isBlock)
Description copied from class:LayoutTurnoutView
draw one line (Ballast, ties, center or 3rd rail, block lines)- Overrides:
draw1
in classLayoutTurnoutView
- Parameters:
g2
- the graphics contextdrawMain
- true if drawing mainlinesisBlock
- true if drawing block lines
-
draw2
protected void draw2(java.awt.Graphics2D g2, boolean drawMain, float railDisplacement)
draw two lines (rails)- Overrides:
draw2
in classLayoutTurnoutView
- Parameters:
g2
- the graphics contextdrawMain
- true if drawing mainlinesrailDisplacement
- the offset from center to draw the lines
-
highlightUnconnected
protected void highlightUnconnected(java.awt.Graphics2D g2, HitPointType specificType)
highlight unconnected connections- Overrides:
highlightUnconnected
in classLayoutTurnoutView
- Parameters:
g2
- the graphics contextspecificType
- the specific connection to draw (or NONE for all)
-
drawTurnoutControls
protected void drawTurnoutControls(java.awt.Graphics2D g2)
Description copied from class:LayoutTurnoutView
Draw the turnout controls- Overrides:
drawTurnoutControls
in classLayoutTurnoutView
- Parameters:
g2
- the graphics context
-
getConnectivityStateForLayoutBlocks
protected int getConnectivityStateForLayoutBlocks(@CheckForNull LayoutBlock thisLayoutBlock, @CheckForNull LayoutBlock prevLayoutBlock, @CheckForNull LayoutBlock nextLayoutBlock, boolean suppress)
- Overrides:
getConnectivityStateForLayoutBlocks
in classLayoutTurnoutView
-
reCheckBlockBoundary
public void reCheckBlockBoundary()
Description copied from class:LayoutTurnoutView
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Overrides:
reCheckBlockBoundary
in classLayoutTurnoutView
-
getLayoutConnectivity
@Nonnull protected java.util.List<LayoutConnectivity> getLayoutConnectivity()
Description copied from class:LayoutTurnoutView
get the layout connectivity for this track- Overrides:
getLayoutConnectivity
in classLayoutTurnoutView
- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
public java.util.List<HitPointType> checkForFreeConnections()
return a list of the available connections for this layout track- Overrides:
checkForFreeConnections
in classLayoutTurnoutView
- Returns:
- the list of available connections
-
-