Package jmri.jmrit.display.layoutEditor
Class LayoutTraverserView
java.lang.Object
jmri.jmrit.display.layoutEditor.LayoutTrackView
jmri.jmrit.display.layoutEditor.LayoutTraverserView
- All Implemented Interfaces:
InlineLogixNG
MVC View component for the LayoutTraverser class.
-
Field Summary
FieldsFields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
decorations, layoutEditor, NUM_ARROW_TYPES -
Constructor Summary
ConstructorsConstructorDescriptionLayoutTraverserView(LayoutTraverser traverser, 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 blockNamevoiddispose()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 decorationsprotected voiddraw the edit controlsprotected voidDraw the turnout controlsprotected HitPointTypefindHitPointType(Point2D hitPoint, boolean useRectangles, boolean requireUnconnected) find the hit (location) type for a pointgetConnection(HitPointType connectionType) get the LayoutTrack connected at the specified connection typegetCoordsForConnectionType(HitPointType connectionType) return the coordinates for a specified connection type (abstract: should be overridden by ALL subclasses)doubleprotected List<LayoutConnectivity>get the layout connectivity for this trackintintintgetSlotConnectIndexed(int index) getSlotConnectOrdered(int i) getSlotCoordsIndexed(int index) getSlotCoordsOrdered(int i) intgetSlotIndex(int i) doublegetSlotOffsetValue(int i) getSlotTurnout(int i) getSlotTurnoutName(int i) intgetSlotTurnoutState(int i) final LayoutTraverserprotected voidhighlightUnconnected(Graphics2D g2, HitPointType specificType) highlight unconnected connectionsbooleanisActive()booleanisMainlineIndexed(int index) booleanisMainlineOrdered(int i) booleanisSlotDisabled(int i) booleanisSlotDisabledWhenOccupied(int i) booleanprotected voidabstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidremove()voidrotateCoords(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 typevoidsetLayoutBlock(LayoutBlock newLayoutBlock) Set up a LayoutBlock for this LayoutTraverser.voidsetLayoutBlockByName(String name) Set up a LayoutBlock for this LayoutTraverser.voidsetOrientation(int o) voidsetPosition(int index) voidsetSlotConnect(TrackSegment ts, int index) voidsetSlotCoordsIndexed(double x, double y, int index) voidsetSlotCoordsIndexed(Point2D point, int index) voidsetSlotDisabled(int i, boolean boo) voidsetSlotDisabledWhenOccupied(int i, boolean boo) voidsetSlotTurnout(int index, String turnoutName, int state) voidsetTurnoutControlled(boolean boo) protected JPopupMenushowPopup(JmriMouseEvent mouseEvent) show the popup menu for this layout trackprotected voidshowSlotPopUp(JmriMouseEvent e, int index) toString()Get a string that represents this object.voidtranslateCoords(double xFactor, double yFactor) translate this LayoutTrack's coordinates by the x and y factorsMethods 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, isDisconnected, isHidden, loadArrowImageToJCBItem, removeInlineLogixNG, rotatePoint, setColorForTrackBlock, setColorForTrackBlock, setCoordsCenter, setDecorations, setHidden, setIdent, setLogixNG, setLogixNG_SystemName, setLogixNGPositionableMenu, setupLogixNG, showPopup, showPopup, trackControlCircleAt, trackControlCircleRectAt, trackEditControlCircleAt
-
Field Details
-
tLayoutBlockName
-
-
Constructor Details
-
LayoutTraverserView
public LayoutTraverserView(@Nonnull LayoutTraverser traverser, @Nonnull Point2D c, @Nonnull LayoutEditor layoutEditor) Constructor method.- Parameters:
traverser- the layout traverser to create view for.c- where to put itlayoutEditor- what layout editor panel to put it in
-
-
Method Details
-
getTraverser
-
toString
Get a string that represents this object. This should only be used for debugging. -
getDeckLength
-
getOrientation
-
setOrientation
-
getBlockName
- Returns:
- the layout block name
-
getLayoutBlock
- Returns:
- the layout block
-
setLayoutBlock
Set up a LayoutBlock for this LayoutTraverser.- Parameters:
newLayoutBlock- the LayoutBlock to set
-
setLayoutBlockByName
Set up a LayoutBlock for this LayoutTraverser.- Parameters:
name- the name of the new LayoutBlock
-
getBounds
- Specified by:
getBoundsin classLayoutTrackView- Returns:
- the bounds of this traverser.
-
getSlotConnectIndexed
-
getSlotConnectOrdered
-
setSlotConnect
-
getSlotList
-
getNumberSlots
-
getSlotIndex
-
getSlotOffsetValue
-
setSlotTurnout
-
getSlotTurnoutName
-
getSlotTurnout
-
getSlotTurnoutState
-
isSlotDisabled
-
setSlotDisabled
-
isSlotDisabledWhenOccupied
-
setSlotDisabledWhenOccupied
-
getSlotCoordsIndexed
-
getSlotCoordsOrdered
-
setSlotCoordsIndexed
-
setSlotCoordsIndexed
-
getCoordsForConnectionType
Description copied from class:LayoutTrackViewreturn the coordinates for a specified connection type (abstract: should be overridden by ALL subclasses)- Specified by:
getCoordsForConnectionTypein classLayoutTrackView- Parameters:
connectionType- the connection type- Returns:
- the coordinates for the specified connection type
-
getConnection
Description copied from class:LayoutTrackViewget 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 Description copied from class:LayoutTrackViewset 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
-
isMainlineIndexed
-
isMainlineOrdered
-
scaleCoords
Description copied from class:LayoutTrackViewscale 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
Description copied from class:LayoutTrackViewtranslate 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
Description copied from class:LayoutTrackViewrotate this LayoutTrack's coordinates by angleDEG's- Specified by:
rotateCoordsin classLayoutTrackView- Parameters:
angleDEG- the amount to rotate in degrees
-
findHitPointType
protected HitPointType findHitPointType(Point2D hitPoint, boolean useRectangles, boolean requireUnconnected) Description copied from class:LayoutTrackViewfind 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)
-
isTurnoutControlled
-
setTurnoutControlled
-
showPopup
Description copied from class:LayoutTrackViewshow 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
-
showSlotPopUp
-
setPosition
-
getPosition
-
dispose
-
remove
-
isActive
-
drawDecorations
Description copied from class:LayoutTrackViewDraw track decorations- Specified by:
drawDecorationsin classLayoutTrackView- Parameters:
g2- the graphics context
-
draw1
Description copied from class:LayoutTrackViewdraw 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
Description copied from class:LayoutTrackViewdraw 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
Description copied from class:LayoutTrackViewhighlight unconnected connections- Specified by:
highlightUnconnectedin classLayoutTrackView- Parameters:
g2- the graphics contextspecificType- the specific connection to draw (or NONE for all)
-
drawTurnoutControls
Description copied from class:LayoutTrackViewDraw the turnout controls- Specified by:
drawTurnoutControlsin classLayoutTrackView- Parameters:
g2- the graphics context
-
drawEditControls
Description copied from class:LayoutTrackViewdraw the edit controls- Specified by:
drawEditControlsin classLayoutTrackView- Parameters:
g2- the graphics context
-
reCheckBlockBoundary
Description copied from class:LayoutTrackViewabstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundaryin classLayoutTrackView
-
getLayoutConnectivity
Description copied from class:LayoutTrackViewget the layout connectivity for this track- Specified by:
getLayoutConnectivityin classLayoutTrackView- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
Description copied from class:LayoutTrackViewreturn a list of the available connections for this layout track- Specified by:
checkForFreeConnectionsin classLayoutTrackView- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
Description copied from class:LayoutTrackViewdetermine 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) Description copied from class:LayoutTrackViewcheck 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) Description copied from class:LayoutTrackViewrecursive 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
Description copied from class:LayoutTrackViewAssign 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)
-
canRemove
Description copied from class:LayoutTrackViewCheck 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.
-