Class LayoutTurnout
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutTrack
-
- jmri.jmrit.display.layoutEditor.LayoutTurnout
-
- Direct Known Subclasses:
LayoutLHTurnout
,LayoutRHTurnout
,LayoutSlip
,LayoutWye
,LayoutXOver
public abstract class LayoutTurnout extends LayoutTrack
LayoutTurnout is the abstract base for classes representing various types of turnout on the layout. A LayoutTurnout is an extension of the standard Turnout object with drawing and connectivity information added.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
(TheLayoutSlip
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 Classes Modifier and Type Class Description static class
LayoutTurnout.Geometry
static class
LayoutTurnout.LinkType
static class
LayoutTurnout.TurnoutType
-
Field Summary
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
models
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LayoutTurnout(java.lang.String id, LayoutEditor models)
protected
LayoutTurnout(java.lang.String id, LayoutEditor models, LayoutTurnout.TurnoutType t)
LayoutTurnout(java.lang.String id, LayoutTurnout.TurnoutType t, LayoutEditor models)
LayoutTurnout(java.lang.String id, LayoutTurnout.TurnoutType t, LayoutEditor models, int v)
Main constructor method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRemove()
Check for active block boundaries.java.util.List<HitPointType>
checkForFreeConnections()
return a list of the available connections for this layout trackvoid
checkForNonContiguousBlocks(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 blocksboolean
checkForUnAssignedBlocks()
determine if all the appropriate blocks have been assigned to this trackvoid
collectContiguousTracksNamesInBlockNamed(java.lang.String blockName, java.util.Set<java.lang.String> TrackNameSet)
recursive routine to check for all contiguous tracks in this blockNamejava.util.ArrayList<java.lang.String>
getBeanReferences(java.lang.String pointName)
Build a list of sensors, signal heads, and signal masts attached to a turnout point.java.lang.String
getBlockBName()
java.lang.String[]
getBlockBoundaries()
java.lang.String
getBlockCName()
java.lang.String
getBlockDName()
java.lang.String
getBlockName()
LayoutTrack
getConnectA()
LayoutTrack
getConnectB()
LayoutTrack
getConnectC()
LayoutTrack
getConnectD()
LayoutTrack
getConnection(HitPointType connectionType)
get the LayoutTrack connected at the specified connection typeprotected int
getConnectivityStateForLayoutBlocks(LayoutBlock currLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress)
int
getContinuingSense()
LayoutBlock
getLayoutBlock()
LayoutBlock
getLayoutBlockB()
LayoutBlock
getLayoutBlockC()
LayoutBlock
getLayoutBlockD()
protected java.util.List<LayoutConnectivity>
getLayoutConnectivity()
get the layout connectivity for this trackjava.lang.String
getLinkedTurnoutName()
LayoutTurnout.LinkType
getLinkType()
java.lang.String
getNameString()
java.util.ArrayList<LayoutBlock>
getProtectedBlocks(NamedBean bean)
Turnout
getSecondTurnout()
java.lang.String
getSecondTurnoutName()
Sensor
getSensorA()
java.lang.String
getSensorAName()
Sensor
getSensorB()
java.lang.String
getSensorBName()
Sensor
getSensorC()
java.lang.String
getSensorCName()
Sensor
getSensorD()
java.lang.String
getSensorDName()
SignalHead
getSignalA1()
java.lang.String
getSignalA1Name()
SignalHead
getSignalA2()
java.lang.String
getSignalA2Name()
SignalHead
getSignalA3()
java.lang.String
getSignalA3Name()
SignalMast
getSignalAMast()
java.lang.String
getSignalAMastName()
SignalHead
getSignalB1()
java.lang.String
getSignalB1Name()
SignalHead
getSignalB2()
java.lang.String
getSignalB2Name()
SignalMast
getSignalBMast()
java.lang.String
getSignalBMastName()
SignalHead
getSignalC1()
java.lang.String
getSignalC1Name()
SignalHead
getSignalC2()
java.lang.String
getSignalC2Name()
SignalMast
getSignalCMast()
java.lang.String
getSignalCMastName()
SignalHead
getSignalD1()
java.lang.String
getSignalD1Name()
SignalHead
getSignalD2()
java.lang.String
getSignalD2Name()
SignalMast
getSignalDMast()
java.lang.String
getSignalDMastName()
SignalHead
getSignalHead(LayoutTurnout.Geometry loc)
int
getState()
Get the LayoutTurnout stateToolTip
getToolTip()
Turnout
getTurnout()
Perhaps confusingly, this returns an actual Turnout reference or null for the turnout associated with this is LayoutTurnout.java.lang.String
getTurnoutName()
LayoutTurnout.TurnoutType
getTurnoutType()
java.lang.String
getTypeName()
Get the type of this item.int
getVersion()
Get the Version.boolean
hasEnteringDoubleTrack()
Returns true if this has double track on the entrance end (crossover or slip)static boolean
hasEnteringDoubleTrack(LayoutTurnout.TurnoutType type)
Returns true if this has double track on the entrance end (crossover or slip)boolean
hasEnteringSingleTrack()
Returns true if this has a single-track entrance end.static boolean
hasEnteringSingleTrack(LayoutTurnout.TurnoutType type)
Returns true if this has a single-track entrance end.boolean
isActive()
"active" means that the object is still displayed, and should be stored.boolean
isDisabled()
boolean
isDisabledWhenOccupied()
boolean
isInContinuingSenseState()
boolean
isMainline()
boolean
isMainlineA()
Test if turnout legs are mainline track or not.boolean
isMainlineB()
boolean
isMainlineC()
boolean
isMainlineD()
(package private) boolean
isOccupied()
Is this turnout occupied?boolean
isSecondTurnoutInverted()
boolean
isTurnoutTypeSlip()
Returns true if this is a slipstatic boolean
isTurnoutTypeSlip(LayoutTurnout.TurnoutType type)
Returns true if this is a slipboolean
isTurnoutTypeTurnout()
Returns true if this is a turnout (not a crossover or slip)static boolean
isTurnoutTypeTurnout(LayoutTurnout.TurnoutType type)
Returns true if this is a turnout (not a crossover or slip)boolean
isTurnoutTypeXover()
Returns true if this is a crossoverstatic boolean
isTurnoutTypeXover(LayoutTurnout.TurnoutType type)
Returns true if this is a crossovervoid
reCheckBlockBoundary()
abstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoid
remove()
Remove this object from display and persistance.void
removeBeanReference(NamedBean nb)
protected void
removeSML(SignalMast signalMast)
void
setAllLayoutBlocks(LayoutBlock layoutBlock)
Assign all the layout blocks in this trackvoid
setConnectA(LayoutTrack o, HitPointType type)
void
setConnectB(LayoutTrack o, HitPointType type)
void
setConnectC(LayoutTrack o, HitPointType type)
void
setConnectD(LayoutTrack o, HitPointType type)
void
setConnection(HitPointType connectionType, LayoutTrack o, HitPointType type)
set the LayoutTrack connected at the specified connection typevoid
setContinuingSense(int sense)
void
setDisabled(boolean state)
void
setDisableWhenOccupied(boolean state)
protected void
setLayoutBlock(LayoutBlock newLayoutBlock)
Set up Layout Block(s) for this Turnout.protected void
setLayoutBlockB(LayoutBlock newLayoutBlock)
void
setLayoutBlockBByName(java.lang.String name)
void
setLayoutBlockByName(java.lang.String name)
protected void
setLayoutBlockC(LayoutBlock newLayoutBlock)
void
setLayoutBlockCByName(java.lang.String name)
protected void
setLayoutBlockD(LayoutBlock newLayoutBlock)
void
setLayoutBlockDByName(java.lang.String name)
void
setLinkedTurnoutName(java.lang.String s)
void
setLinkType(LayoutTurnout.LinkType ltype)
void
setObjects(LayoutEditor p)
Initialization method.void
setSecondTurnout(java.lang.String tName)
void
setSecondTurnoutInverted(boolean inverted)
void
setSensorA(java.lang.String sensorName)
void
setSensorB(java.lang.String sensorName)
void
setSensorC(java.lang.String sensorName)
void
setSensorD(java.lang.String sensorName)
void
setShowToolTip(boolean set)
void
setSignalA1Name(java.lang.String signalHead)
void
setSignalA2Name(java.lang.String signalHead)
void
setSignalA3Name(java.lang.String signalHead)
void
setSignalAMast(java.lang.String signalMast)
void
setSignalB1Name(java.lang.String signalHead)
void
setSignalB2Name(java.lang.String signalHead)
void
setSignalBMast(java.lang.String signalMast)
void
setSignalC1Name(java.lang.String signalHead)
void
setSignalC2Name(java.lang.String signalHead)
void
setSignalCMast(java.lang.String signalMast)
void
setSignalD1Name(java.lang.String signalHead)
void
setSignalD2Name(java.lang.String signalHead)
void
setSignalDMast(java.lang.String signalMast)
void
setState(int state)
Set the LayoutTurnout state.void
setToolTip(ToolTip tip)
void
setTurnout(java.lang.String tName)
Perhaps confusingly, this takes a Turnout name (system or user) to locate and set the turnout associated with this is LayoutTurnout.void
setVersion(int v)
boolean
showToolTip()
void
toggleTurnout()
Toggle turnout if clicked on, physical turnout exists, and not disabled.java.lang.String
toString()
void
updateBlockInfo()
boolean
useBlockSpeed()
-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
getId, getName, getTurnoutStateString, isDisconnected, setIdent
-
-
-
-
Field Detail
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
INCONSISTENT
public static final int INCONSISTENT
- See Also:
- Constant Field Values
-
STATE_AC
public static final int STATE_AC
- See Also:
- Constant Field Values
-
STATE_BD
public static final int STATE_BD
- See Also:
- Constant Field Values
-
STATE_AD
public static final int STATE_AD
- See Also:
- Constant Field Values
-
STATE_BC
public static final int STATE_BC
- See Also:
- Constant Field Values
-
turnoutBXDefault
public static final double turnoutBXDefault
- See Also:
- Constant Field Values
-
turnoutCXDefault
public static final double turnoutCXDefault
- See Also:
- Constant Field Values
-
turnoutWidDefault
public static final double turnoutWidDefault
- See Also:
- Constant Field Values
-
xOverLongDefault
public static final double xOverLongDefault
- See Also:
- Constant Field Values
-
xOverHWidDefault
public static final double xOverHWidDefault
- See Also:
- Constant Field Values
-
xOverShortDefault
public static final double xOverShortDefault
- See Also:
- Constant Field Values
-
namedTurnout
protected NamedBeanHandle<Turnout> namedTurnout
-
secondNamedTurnout
protected NamedBeanHandle<Turnout> secondNamedTurnout
-
namedLayoutBlockA
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockA
-
namedLayoutBlockB
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockB
-
namedLayoutBlockC
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockC
-
namedLayoutBlockD
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockD
-
signalA1HeadNamed
protected NamedBeanHandle<SignalHead> signalA1HeadNamed
-
signalA2HeadNamed
protected NamedBeanHandle<SignalHead> signalA2HeadNamed
-
signalA3HeadNamed
protected NamedBeanHandle<SignalHead> signalA3HeadNamed
-
signalB1HeadNamed
protected NamedBeanHandle<SignalHead> signalB1HeadNamed
-
signalB2HeadNamed
protected NamedBeanHandle<SignalHead> signalB2HeadNamed
-
signalC1HeadNamed
protected NamedBeanHandle<SignalHead> signalC1HeadNamed
-
signalC2HeadNamed
protected NamedBeanHandle<SignalHead> signalC2HeadNamed
-
signalD1HeadNamed
protected NamedBeanHandle<SignalHead> signalD1HeadNamed
-
signalD2HeadNamed
protected NamedBeanHandle<SignalHead> signalD2HeadNamed
-
signalAMastNamed
protected NamedBeanHandle<SignalMast> signalAMastNamed
-
signalBMastNamed
protected NamedBeanHandle<SignalMast> signalBMastNamed
-
signalCMastNamed
protected NamedBeanHandle<SignalMast> signalCMastNamed
-
signalDMastNamed
protected NamedBeanHandle<SignalMast> signalDMastNamed
-
sensorANamed
protected NamedBeanHandle<Sensor> sensorANamed
-
sensorBNamed
protected NamedBeanHandle<Sensor> sensorBNamed
-
sensorCNamed
protected NamedBeanHandle<Sensor> sensorCNamed
-
sensorDNamed
protected NamedBeanHandle<Sensor> sensorDNamed
-
type
protected final LayoutTurnout.TurnoutType type
-
connectA
public LayoutTrack connectA
-
connectB
public LayoutTrack connectB
-
connectC
public LayoutTrack connectC
-
connectD
public LayoutTrack connectD
-
continuingSense
public int continuingSense
-
disabled
public boolean disabled
-
disableWhenOccupied
public boolean disableWhenOccupied
-
linkedTurnoutName
@Nonnull public java.lang.String linkedTurnoutName
-
linkType
public LayoutTurnout.LinkType linkType
-
connectAName
public java.lang.String connectAName
-
connectBName
public java.lang.String connectBName
-
connectCName
public java.lang.String connectCName
-
connectDName
public java.lang.String connectDName
-
tBlockAName
public java.lang.String tBlockAName
-
tBlockBName
public java.lang.String tBlockBName
-
tBlockCName
public java.lang.String tBlockCName
-
tBlockDName
public java.lang.String tBlockDName
-
active
boolean active
-
-
Constructor Detail
-
LayoutTurnout
protected LayoutTurnout(@Nonnull java.lang.String id, @Nonnull LayoutEditor models, LayoutTurnout.TurnoutType t)
-
LayoutTurnout
protected LayoutTurnout(@Nonnull java.lang.String id, @Nonnull LayoutEditor models)
-
LayoutTurnout
public LayoutTurnout(@Nonnull java.lang.String id, LayoutTurnout.TurnoutType t, @Nonnull LayoutEditor models)
-
LayoutTurnout
public LayoutTurnout(@Nonnull java.lang.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 Detail
-
isTurnoutTypeTurnout
public static boolean isTurnoutTypeTurnout(LayoutTurnout.TurnoutType type)
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
public boolean isTurnoutTypeTurnout()
Returns true if this is a turnout (not a crossover or slip)- Returns:
- boolean true if this is a turnout
-
isTurnoutTypeXover
public static boolean isTurnoutTypeXover(LayoutTurnout.TurnoutType type)
Returns true if this is a crossover- Parameters:
type
- the turnout type- Returns:
- boolean true if this is a crossover
-
isTurnoutTypeXover
public boolean isTurnoutTypeXover()
Returns true if this is a crossover- Returns:
- boolean true if this is a crossover
-
isTurnoutTypeSlip
public static boolean isTurnoutTypeSlip(LayoutTurnout.TurnoutType type)
Returns true if this is a slip- Parameters:
type
- the turnout type- Returns:
- boolean true if this is a slip
-
isTurnoutTypeSlip
public boolean isTurnoutTypeSlip()
Returns true if this is a slip- Returns:
- boolean true if this is a slip
-
hasEnteringSingleTrack
public static boolean hasEnteringSingleTrack(LayoutTurnout.TurnoutType type)
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
public boolean hasEnteringSingleTrack()
Returns true if this has a single-track entrance end. (turnout or wye)- Returns:
- boolean true if single track entrance
-
hasEnteringDoubleTrack
public static boolean hasEnteringDoubleTrack(LayoutTurnout.TurnoutType type)
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
public boolean hasEnteringDoubleTrack()
Returns true if this has double track on the entrance end (crossover or slip)- Returns:
- boolean true if double track entrance
-
getVersion
public int getVersion()
Get the Version.- Returns:
- turnout version.
-
setVersion
public void setVersion(int v)
-
useBlockSpeed
public boolean useBlockSpeed()
-
getTurnoutName
@Nonnull public java.lang.String getTurnoutName()
-
getSecondTurnoutName
@Nonnull public java.lang.String getSecondTurnoutName()
-
isSecondTurnoutInverted
public boolean isSecondTurnoutInverted()
-
getBlockName
@Nonnull public java.lang.String getBlockName()
-
getBlockBName
@Nonnull public java.lang.String getBlockBName()
-
getBlockCName
@Nonnull public java.lang.String getBlockCName()
-
getBlockDName
@Nonnull public java.lang.String getBlockDName()
-
getSignalHead
@CheckForNull public SignalHead getSignalHead(LayoutTurnout.Geometry loc)
-
getSignalA1
@CheckForNull public SignalHead getSignalA1()
-
getSignalA1Name
@Nonnull public java.lang.String getSignalA1Name()
-
setSignalA1Name
public void setSignalA1Name(@CheckForNull java.lang.String signalHead)
-
getSignalA2
@CheckForNull public SignalHead getSignalA2()
-
getSignalA2Name
@Nonnull public java.lang.String getSignalA2Name()
-
setSignalA2Name
public void setSignalA2Name(@CheckForNull java.lang.String signalHead)
-
getSignalA3
@CheckForNull public SignalHead getSignalA3()
-
getSignalA3Name
@Nonnull public java.lang.String getSignalA3Name()
-
setSignalA3Name
public void setSignalA3Name(@CheckForNull java.lang.String signalHead)
-
getSignalB1
@CheckForNull public SignalHead getSignalB1()
-
getSignalB1Name
@Nonnull public java.lang.String getSignalB1Name()
-
setSignalB1Name
public void setSignalB1Name(@CheckForNull java.lang.String signalHead)
-
getSignalB2
@CheckForNull public SignalHead getSignalB2()
-
getSignalB2Name
@Nonnull public java.lang.String getSignalB2Name()
-
setSignalB2Name
public void setSignalB2Name(@CheckForNull java.lang.String signalHead)
-
getSignalC1
@CheckForNull public SignalHead getSignalC1()
-
getSignalC1Name
@Nonnull public java.lang.String getSignalC1Name()
-
setSignalC1Name
public void setSignalC1Name(@CheckForNull java.lang.String signalHead)
-
getSignalC2
@CheckForNull public SignalHead getSignalC2()
-
getSignalC2Name
@Nonnull public java.lang.String getSignalC2Name()
-
setSignalC2Name
public void setSignalC2Name(@CheckForNull java.lang.String signalHead)
-
getSignalD1
@CheckForNull public SignalHead getSignalD1()
-
getSignalD1Name
@Nonnull public java.lang.String getSignalD1Name()
-
setSignalD1Name
public void setSignalD1Name(@CheckForNull java.lang.String signalHead)
-
getSignalD2
@CheckForNull public SignalHead getSignalD2()
-
getSignalD2Name
@Nonnull public java.lang.String getSignalD2Name()
-
setSignalD2Name
public void setSignalD2Name(@CheckForNull java.lang.String signalHead)
-
removeBeanReference
public void removeBeanReference(@CheckForNull NamedBean nb)
-
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:
canRemove
in classLayoutTrack
- Returns:
- true if the layout track object can be deleted.
-
getBeanReferences
@Nonnull public java.util.ArrayList<java.lang.String> getBeanReferences(java.lang.String pointName)
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
@Nonnull public java.lang.String getSignalAMastName()
-
getSignalAMast
public SignalMast getSignalAMast()
-
setSignalAMast
public void setSignalAMast(@CheckForNull java.lang.String signalMast)
-
getSignalBMastName
@Nonnull public java.lang.String getSignalBMastName()
-
getSignalBMast
public SignalMast getSignalBMast()
-
setSignalBMast
public void setSignalBMast(@CheckForNull java.lang.String signalMast)
-
getSignalCMastName
@Nonnull public java.lang.String getSignalCMastName()
-
getSignalCMast
public SignalMast getSignalCMast()
-
setSignalCMast
public void setSignalCMast(@CheckForNull java.lang.String signalMast)
-
getSignalDMastName
@Nonnull public java.lang.String getSignalDMastName()
-
getSignalDMast
public SignalMast getSignalDMast()
-
setSignalDMast
public void setSignalDMast(@CheckForNull java.lang.String signalMast)
-
getSensorAName
@Nonnull public java.lang.String getSensorAName()
-
getSensorA
@CheckForNull public Sensor getSensorA()
-
setSensorA
public void setSensorA(@CheckForNull java.lang.String sensorName)
-
getSensorBName
@Nonnull public java.lang.String getSensorBName()
-
getSensorB
@CheckForNull public Sensor getSensorB()
-
setSensorB
public void setSensorB(@CheckForNull java.lang.String sensorName)
-
getSensorCName
@Nonnull public java.lang.String getSensorCName()
-
getSensorC
@CheckForNull public Sensor getSensorC()
-
setSensorC
public void setSensorC(@CheckForNull java.lang.String sensorName)
-
getSensorDName
@Nonnull public java.lang.String getSensorDName()
-
getSensorD
@CheckForNull public Sensor getSensorD()
-
setSensorD
public void setSensorD(@CheckForNull java.lang.String sensorName)
-
getLinkedTurnoutName
@Nonnull public java.lang.String getLinkedTurnoutName()
-
setLinkedTurnoutName
public void setLinkedTurnoutName(@Nonnull java.lang.String s)
-
getLinkType
public LayoutTurnout.LinkType getLinkType()
-
setLinkType
public void setLinkType(LayoutTurnout.LinkType ltype)
-
getTurnoutType
public LayoutTurnout.TurnoutType getTurnoutType()
-
getConnectA
public LayoutTrack getConnectA()
-
getConnectB
public LayoutTrack getConnectB()
-
getConnectC
public LayoutTrack getConnectC()
-
getConnectD
public LayoutTrack getConnectD()
-
getTurnout
public Turnout 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
public int getContinuingSense()
-
isInContinuingSenseState
public boolean isInContinuingSenseState()
- Returns:
- true is the continuingSense matches the known state
-
setTurnout
public void setTurnout(@Nonnull java.lang.String tName)
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:
tName
- provide empty string for none; never null
-
getSecondTurnout
public Turnout getSecondTurnout()
-
setSecondTurnout
public void setSecondTurnout(@Nonnull java.lang.String tName)
- Parameters:
tName
- provide empty string for none (not null)
-
setSecondTurnoutInverted
public void setSecondTurnoutInverted(boolean inverted)
-
setContinuingSense
public void setContinuingSense(int sense)
-
setDisabled
public void setDisabled(boolean state)
-
isDisabled
public boolean isDisabled()
-
setDisableWhenOccupied
public void setDisableWhenOccupied(boolean state)
-
isDisabledWhenOccupied
public boolean isDisabledWhenOccupied()
-
getConnection
@CheckForNull public LayoutTrack getConnection(HitPointType connectionType)
get the LayoutTrack connected at the specified connection type- Specified by:
getConnection
in 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:
setConnection
in 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
public void setConnectA(@CheckForNull LayoutTrack o, HitPointType type)
-
setConnectB
public void setConnectB(@CheckForNull LayoutTrack o, HitPointType type)
-
setConnectC
public void setConnectC(@CheckForNull LayoutTrack o, HitPointType type)
-
setConnectD
public void setConnectD(@CheckForNull LayoutTrack o, HitPointType type)
-
getLayoutBlock
public LayoutBlock getLayoutBlock()
-
getLayoutBlockB
public LayoutBlock getLayoutBlockB()
-
getLayoutBlockC
public LayoutBlock getLayoutBlockC()
-
getLayoutBlockD
public LayoutBlock getLayoutBlockD()
-
updateBlockInfo
public void updateBlockInfo()
-
setLayoutBlock
protected void setLayoutBlock(LayoutBlock newLayoutBlock)
Set up Layout Block(s) for this Turnout.- Parameters:
newLayoutBlock
- the new layout block.
-
setLayoutBlockB
protected void setLayoutBlockB(LayoutBlock newLayoutBlock)
-
setLayoutBlockC
protected void setLayoutBlockC(@CheckForNull LayoutBlock newLayoutBlock)
-
setLayoutBlockD
protected void setLayoutBlockD(LayoutBlock newLayoutBlock)
-
setLayoutBlockByName
public void setLayoutBlockByName(@Nonnull java.lang.String name)
-
setLayoutBlockBByName
public void setLayoutBlockBByName(@Nonnull java.lang.String name)
-
setLayoutBlockCByName
public void setLayoutBlockCByName(@Nonnull java.lang.String name)
-
setLayoutBlockDByName
public void setLayoutBlockDByName(@Nonnull java.lang.String name)
-
isMainlineA
public boolean 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
public boolean isMainlineB()
-
isMainlineC
public boolean isMainlineC()
-
isMainlineD
public boolean isMainlineD()
-
isMainline
public boolean isMainline()
- Specified by:
isMainline
in classLayoutTrack
-
toggleTurnout
public void toggleTurnout()
Toggle turnout if clicked on, physical turnout exists, and not disabled.
-
setState
public void setState(int state)
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
public int 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
public void setObjects(@Nonnull LayoutEditor p)
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:
setObjects
in classLayoutTrack
- Parameters:
p
- the layout editor
-
getBlockBoundaries
public java.lang.String[] getBlockBoundaries()
-
getProtectedBlocks
@Nonnull public java.util.ArrayList<LayoutBlock> getProtectedBlocks(NamedBean bean)
-
removeSML
protected void removeSML(@CheckForNull SignalMast signalMast)
-
remove
public void remove()
Remove this object from display and persistance.
-
isActive
public boolean 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
public void reCheckBlockBoundary()
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundary
in classLayoutTrack
-
getLayoutConnectivity
@Nonnull protected java.util.List<LayoutConnectivity> getLayoutConnectivity()
get the layout connectivity for this track- Specified by:
getLayoutConnectivity
in classLayoutTrack
- 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:
checkForFreeConnections
in classLayoutTrack
- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
public boolean checkForUnAssignedBlocks()
determine if all the appropriate blocks have been assigned to this track- Specified by:
checkForUnAssignedBlocks
in classLayoutTrack
- 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:
checkForNonContiguousBlocks
in classLayoutTrack
- 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:
collectContiguousTracksNamesInBlockNamed
in classLayoutTrack
- 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:
setAllLayoutBlocks
in classLayoutTrack
- Parameters:
layoutBlock
- to this layout block (used by the Tools menu's "Assign block to selection" item)
-
getTypeName
public java.lang.String getTypeName()
Get the type of this item.- Specified by:
getTypeName
in classLayoutTrack
- Returns:
- the type
-
setShowToolTip
public void setShowToolTip(boolean set)
-
showToolTip
public boolean showToolTip()
-
setToolTip
public void setToolTip(ToolTip tip)
-
getToolTip
public ToolTip getToolTip()
-
getNameString
@Nonnull public java.lang.String getNameString()
-
-