Package jmri.jmrit.display.layoutEditor
Class LayoutSlip
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutTrack
-
- jmri.jmrit.display.layoutEditor.LayoutTurnout
-
- jmri.jmrit.display.layoutEditor.LayoutSlip
-
- Direct Known Subclasses:
LayoutDoubleSlip
,LayoutSingleSlip
public abstract class LayoutSlip extends LayoutTurnout
A LayoutSlip is a crossing of two straight tracks designed in such a way as to allow trains to change from one straight track to the other, as well as going straight across.A LayoutSlip has four connection points, designated A, B, C, and D. A train may proceed between A and D, A and C, B and D and in the case of double-slips, B and C.
\\ // A==-==D \\ // X // \\ B==-==C // \\
For drawing purposes, each LayoutSlip carries a center point and displacements for A and B. The displacements for C = - the displacement for A, and the displacement for D = - the displacement for B. The center point and these displacements may be adjusted by the user when in edit mode.When LayoutSlips are first created, there are no connections. Block information and connections are added when available.
SignalHead names are saved here to keep track of where signals are. LayoutSlip only serves as a storage place for SignalHead names. The names are placed here by Set Signals at Level Crossing in Tools menu.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LayoutSlip.TurnoutState
-
Nested classes/interfaces inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnout
LayoutTurnout.Geometry, LayoutTurnout.LinkType, LayoutTurnout.TurnoutType
-
-
Field Summary
Fields Modifier and Type Field Description int
currentState
(package private) java.util.HashMap<java.lang.Integer,LayoutSlip.TurnoutState>
turnoutStates
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnout
active, connectA, connectAName, connectB, connectBName, connectC, connectCName, connectD, connectDName, continuingSense, disabled, disableWhenOccupied, INCONSISTENT, linkedTurnoutName, linkType, namedLayoutBlockA, namedLayoutBlockB, namedLayoutBlockC, namedLayoutBlockD, namedTurnout, secondNamedTurnout, sensorANamed, sensorBNamed, sensorCNamed, sensorDNamed, signalA1HeadNamed, signalA2HeadNamed, signalA3HeadNamed, signalAMastNamed, signalB1HeadNamed, signalB2HeadNamed, signalBMastNamed, signalC1HeadNamed, signalC2HeadNamed, signalCMastNamed, signalD1HeadNamed, signalD2HeadNamed, signalDMastNamed, STATE_AC, STATE_AD, STATE_BC, STATE_BD, tBlockAName, tBlockBName, tBlockCName, tBlockDName, turnoutBXDefault, turnoutCXDefault, turnoutWidDefault, type, UNKNOWN, xOverHWidDefault, xOverLongDefault, xOverShortDefault
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
models
-
-
Constructor Summary
Constructors Constructor Description LayoutSlip(java.lang.String id, LayoutEditor models, LayoutTurnout.TurnoutType type)
Constructor method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
activateTurnout()
Activate/Deactivate turnout to redraw when turnout state changesjava.util.List<HitPointType>
checkForFreeConnections()
return a list of the available connections for this layout track(package private) void
deactivateTurnout()
(package private) void
disableSML(SignalMast signalMast)
java.lang.String[]
getBlockBoundaries()
LayoutTrack
getConnection(HitPointType connectionType)
get the LayoutTrack connected at the specified connection typeprotected int
getConnectivityStateForLayoutBlocks(LayoutBlock thisLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress)
java.lang.String
getDisplayName()
protected java.util.List<LayoutConnectivity>
getLayoutConnectivity()
get the layout connectivity for this trackjava.lang.String
getNameString()
Create the tooltip name string for a slip.int
getSlipState()
(package private) java.lang.String
getSlipStateString(int slipState)
LayoutTurnout.TurnoutType
getSlipType()
Turnout
getTurnoutB()
java.lang.String
getTurnoutBName()
int
getTurnoutBState(int state)
int
getTurnoutState(int state)
int
getTurnoutState(Turnout turn, int state)
java.util.HashMap<java.lang.Integer,LayoutSlip.TurnoutState>
getTurnoutStates()
boolean
isMainline()
Methods to test if mainline track or not Returns true if either connecting track segment is mainline Defaults to not mainline if connecting track segments are missing(package private) boolean
isOccupied()
is this turnout occupied?(package private) boolean
isTurnoutInconsistent()
Check if either turnout is inconsistent.void
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 type(package private) void
setSlipState(int newSlipState)
void
setTurnoutB(java.lang.String tName)
void
setTurnoutStates(int state, java.lang.String turnStateA, java.lang.String turnStateB)
void
toggleState(HitPointType selectedPointType)
Toggle slip states if clicked on, physical turnout exists, and not disabled.java.lang.String
toString()
void
updateBlockInfo()
(package private) void
updateState()
-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnout
canRemove, checkForNonContiguousBlocks, checkForUnAssignedBlocks, collectContiguousTracksNamesInBlockNamed, getBeanReferences, getBlockBName, getBlockCName, getBlockDName, getBlockName, getConnectA, getConnectB, getConnectC, getConnectD, getContinuingSense, getLayoutBlock, getLayoutBlockB, getLayoutBlockC, getLayoutBlockD, getLinkedTurnoutName, getLinkType, getProtectedBlocks, 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, getToolTip, getTurnout, getTurnoutName, getTurnoutType, getTypeName, getVersion, hasEnteringDoubleTrack, hasEnteringDoubleTrack, hasEnteringSingleTrack, hasEnteringSingleTrack, isActive, isDisabled, isDisabledWhenOccupied, isInContinuingSenseState, isMainlineA, isMainlineB, isMainlineC, isMainlineD, isSecondTurnoutInverted, isTurnoutTypeSlip, isTurnoutTypeSlip, isTurnoutTypeTurnout, isTurnoutTypeTurnout, isTurnoutTypeXover, isTurnoutTypeXover, removeBeanReference, removeSML, setAllLayoutBlocks, setConnectA, setConnectB, setConnectC, setConnectD, setContinuingSense, setDisabled, setDisableWhenOccupied, setLayoutBlock, setLayoutBlockB, setLayoutBlockBByName, setLayoutBlockByName, setLayoutBlockC, setLayoutBlockCByName, setLayoutBlockD, setLayoutBlockDByName, setLinkedTurnoutName, setLinkType, setObjects, setSecondTurnout, setSecondTurnoutInverted, setSensorA, setSensorB, setSensorC, setSensorD, setShowToolTip, setSignalA1Name, setSignalA2Name, setSignalA3Name, setSignalAMast, setSignalB1Name, setSignalB2Name, setSignalBMast, setSignalC1Name, setSignalC2Name, setSignalCMast, setSignalD1Name, setSignalD2Name, setSignalDMast, setState, setToolTip, setTurnout, setVersion, showToolTip, toggleTurnout, useBlockSpeed
-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
getId, getName, getTurnoutStateString, isDisconnected, setIdent
-
-
-
-
Field Detail
-
currentState
public int currentState
-
turnoutStates
java.util.HashMap<java.lang.Integer,LayoutSlip.TurnoutState> turnoutStates
-
-
Constructor Detail
-
LayoutSlip
public LayoutSlip(java.lang.String id, LayoutEditor models, LayoutTurnout.TurnoutType type)
Constructor method.- Parameters:
id
- slip ID.models
- the layout editor.type
- slip type, SINGLE_SLIP or DOUBLE_SLIP.
-
-
Method Detail
-
toString
public java.lang.String toString()
Description copied from class:LayoutTurnout
- Overrides:
toString
in classLayoutTurnout
-
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)
get the LayoutTrack connected at the specified connection type- Overrides:
getConnection
in classLayoutTurnout
- Parameters:
connectionType
- where on us to get the connection- Returns:
- the LayoutTrack connected at the specified connection type
-
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 classLayoutTurnout
- 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()
-
getSlipStateString
java.lang.String getSlipStateString(int slipState)
-
toggleState
public void toggleState(HitPointType selectedPointType)
Toggle slip states if clicked on, physical turnout exists, and not disabled.- Parameters:
selectedPointType
- the selected hit point type.
-
setSlipState
void setSlipState(int newSlipState)
-
isOccupied
boolean isOccupied()
is this turnout occupied?- Overrides:
isOccupied
in classLayoutTurnout
- Returns:
- true if occupied
-
activateTurnout
void activateTurnout()
Activate/Deactivate turnout to redraw when turnout state changes
-
deactivateTurnout
void deactivateTurnout()
-
updateBlockInfo
public void updateBlockInfo()
- Overrides:
updateBlockInfo
in classLayoutTurnout
-
isMainline
public boolean isMainline()
Methods to test if mainline track or not Returns true if either connecting track segment is mainline Defaults to not mainline if connecting track segments are missing- Overrides:
isMainline
in classLayoutTurnout
-
getBlockBoundaries
public java.lang.String[] getBlockBoundaries()
- Overrides:
getBlockBoundaries
in classLayoutTurnout
-
remove
public void remove()
Removes this object from display and persistance- Overrides:
remove
in classLayoutTurnout
-
disableSML
void disableSML(SignalMast signalMast)
-
getTurnoutStates
public java.util.HashMap<java.lang.Integer,LayoutSlip.TurnoutState> getTurnoutStates()
-
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)
-
updateState
void updateState()
-
isTurnoutInconsistent
boolean isTurnoutInconsistent()
Check if either turnout is inconsistent. This is used to create an alternate slip image.- Returns:
- true if either turnout is inconsistent.
-
getConnectivityStateForLayoutBlocks
protected int getConnectivityStateForLayoutBlocks(@CheckForNull LayoutBlock thisLayoutBlock, @CheckForNull LayoutBlock prevLayoutBlock, @CheckForNull LayoutBlock nextLayoutBlock, boolean suppress)
- Overrides:
getConnectivityStateForLayoutBlocks
in classLayoutTurnout
-
reCheckBlockBoundary
public void reCheckBlockBoundary()
Description copied from class:LayoutTurnout
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Overrides:
reCheckBlockBoundary
in classLayoutTurnout
-
getLayoutConnectivity
@Nonnull protected java.util.List<LayoutConnectivity> getLayoutConnectivity()
Description copied from class:LayoutTurnout
get the layout connectivity for this track- Overrides:
getLayoutConnectivity
in classLayoutTurnout
- 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 classLayoutTurnout
- Returns:
- the list of available connections
-
getNameString
@Nonnull public java.lang.String getNameString()
Create the tooltip name string for a slip.- Overrides:
getNameString
in classLayoutTurnout
- Returns:
- the turnout display names or the Id.
-
-