Class LayoutTrack
- Direct Known Subclasses:
LayoutTurnout,LayoutTurntable,LevelXing,PositionablePoint,TrackSegment
This is the connectivity/topology information for the layout; the
display information, including screen geometry, is held in LayoutTrackView subclasses.
- One or more connections, consisting of a LayoutTrack name and
HitPointType - Mainline status
- Associated
- Blocks
- Signal heads and masts
- Sensors
- Turnout controls
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanCheck for active block boundaries.abstract List<HitPointType>return a list of the available connections for this layout trackabstract voidcheck this track and its neighbors for non-contiguous blocksabstract booleandetermine if all the appropriate blocks have been assigned to this trackabstract voidcollectContiguousTracksNamesInBlockNamed(String blockName, Set<String> TrackNameSet) recursive routine to check for all contiguous tracks in this blockNameabstract LayoutTrackgetConnection(HitPointType connectionType) get the LayoutTrack connected at the specified connection typefinal StringgetId()Get the track ID.protected abstract List<LayoutConnectivity>get the layout connectivity for this trackfinal StringgetName()final StringgetTurnoutStateString(int turnoutState) get turnout state stringabstract StringGet the type of this item.booleanisDisconnected(HitPointType connectionType) return true if this connection type is disconnectedabstract booleanprotected abstract voidabstract method... subclasses should implement _IF_ they need to recheck their block boundariesabstract voidsetAllLayoutBlocks(LayoutBlock layoutBlock) Assign all the layout blocks in this trackabstract voidsetConnection(HitPointType connectionType, LayoutTrack o, HitPointType type) set the LayoutTrack connected at the specified connection typeprotected final voidabstract voidInitialization method for LayoutTrack sub-classes.
-
Field Details
-
models
-
-
Constructor Details
-
LayoutTrack
Constructor method.- Parameters:
ident- track ID.models- main layout editor.
-
-
Method Details
-
getId
Get the track ID.- Returns:
- track ident.
-
getName
-
getTypeName
Get the type of this item.- Returns:
- the type
-
setIdent
-
isMainline
-
getTurnoutStateString
get turnout state string- Parameters:
turnoutState- of the turnout- Returns:
- the turnout state string
-
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.
- Returns:
- true if the layout track object can be deleted.
-
setObjects
Initialization method for LayoutTrack sub-classes. The following method is called for each instance after the entire LayoutEditor is loaded to set the specific objects for that instance- Parameters:
le- the layout editor
-
getConnection
get the LayoutTrack connected at the specified connection type- 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 abstract void setConnection(HitPointType connectionType, LayoutTrack o, HitPointType type) throws JmriException set the LayoutTrack connected at the specified connection type- 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
-
reCheckBlockBoundary
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries -
getLayoutConnectivity
get the layout connectivity for this track- Returns:
- the list of Layout Connectivity objects
-
isDisconnected
return true if this connection type is disconnected- Parameters:
connectionType- the connection type to test- Returns:
- true if the connection for this connection type is free
-
checkForFreeConnections
return a list of the available connections for this layout track- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
determine if all the appropriate blocks have been assigned to this track- Returns:
- true if all appropriate blocks have been assigned
-
checkForNonContiguousBlocks
public abstract void checkForNonContiguousBlocks(@Nonnull HashMap<String, List<Set<String>>> blockNamesToTrackNameSetMaps) 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)
- Parameters:
blockNamesToTrackNameSetMaps- hashmap of key:block names to lists of track name sets for those blocks
-
collectContiguousTracksNamesInBlockNamed
public abstract void collectContiguousTracksNamesInBlockNamed(@Nonnull String blockName, @Nonnull Set<String> TrackNameSet) recursive routine to check for all contiguous tracks in this blockName- 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- Parameters:
layoutBlock- to this layout block (used by the Tools menu's "Assign block to selection" item)
-