Class LayoutTurnout
- Direct Known Subclasses:
LayoutLHTurnout,LayoutRHTurnout,LayoutSlip,LayoutWye,LayoutXOver
Specific forms are represented: right-hand, left-hand, wye, double crossover, right-handed single crossover, and left-handed single crossover. Note that double-slip turnouts can be handled as two turnouts, throat to throat, and three-way turnouts can be handled as two turnouts, left-hand and right-hand, arranged throat to continuing route.
A LayoutTurnout has three or four connection points, designated A, B, C, and
D. For right-handed or left-handed turnouts, A corresponds to the throat. At
the crossing, A-B (and C-D for crossovers) is a straight segment (continuing
route). A-C (and B-D for crossovers) is the diverging route. B-C (and A-D for
crossovers) is an illegal condition.
Turnouts
Right-hand Left-hand
C
//
A ==**== B A ==**== B
\\
C
Wye Three-way
B D
// //
A ==** A ==**== B
\\ \\
C C
Crossovers
Right-hand left-hand
A ==**===== B A ====**== B
\\ //
\\ //
D ====**== C D ==**===== C
Double
A ==**==**== B
\\//
XX
//\\
D ==**==**== C
(The LayoutSlip track objects follow a different pattern. They put A-D in
different places and have AD and BC as the normal-continuance parallel paths)
A LayoutTurnout carries Block information. For right-handed, left-handed, and wye turnouts, the entire turnout is in one block, however, a block border may occur at any connection (A,B,C,D). For a double crossover turnout, up to four blocks may be assigned, one for each connection point, but if only one block is assigned, that block applies to the entire turnout.
For drawing purposes, each LayoutTurnout carries a center point and displacements for B and C. For right-handed or left-handed turnouts, the displacement for A = - the displacement for B, and the center point is at the junction of the diverging route and the straight through continuing route. For double crossovers, the center point is at the center of the turnout, and the displacement for A = - the displacement for C 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. For double crossovers, AB and BC are constrained to remain perpendicular. For single crossovers, AB and CD are constrained to remain parallel, and AC and BD are constrained to remain parallel.
When LayoutTurnouts are first created, a rotation (degrees) is provided. For 0.0 rotation, the turnout lies on the east-west line with A facing east. Rotations are performed in a clockwise direction.
When LayoutTurnouts are first created, there are no connections. Block information and connections may be added when available.
When a LayoutTurnout is first created, it is enabled for control of an assigned actual turnout. Clicking on the turnout center point will toggle the turnout. This can be disabled via the popup menu.
Signal Head names are saved here to keep track of where signals are. LayoutTurnout only serves as a storage place for signal head names. The names are placed here by tools, e.g., Set Signals at Turnout, and Set Signals at Double Crossover. Each connection point can have up to three SignalHeads and one SignalMast.
A LayoutWye may be linked to another LayoutTurnout to form a turnout
pair.
Throat-To-Throat Turnouts - Two turnouts connected closely at their
throats, so closely that signals are not appropriate at the their throats.
This is the situation when two RH, LH, or WYE turnouts are used to model a
double slip.
3-Way Turnout - Two turnouts modeling a 3-way turnout, where the
throat of the second turnout is closely connected to the continuing track of
the first turnout. The throat will have three heads, or one head. A link is
required to be able to correctly interpret the use of signal heads.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanintbooleanbooleanstatic final intprotected NamedBeanHandle<LayoutBlock>protected NamedBeanHandle<LayoutBlock>protected NamedBeanHandle<LayoutBlock>protected NamedBeanHandle<LayoutBlock>protected NamedBeanHandle<Turnout>protected NamedBeanHandle<Turnout>protected NamedBeanHandle<Sensor>protected NamedBeanHandle<Sensor>protected NamedBeanHandle<Sensor>protected NamedBeanHandle<Sensor>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>static final intstatic final intstatic final intstatic final intstatic final doublestatic final doublestatic final doubleprotected final LayoutTurnout.TurnoutTypestatic final intstatic final doublestatic final doublestatic final doubleFields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
models -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLayoutTurnout(String id, LayoutEditor models) protectedLayoutTurnout(String id, LayoutEditor models, LayoutTurnout.TurnoutType t) LayoutTurnout(String id, LayoutTurnout.TurnoutType t, LayoutEditor models) LayoutTurnout(String id, LayoutTurnout.TurnoutType t, LayoutEditor models, int v) Main constructor method. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck for active block boundaries.return a list of the available connections for this layout trackvoidcheck this track and its neighbors for non-contiguous blocksbooleandetermine if all the appropriate blocks have been assigned to this trackvoidcollectContiguousTracksNamesInBlockNamed(String blockName, Set<String> TrackNameSet) recursive routine to check for all contiguous tracks in this blockNamegetBeanReferences(String pointName) Build a list of sensors, signal heads, and signal masts attached to a turnout point.String[]getConnection(HitPointType connectionType) get the LayoutTrack connected at the specified connection typeprotected intgetConnectivityStateForLayoutBlocks(LayoutBlock currLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress) intprotected List<LayoutConnectivity>get the layout connectivity for this trackgetProtectedBlocks(NamedBean bean) intgetState()Get the LayoutTurnout statePerhaps confusingly, this returns an actual Turnout reference or null for the turnout associated with this is LayoutTurnout.Get the type of this item.intGet the Version.booleanReturns true if this has double track on the entrance end (crossover or slip)static booleanReturns true if this has double track on the entrance end (crossover or slip)booleanReturns true if this has a single-track entrance end.static booleanReturns true if this has a single-track entrance end.booleanisActive()"active" means that the object is still displayed, and should be stored.booleanbooleanbooleanbooleanbooleanTest if turnout legs are mainline track or not.booleanbooleanboolean(package private) booleanIs this turnout occupied?booleanbooleanReturns true if this is a slipstatic booleanReturns true if this is a slipbooleanReturns true if this is a turnout (not a crossover or slip)static booleanReturns true if this is a turnout (not a crossover or slip)booleanReturns true if this is a crossoverstatic booleanReturns true if this is a crossovervoidabstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidremove()Remove this object from display and persistance.voidprotected voidremoveSML(SignalMast signalMast) voidsetAllLayoutBlocks(LayoutBlock layoutBlock) Assign all the layout blocks in this trackvoidsetConnectA(LayoutTrack o, HitPointType type) voidsetConnectB(LayoutTrack o, HitPointType type) voidsetConnectC(LayoutTrack o, HitPointType type) voidsetConnectD(LayoutTrack o, HitPointType type) voidsetConnection(HitPointType connectionType, LayoutTrack o, HitPointType type) set the LayoutTrack connected at the specified connection typevoidsetContinuingSense(int sense) voidsetDisabled(boolean state) voidsetDisableWhenOccupied(boolean state) protected voidsetLayoutBlock(LayoutBlock newLayoutBlock) Set up Layout Block(s) for this Turnout.protected voidsetLayoutBlockB(LayoutBlock newLayoutBlock) voidsetLayoutBlockBByName(String name) voidsetLayoutBlockByName(String name) protected voidsetLayoutBlockC(LayoutBlock newLayoutBlock) voidsetLayoutBlockCByName(String name) protected voidsetLayoutBlockD(LayoutBlock newLayoutBlock) voidsetLayoutBlockDByName(String name) voidvoidvoidInitialization method.voidsetSecondTurnout(String name) voidsetSecondTurnoutInverted(boolean inverted) voidsetSensorA(String sensorName) voidsetSensorB(String sensorName) voidsetSensorC(String sensorName) voidsetSensorD(String sensorName) voidsetShowToolTip(boolean set) voidsetSignalA1Name(String signalHead) voidsetSignalA2Name(String signalHead) voidsetSignalA3Name(String signalHead) voidsetSignalAMast(String signalMast) voidsetSignalB1Name(String signalHead) voidsetSignalB2Name(String signalHead) voidsetSignalBMast(String signalMast) voidsetSignalC1Name(String signalHead) voidsetSignalC2Name(String signalHead) voidsetSignalCMast(String signalMast) voidsetSignalD1Name(String signalHead) voidsetSignalD2Name(String signalHead) voidsetSignalDMast(String signalMast) voidsetState(int state) Set the LayoutTurnout state.voidsetToolTip(ToolTip tip) voidsetTurnout(String name) Perhaps confusingly, this takes a Turnout name (system or user) to locate and set the turnout associated with this is LayoutTurnout.voidsetVersion(int v) booleanvoidToggle turnout if clicked on, physical turnout exists, and not disabled.toString()voidbooleanMethods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
getId, getName, getTurnoutStateString, isDisconnected, setIdent
-
Field Details
-
UNKNOWN
- See Also:
-
INCONSISTENT
- See Also:
-
STATE_AC
- See Also:
-
STATE_BD
- See Also:
-
STATE_AD
- See Also:
-
STATE_BC
- See Also:
-
turnoutBXDefault
- See Also:
-
turnoutCXDefault
- See Also:
-
turnoutWidDefault
- See Also:
-
xOverLongDefault
- See Also:
-
xOverHWidDefault
- See Also:
-
xOverShortDefault
- See Also:
-
namedTurnout
-
secondNamedTurnout
-
namedLayoutBlockA
-
namedLayoutBlockB
-
namedLayoutBlockC
-
namedLayoutBlockD
-
signalA1HeadNamed
-
signalA2HeadNamed
-
signalA3HeadNamed
-
signalB1HeadNamed
-
signalB2HeadNamed
-
signalC1HeadNamed
-
signalC2HeadNamed
-
signalD1HeadNamed
-
signalD2HeadNamed
-
signalAMastNamed
-
signalBMastNamed
-
signalCMastNamed
-
signalDMastNamed
-
sensorANamed
-
sensorBNamed
-
sensorCNamed
-
sensorDNamed
-
type
-
connectA
-
connectB
-
connectC
-
connectD
-
continuingSense
-
disabled
-
disableWhenOccupied
-
linkedTurnoutName
-
linkType
-
connectAName
-
connectBName
-
connectCName
-
connectDName
-
tBlockAName
-
tBlockBName
-
tBlockCName
-
tBlockDName
-
active
boolean active
-
-
Constructor Details
-
LayoutTurnout
protected LayoutTurnout(@Nonnull String id, @Nonnull LayoutEditor models, LayoutTurnout.TurnoutType t) -
LayoutTurnout
-
LayoutTurnout
-
LayoutTurnout
public LayoutTurnout(@Nonnull String id, LayoutTurnout.TurnoutType t, @Nonnull LayoutEditor models, int v) Main constructor method.- Parameters:
id- Layout Turnout ID.t- type, e.g. LH_TURNOUT, WYE_TURNOUTmodels- main layout editor.v- version.
-
-
Method Details
-
isTurnoutTypeTurnout
Returns true if this is a turnout (not a crossover or slip)- Parameters:
type- the turnout type- Returns:
- boolean true if this is a turnout
-
isTurnoutTypeTurnout
Returns true if this is a turnout (not a crossover or slip)- Returns:
- boolean true if this is a turnout
-
isTurnoutTypeXover
Returns true if this is a crossover- Parameters:
type- the turnout type- Returns:
- boolean true if this is a crossover
-
isTurnoutTypeXover
Returns true if this is a crossover- Returns:
- boolean true if this is a crossover
-
isTurnoutTypeSlip
Returns true if this is a slip- Parameters:
type- the turnout type- Returns:
- boolean true if this is a slip
-
isTurnoutTypeSlip
Returns true if this is a slip- Returns:
- boolean true if this is a slip
-
hasEnteringSingleTrack
Returns true if this has a single-track entrance end. (turnout or wye)- Parameters:
type- the turnout type- Returns:
- boolean true if single track entrance
-
hasEnteringSingleTrack
Returns true if this has a single-track entrance end. (turnout or wye)- Returns:
- boolean true if single track entrance
-
hasEnteringDoubleTrack
Returns true if this has double track on the entrance end (crossover or slip)- Parameters:
type- the turnout type- Returns:
- boolean true if double track entrance
-
hasEnteringDoubleTrack
Returns true if this has double track on the entrance end (crossover or slip)- Returns:
- boolean true if double track entrance
-
toString
-
getVersion
Get the Version.- Returns:
- turnout version.
-
setVersion
-
useBlockSpeed
-
getTurnoutName
-
getSecondTurnoutName
-
isSecondTurnoutInverted
-
getBlockName
-
getBlockBName
-
getBlockCName
-
getBlockDName
-
getSignalHead
-
getSignalA1
-
getSignalA1Name
-
setSignalA1Name
-
getSignalA2
-
getSignalA2Name
-
setSignalA2Name
-
getSignalA3
-
getSignalA3Name
-
setSignalA3Name
-
getSignalB1
-
getSignalB1Name
-
setSignalB1Name
-
getSignalB2
-
getSignalB2Name
-
setSignalB2Name
-
getSignalC1
-
getSignalC1Name
-
setSignalC1Name
-
getSignalC2
-
getSignalC2Name
-
setSignalC2Name
-
getSignalD1
-
getSignalD1Name
-
setSignalD1Name
-
getSignalD2
-
getSignalD2Name
-
setSignalD2Name
-
removeBeanReference
-
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 classLayoutTrack- Returns:
- true if the layout track object can be deleted.
-
getBeanReferences
Build a list of sensors, signal heads, and signal masts attached to a turnout point.- Parameters:
pointName- Specify the point (A-D) or all (All) points.- Returns:
- a list of bean reference names.
-
getSignalAMastName
-
getSignalAMast
-
setSignalAMast
-
getSignalBMastName
-
getSignalBMast
-
setSignalBMast
-
getSignalCMastName
-
getSignalCMast
-
setSignalCMast
-
getSignalDMastName
-
getSignalDMast
-
setSignalDMast
-
getSensorAName
-
getSensorA
-
setSensorA
-
getSensorBName
-
getSensorB
-
setSensorB
-
getSensorCName
-
getSensorC
-
setSensorC
-
getSensorDName
-
getSensorD
-
setSensorD
-
getLinkedTurnoutName
-
setLinkedTurnoutName
-
getLinkType
-
setLinkType
-
getTurnoutType
-
getConnectA
-
getConnectB
-
getConnectC
-
getConnectD
-
getTurnout
Perhaps confusingly, this returns an actual Turnout reference or null for the turnout associated with this is LayoutTurnout. This is different fromsetTurnout(String), which takes a name (system or user) or an empty string.- Returns:
- Null if no Turnout set
-
getContinuingSense
-
isInContinuingSenseState
- Returns:
- true is the continuingSense matches the known state
-
setTurnout
Perhaps confusingly, this takes a Turnout name (system or user) to locate and set the turnout associated with this is LayoutTurnout. This is different fromgetTurnout(), which returns an actual Turnout reference or null.- Parameters:
name- provide empty string for none; never null
-
getSecondTurnout
-
setSecondTurnout
- Parameters:
name- provide empty string for none (not null)
-
setSecondTurnoutInverted
-
setContinuingSense
-
setDisabled
-
isDisabled
-
setDisableWhenOccupied
-
isDisabledWhenOccupied
-
getConnection
get the LayoutTrack connected at the specified connection type- Specified by:
getConnectionin classLayoutTrack- 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- Specified by:
setConnectionin classLayoutTrack- 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
-
setConnectA
-
setConnectB
-
setConnectC
-
setConnectD
-
getLayoutBlock
-
getLayoutBlockB
-
getLayoutBlockC
-
getLayoutBlockD
-
updateBlockInfo
-
setLayoutBlock
Set up Layout Block(s) for this Turnout.- Parameters:
newLayoutBlock- the new layout block.
-
setLayoutBlockB
-
setLayoutBlockC
-
setLayoutBlockD
-
setLayoutBlockByName
-
setLayoutBlockBByName
-
setLayoutBlockCByName
-
setLayoutBlockDByName
-
isMainlineA
Test if turnout legs are mainline track or not.- Returns:
- true if connecting track segment is mainline; Defaults to not mainline if connecting track segment is missing
-
isMainlineB
-
isMainlineC
-
isMainlineD
-
isMainline
- Specified by:
isMainlinein classLayoutTrack
-
toggleTurnout
Toggle turnout if clicked on, physical turnout exists, and not disabled. -
setState
Set the LayoutTurnout state. Used for sending the toggle command Checks not disabled, disable when occupied Also sets secondary Turnout commanded state- Parameters:
state- New state to set, eg Turnout.CLOSED
-
getState
Get the LayoutTurnout stateEnsures the secondary Turnout state matches the primary
- Returns:
- the state, eg Turnout.CLOSED or Turnout.INCONSISTENT
-
isOccupied
boolean isOccupied()Is this turnout occupied?- Returns:
- true if occupied
-
setObjects
Initialization method. The above variables are initialized by LayoutTurnoutXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects.- Specified by:
setObjectsin classLayoutTrack- Parameters:
p- the layout editor
-
getBlockBoundaries
-
getProtectedBlocks
-
removeSML
-
remove
Remove this object from display and persistance. -
isActive
"active" means that the object is still displayed, and should be stored.- Returns:
- true if active, else false.
-
getConnectivityStateForLayoutBlocks
protected int getConnectivityStateForLayoutBlocks(LayoutBlock currLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress) -
reCheckBlockBoundary
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundaryin classLayoutTrack
-
getLayoutConnectivity
get the layout connectivity for this track- Specified by:
getLayoutConnectivityin classLayoutTrack- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
return a list of the available connections for this layout track- Specified by:
checkForFreeConnectionsin classLayoutTrack- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
determine if all the appropriate blocks have been assigned to this track- Specified by:
checkForUnAssignedBlocksin classLayoutTrack- Returns:
- true if all appropriate blocks have been assigned
-
checkForNonContiguousBlocks
public void checkForNonContiguousBlocks(@Nonnull HashMap<String, List<Set<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 classLayoutTrack- Parameters:
blockNamesToTrackNameSetsMap- hashmap of key:block names to lists of track name sets for those blocks
-
collectContiguousTracksNamesInBlockNamed
public void collectContiguousTracksNamesInBlockNamed(@Nonnull String blockName, @Nonnull Set<String> TrackNameSet) recursive routine to check for all contiguous tracks in this blockName- Specified by:
collectContiguousTracksNamesInBlockNamedin classLayoutTrack- Parameters:
blockName- the block that we're checking forTrackNameSet- the set of track names in this block
-
setAllLayoutBlocks
Assign all the layout blocks in this track- Specified by:
setAllLayoutBlocksin classLayoutTrack- Parameters:
layoutBlock- to this layout block (used by the Tools menu's "Assign block to selection" item)
-
getTypeName
Get the type of this item.- Specified by:
getTypeNamein classLayoutTrack- Returns:
- the type
-
setShowToolTip
-
showToolTip
-
setToolTip
-
getToolTip
-
getNameString
-