Package jmri.jmrit.display.layoutEditor
Class PositionablePointView
java.lang.Object
jmri.jmrit.display.layoutEditor.LayoutTrackView
jmri.jmrit.display.layoutEditor.PositionablePointView
- All Implemented Interfaces:
InlineLogixNG
MVC View component for the PositionablePoint class.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) JDialog(package private) JComboBox<JCBHandle<LayoutEditor>>protected NamedBeanHandle<SignalHead>protected NamedBeanHandle<SignalHead>(package private) int(package private) intFields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
decorations, layoutEditor, NUM_ARROW_TYPES -
Constructor Summary
ConstructorsConstructorDescriptionPositionablePointView(PositionablePoint point, Point2D c, LayoutEditor layoutEditor) 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 blockName(package private) voiddispose()Clean up when this object is no longer needed.protected voiddraw1(Graphics2D g2, boolean isMain, boolean isBlock) draw one line (Ballast, ties, center or 3rd rail, block lines)protected voiddraw2(Graphics2D g2, boolean isMain, float railDisplacement) draw two lines (rails)protected voidDraw track decorations.protected voiddraw the edit controlsprotected voidDraw the turnout controlsprotected HitPointTypefindHitPointType(Point2D hitPoint, boolean useRectangles, boolean requireUnconnected) find the hit (location) type for a pointprotected intgetConnection(HitPointType connectionType) get the LayoutTrack connected at the specified connection typegetCoordsForConnectionType(HitPointType connectionType) return the coordinates for a specified connection typeprotected List<LayoutConnectivity>get the layout connectivity for this trackgetPoint()Build a list of sensors, signal heads, and signal masts attached to a connection point.getType()Accessor methodsprotected voidhighlightUnconnected(Graphics2D g2, HitPointType specificType) highlight unconnected connectionsprotected booleanisActive()booleanisDisconnected(HitPointType connectionType) return true if this connection type is disconnectedprotected intprotected intmaxWidth()voidvoidvoidvoidabstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidvoid(package private) voidremoveSML(SignalMast signalMast) booleanremove a connection to a trackbooleanreplaceTrackConnection(TrackSegment oldTrack, TrackSegment newTrack) replace old track connection with new track connectionvoidrotateCoords(double angleDEG) rotate this LayoutTrack's coordinates by angleDEG'svoidscaleCoords(double xFactor, double yFactor) scale this LayoutTrack's coordinates by the x and y factorsvoidsetAllLayoutBlocks(LayoutBlock layoutBlock) Assign all the layout blocks in this trackvoidsetConnection(HitPointType connectionType, LayoutTrack o, HitPointType type) set the LayoutTrack connected at the specified connection typevoidsetEastBoundSensor(String sensorName) voidsetEastBoundSignal(String signalName) voidsetEastBoundSignalMast(String signalMast) (package private) voidsetLink()voidbooleansetTrackConnection(TrackSegment track) setup a connection to a trackvoidsetType(PositionablePoint.PointType newType) voidsetWestBoundSensor(String sensorName) voidsetWestBoundSignal(String signalName) voidsetWestBoundSignalMast(String signalMast) protected JPopupMenushowPopup(JmriMouseEvent mouseEvent) show the popup menu for this layout tracktoString()voidtranslateCoords(double xFactor, double yFactor) translate this LayoutTrack's coordinates by the x and y factorsvoid(package private) voidMethods inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
addCommonPopupItems, displayRemoveWarningDialog, drawHidden, drawLayoutTrackText, findHitPointType, findHitPointType, getColorForTrackBlock, getColorForTrackBlock, getCoordsCenter, getDecorations, getEditorName, getId, getLayoutEditor, getLayoutEditorToolBarPanel, getLayoutTrack, getLogixNG, getName, getNameString, getTurnoutStateString, getTypeName, getX, getY, hasDecorations, highlightUnconnected, isHidden, loadArrowImageToJCBItem, removeInlineLogixNG, rotatePoint, setColorForTrackBlock, setColorForTrackBlock, setCoordsCenter, setDecorations, setHidden, setIdent, setLogixNG, setLogixNG_SystemName, setLogixNGPositionableMenu, setupLogixNG, showPopup, showPopup, trackControlCircleAt, trackControlCircleRectAt, trackEditControlCircleAt
-
Field Details
-
Constructor Details
-
PositionablePointView
public PositionablePointView(@Nonnull PositionablePoint point, Point2D c, @Nonnull LayoutEditor layoutEditor) constructor method.- Parameters:
point- the positionable point.c- location to display the positionable pointlayoutEditor- for access to tools
-
-
Method Details
-
getPoint
-
toString
-
getType
Accessor methods- Returns:
- Type enum for this Positionable Point
-
setType
-
getConnect1
-
getConnect2
-
getLinkedEditorName
-
getLinkedEditor
-
getLinkedPoint
-
removeLinkedPoint
-
getLinkedPointId
-
setLinkedPoint
-
scaleCoords
scale this LayoutTrack's coordinates by the x and y factors- Specified by:
scaleCoordsin classLayoutTrackView- Parameters:
xFactor- the amount to scale X coordinatesyFactor- the amount to scale Y coordinates
-
translateCoords
translate this LayoutTrack's coordinates by the x and y factors- Specified by:
translateCoordsin classLayoutTrackView- Parameters:
xFactor- the amount to translate X coordinatesyFactor- the amount to translate Y coordinates
-
rotateCoords
rotate this LayoutTrack's coordinates by angleDEG's- Specified by:
rotateCoordsin classLayoutTrackView- Parameters:
angleDEG- the amount to rotate in degrees
-
getBounds
- Specified by:
getBoundsin classLayoutTrackView- Returns:
- the bounds of this positional point
-
getEastBoundSignal
-
getEastBoundSignalHead
-
setEastBoundSignal
-
getWestBoundSignal
-
getWestBoundSignalHead
-
setWestBoundSignal
-
getEastBoundSensorName
-
getEastBoundSensor
-
setEastBoundSensor
-
getWestBoundSensorName
-
getWestBoundSensor
-
setWestBoundSensor
-
getEastBoundSignalMastName
-
getEastBoundSignalMast
-
setEastBoundSignalMast
-
getWestBoundSignalMastName
-
getWestBoundSignalMast
-
setWestBoundSignalMast
-
removeBeanReference
-
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
-
maxWidth
-
maxHeight
-
mousePressed
-
mouseReleased
-
mouseClicked
-
showPopup
show the popup menu for this layout track- Specified by:
showPopupin classLayoutTrackView- Parameters:
mouseEvent- the mouse down event that triggered this popup- Returns:
- the popup menu for this layout track
-
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 classLayoutTrackView- 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.
-
dispose
void dispose()Clean up when this object is no longer needed. Should not be called while the object is still displayed; see remove() -
isActive
- Returns:
- "active" true means that the object is still displayed, and should be stored.
-
getConnect1Dir
-
setLink
void setLink() -
getLinkPanel
-
updatePointBox
void updatePointBox() -
updateLink
-
findHitPointType
protected HitPointType findHitPointType(Point2D hitPoint, boolean useRectangles, boolean requireUnconnected) find the hit (location) type for a point- Specified by:
findHitPointTypein classLayoutTrackView- Parameters:
hitPoint- the pointuseRectangles- whether to use (larger) rectangles or (smaller) circles for hit testingrequireUnconnected- whether to only return hit types for free connections- Returns:
- the location type for the point (or NONE)
-
getCoordsForConnectionType
return the coordinates for a specified connection type- Specified by:
getCoordsForConnectionTypein classLayoutTrackView- Parameters:
connectionType- the connection type- Returns:
- the coordinates for the specified connection type
-
getConnection
get the LayoutTrack connected at the specified connection type- Specified by:
getConnectionin classLayoutTrackView- 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 classLayoutTrackView- 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 classLayoutTrackView- Parameters:
connectionType- the connection type to test- Returns:
- true if the connection for this connection type is free
-
drawDecorations
Draw track decorations.This type of track has none, so this method is empty.
- Specified by:
drawDecorationsin classLayoutTrackView- Parameters:
g2- the graphics context
-
draw1
draw one line (Ballast, ties, center or 3rd rail, block lines)- Specified by:
draw1in classLayoutTrackView- Parameters:
g2- the graphics contextisMain- true if drawing mainlinesisBlock- true if drawing block lines
-
draw2
draw two lines (rails)- Specified by:
draw2in classLayoutTrackView- Parameters:
g2- the graphics contextisMain- true if drawing mainlinesrailDisplacement- the offset from center to draw the lines
-
highlightUnconnected
highlight unconnected connections- Specified by:
highlightUnconnectedin classLayoutTrackView- Parameters:
g2- the graphics contextspecificType- the specific connection to draw (or NONE for all)
-
drawEditControls
draw the edit controls- Specified by:
drawEditControlsin classLayoutTrackView- Parameters:
g2- the graphics context
-
drawTurnoutControls
Draw the turnout controls- Specified by:
drawTurnoutControlsin classLayoutTrackView- Parameters:
g2- the graphics context
-
reCheckBlockBoundary
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundaryin classLayoutTrackView
-
getLayoutConnectivity
get the layout connectivity for this track- Specified by:
getLayoutConnectivityin classLayoutTrackView- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
return a list of the available connections for this layout track- Specified by:
checkForFreeConnectionsin classLayoutTrackView- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
determine if all the appropriate blocks have been assigned to this track- Specified by:
checkForUnAssignedBlocksin classLayoutTrackView- 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 classLayoutTrackView- 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 classLayoutTrackView- 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 classLayoutTrackView- Parameters:
layoutBlock- to this layout block (used by the Tools menu's "Assign block to selection" item)
-