Class PositionablePoint
Three types of Positionable Point are supported: Anchor - point on track - two track connections End Bumper - end of track point - one track connection Edge Connector - This is used to link track segments between two different panels
Note that a PositionablePoint exists for specifying connectivity and drawing position only. The Track Segments connected to a PositionablePoint may belong to the same block or to different blocks. Since each Track Segment may only belong to one block, a PositionablePoint may function as a Block Boundary.
As an Edge Connector, this is a semi-transparent connection to a remote TrackSeqment via another Edge Connector object.
Signal names are saved here at a Block Boundary anchor point by the tool Set Signals at Block Boundary. PositionablePoint does nothing with these signal head names; it only serves as a place to store them.
Arrows and bumpers are visual presentation aspects handled in the View.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
models -
Constructor Summary
ConstructorsConstructorDescriptionPositionablePoint(String id, PositionablePoint.PointType t, LayoutEditor models) -
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 blockNameProvide the destination TrackSegment of the 1st connection.protected intProvide the destination TrackSegment of the 2nd connection.Provide the destination TrackSegment of the 2nd connection without doing the look-through present ingetConnect2()getConnection(HitPointType connectionType) get the LayoutTrack connected at the specified connection typeprotected List<LayoutConnectivity>get the layout connectivity for this trackprotected LayoutEditorBuild a list of sensors, signal heads, and signal masts attached to a connection point.getType()Get the point type.Get the type of this item.protected booleanisActive()"active" means that the object is still displayed, and should be stored.booleanisDisconnected(HitPointType connectionType) return true if this connection type is disconnectedbooleanvoidabstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidremove()Removes this object from display and persistencevoid(package private) void(package private) voidremoveSML(SignalMast signalMast) booleanremove a connection to a trackbooleanreplaceTrackConnection(TrackSegment oldTrack, TrackSegment newTrack) replace old track connection with new track connectionvoidsetAllLayoutBlocks(LayoutBlock layoutBlock) Assign all the layout blocks in this trackvoidsetConnect1(TrackSegment trk) voidvoidsetConnection(HitPointType connectionType, LayoutTrack o, HitPointType type) set the LayoutTrack connected at the specified connection typevoidsetEastBoundSensor(String sensorName) voidsetEastBoundSignal(String signalName) voidsetEastBoundSignalMast(String signalMast) voidvoidInitialization 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.booleansetTrackConnection(TrackSegment track) setup a connection to a trackvoidsetType(PositionablePoint.PointType newType) (package private) void(package private) void(package private) voidvoidsetWestBoundSensor(String sensorName) voidsetWestBoundSignal(String signalName) voidsetWestBoundSignalMast(String signalMast) toString()Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrack
getId, getName, getTurnoutStateString, setIdent
-
Field Details
-
signalEastHeadNamed
-
signalWestHeadNamed
-
trackSegment1Name
-
trackSegment2Name
-
-
Constructor Details
-
PositionablePoint
-
-
Method Details
-
toString
-
getType
Get the point type.- Returns:
- point type, i.e. ANCHOR, END_BUMPER, EDGE_CONNECTOR
-
setType
-
setTypeAnchor
void setTypeAnchor() -
setTypeEndBumper
void setTypeEndBumper() -
setTypeEdgeConnector
void setTypeEdgeConnector() -
getConnect1
Provide the destination TrackSegment of the 1st connection.- Returns:
- destination track segment
-
setConnect1
-
getConnect2
Provide the destination TrackSegment of the 2nd connection. When this is an EDGE CONNECTOR, it looks through the linked point (if any) to the far-end track connection.- Returns:
- destination track segment
-
getConnect2Actual
Provide the destination TrackSegment of the 2nd connection without doing the look-through present ingetConnect2()- Returns:
- destination track segment
-
setConnect2Actual
-
getLinkedEditorName
-
getLinkedPoint
-
getLinkedPointId
-
setLinkedPoint
-
getLinkedEditor
-
getLayoutEditor
-
getEastBoundSignal
-
getEastBoundSignalHead
-
setEastBoundSignal
-
getWestBoundSignal
-
getWestBoundSignalHead
-
setWestBoundSignal
-
getEastBoundSensorName
-
getEastBoundSensor
-
setEastBoundSensor
-
getWestBoundSensorName
-
getWestBoundSensor
-
setWestBoundSensor
-
getEastBoundSignalMastName
-
getEastBoundSignalMast
-
getEastBoundSignalMastNamed
-
setEastBoundSignalMast
-
getWestBoundSignalMastName
-
getWestBoundSignalMast
-
getWestBoundSignalMastNamed
-
setWestBoundSignalMast
-
removeBeanReference
-
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
-
setTrackConnection
setup a connection to a track- Parameters:
track- the track we want to connect to- Returns:
- true if successful
-
removeTrackConnection
remove a connection to a track- Parameters:
track- the track we want to disconnect from- Returns:
- true if successful
-
replaceTrackConnection
public boolean replaceTrackConnection(@CheckForNull TrackSegment oldTrack, @CheckForNull TrackSegment newTrack) replace old track connection with new track connection- Parameters:
oldTrack- the old track connectionnewTrack- the new track connection- Returns:
- true if successful
-
removeSML
-
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.
-
getSegmentReferences
Build a list of sensors, signal heads, and signal masts attached to a connection point.- Parameters:
ts- The track segment to be checked.- Returns:
- a list of bean reference names.
-
removeLinkedPoint
void removeLinkedPoint() -
remove
Removes this object from display and persistence -
isActive
"active" means that the object is still displayed, and should be stored.- Returns:
- true if active
-
getConnect1Dir
-
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
-
isDisconnected
return true if this connection type is disconnected- Overrides:
isDisconnectedin classLayoutTrack- Parameters:
connectionType- the connection type to test- Returns:
- true if the connection for this connection type is free
-
isMainline
- Specified by:
isMainlinein classLayoutTrack
-
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
-