Class LevelXing
A LevelXing has four connection points, designated A, B, C, and D. At the
crossing, A-C and B-D are straight segments. A train proceeds through the
crossing on either of these segments.
A D
\\ //
X
// \\
B C
Each straight segment carries Block information. A-C and B-D may be in the same or different Layout Blocks.
For drawing purposes, each LevelXing 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 LevelXings are first created, there are no connections. Block information and connections are added when available.
Signal Head names are saved here to keep track of where signals are. LevelXing only serves as a storage place for signal head names. The names are placed here by Set Signals at Level Crossing in Tools menu.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanprotected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalMast>(package private) ArrayList<SignalMast>Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
models -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanCheck 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 level crossing point.String[]getConnection(HitPointType connectionType) get the LayoutTrack connected at the specified connection typeprotected ArrayList<LayoutConnectivity>get the layout connectivity for this trackGet the type of this item.booleanisActive()Get if active.booleanbooleanTest if mainline track or not.booleanvoidabstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidremove()Remove this object from display and persistance.voidvoid(package private) 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 typevoidsetLayoutBlockAC(LayoutBlock newLayoutBlock) Add Layout Blocks.voidsetLayoutBlockBD(LayoutBlock newLayoutBlock) voidInitialization method The above variables are initialized by PositionablePointXml, then the following method is called after the entire LayoutEditor is loaded to set the specific TrackSegment objects.voidsetSensorAName(String sensorName) voidsetSensorBName(String sensorName) voidsetSensorCName(String sensorName) voidsetSensorDName(String sensorName) voidsetSignalAMast(String signalMast) voidsetSignalAName(String signalHead) voidsetSignalBMast(String signalMast) voidsetSignalBName(String signalHead) voidsetSignalCMast(String signalMast) voidsetSignalCName(String signalHead) voidsetSignalDMast(String signalMast) voidsetSignalDName(String signalHead) toString()voidMethods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
getId, getName, getTurnoutStateString, isDisconnected, setIdent
-
Field Details
-
signalAHeadNamed
-
signalBHeadNamed
-
signalCHeadNamed
-
signalDHeadNamed
-
signalAMastNamed
-
signalBMastNamed
-
signalCMastNamed
-
signalDMastNamed
-
connectAName
-
connectBName
-
connectCName
-
connectDName
-
tLayoutBlockNameAC
-
tLayoutBlockNameBD
-
active
boolean active -
sml
-
-
Constructor Details
-
LevelXing
Constructor.- Parameters:
id- ID string.models- the main layout editor.
-
-
Method Details
-
toString
-
getBlockNameAC
-
getBlockNameBD
-
getSignalHead
-
getSignalMast
-
getSensor
-
getSignalAName
-
setSignalAName
-
getSignalBName
-
setSignalBName
-
getSignalCName
-
setSignalCName
-
getSignalDName
-
setSignalDName
-
removeBeanReference
-
getSignalAMastName
-
getSignalAMast
-
setSignalAMast
-
getSignalBMastName
-
getSignalBMast
-
setSignalBMast
-
getSignalCMastName
-
getSignalCMast
-
setSignalCMast
-
getSignalDMastName
-
getSignalDMast
-
setSignalDMast
-
getSensorAName
-
getSensorA
-
setSensorAName
-
getSensorBName
-
getSensorB
-
setSensorBName
-
getSensorCName
-
getSensorC
-
setSensorCName
-
getSensorDName
-
getSensorD
-
setSensorDName
-
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
- Throws:
JmriException- - if the connectionType is invalid
-
setConnection
public void setConnection(HitPointType connectionType, 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
-
getConnectA
-
getConnectB
-
getConnectC
-
getConnectD
-
setConnectA
-
setConnectB
-
setConnectC
-
setConnectD
-
getLayoutBlockAC
-
getLayoutBlockBD
-
setLayoutBlockAC
Add Layout Blocks.- Parameters:
newLayoutBlock- the layout block to add.
-
setLayoutBlockBD
-
updateBlockInfo
-
removeSML
-
isMainlineAC
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
-
isMainlineBD
-
isMainline
- Specified by:
isMainlinein classLayoutTrack
-
setObjects
Initialization method The above variables are initialized by PositionablePointXml, 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
-
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 level crossing point.- Parameters:
pointName- Specify the point (A-D) or all (All) points.- Returns:
- a list of bean reference names.
-
getBlockBoundaries
-
remove
Remove this object from display and persistance. -
isActive
Get if active. "active" means that the object is still displayed, and should be stored.- Returns:
- true if still displayed, else false.
-
addSignalMastLogic
-
removeSignalMastLogic
-
reCheckBlockBoundary
Description copied from class:LayoutTrackabstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundaryin classLayoutTrack
-
getLayoutConnectivity
Description copied from class:LayoutTrackget 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
-