Package jmri.jmrit.display.layoutEditor
Class LayoutSlipView
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutTrackView
-
- jmri.jmrit.display.layoutEditor.LayoutTurnoutView
-
- jmri.jmrit.display.layoutEditor.LayoutSlipView
-
- All Implemented Interfaces:
InlineLogixNG
- Direct Known Subclasses:
LayoutDoubleSlipView,LayoutSingleSlipView
public class LayoutSlipView extends LayoutTurnoutView
MVC View component for the LayoutSlip class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLayoutSlipView.TurnoutState
-
Field Summary
Fields Modifier and Type Field Description intcurrentState(package private) javax.swing.JPopupMenupopup-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnoutView
connectAName, connectBName, connectCName, connectDName, dispA, dispB, editAdditionalMenu, editor, INCONSISTENT, namedLayoutBlockA, namedLayoutBlockB, namedLayoutBlockC, namedLayoutBlockD, namedTurnout, pointA, pointB, pointC, pointD, secondNamedTurnout, showUnknown, signalA1HeadNamed, signalA2HeadNamed, signalA3HeadNamed, signalB1HeadNamed, signalB2HeadNamed, signalC1HeadNamed, signalC2HeadNamed, signalD1HeadNamed, signalD2HeadNamed, STATE_AC, STATE_AD, STATE_BC, STATE_BD, tBlockAName, tBlockBName, tBlockCName, tBlockDName, turnoutBXDefault, turnoutCXDefault, turnoutWidDefault, UNKNOWN, viewAdditionalMenu, xOverHWidDefault, xOverLongDefault, xOverShortDefault
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
decorations, layoutEditor, NUM_ARROW_TYPES
-
-
Constructor Summary
Constructors Constructor Description LayoutSlipView(LayoutSlip slip, java.awt.geom.Point2D c, double rot, LayoutEditor layoutEditor)Constructor method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<HitPointType>checkForFreeConnections()return a list of the available connections for this layout trackvoiddispose()Clean up when this object is no longer needed.protected voiddraw1(java.awt.Graphics2D g2, boolean drawMain, boolean isBlock)draw one line (Ballast, ties, center or 3rd rail, block lines)protected voiddraw2(java.awt.Graphics2D g2, boolean drawMain, float railDisplacement)draw two lines (rails)protected voiddrawTurnoutControls(java.awt.Graphics2D g2)Draw the turnout controlsprotected HitPointTypefindHitPointType(java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)find the hit (location) type for a pointjava.lang.String[]getBlockBoundaries()java.awt.geom.Rectangle2DgetBounds()LayoutTrackgetConnection(HitPointType connectionType)get the LayoutTrack connected at the specified connection typeprotected intgetConnectivityStateForLayoutBlocks(LayoutBlock thisLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress)java.awt.geom.Point2DgetCoordsA()java.awt.geom.Point2DgetCoordsB()java.awt.geom.Point2DgetCoordsC()java.awt.geom.Point2DgetCoordsD()java.awt.geom.Point2DgetCoordsForConnectionType(HitPointType connectionType)return the coordinates for the specified connection type(package private) java.awt.geom.Point2DgetCoordsLeft()(package private) java.awt.geom.Point2DgetCoordsRight()java.lang.StringgetDisplayName()protected java.util.List<LayoutConnectivity>getLayoutConnectivity()get the layout connectivity for this trackLayoutSlipgetSlip()intgetSlipState()LayoutTurnout.TurnoutTypegetSlipType()TurnoutgetTurnoutB()java.lang.StringgetTurnoutBName()intgetTurnoutBState(int state)intgetTurnoutState(int state)intgetTurnoutState(Turnout turn, int state)protected voidhighlightUnconnected(java.awt.Graphics2D g2, HitPointType specificType)highlight unconnected connectionsvoidreCheckBlockBoundary()abstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoidremove()Removes this object from display and persistancevoidsetConnection(HitPointType connectionType, LayoutTrack o, HitPointType type)set the LayoutTrack connected at the specified connection typevoidsetCoordsA(java.awt.geom.Point2D p)voidsetCoordsB(java.awt.geom.Point2D p)voidsetCoordsC(java.awt.geom.Point2D p)voidsetCoordsCenter(java.awt.geom.Point2D p)set center coordinatesvoidsetCoordsD(java.awt.geom.Point2D p)voidsetTurnoutB(java.lang.String tName)voidsetTurnoutStates(int state, java.lang.String turnStateA, java.lang.String turnStateB)protected javax.swing.JPopupMenushowPopup(JmriMouseEvent mouseEvent)show the popup menu for this layout trackvoidtoggleState(HitPointType selectedPointType)Toggle slip states if clicked on, physical turnout exists, and not disabledjava.lang.StringtoString()voidupdateBlockInfo()-
Methods inherited from class jmri.jmrit.display.layoutEditor.LayoutTurnoutView
addEditPopUpMenu, addViewPopUpMenu, canRemove, checkForNonContiguousBlocks, checkForUnAssignedBlocks, collectContiguousTracksNamesInBlockNamed, drawDecorations, drawEditControls, getBeanReferences, getBlockBName, getBlockCName, getBlockDName, getBlockName, getConnectA, getConnectB, getConnectC, getConnectD, getContinuingSense, getLayoutBlock, getLayoutBlockB, getLayoutBlockC, getLayoutBlockD, getLayoutTurnout, getLinkedTurnoutName, getLinkType, getProtectedBlocks, getRotationDEG, getSecondTurnout, getSecondTurnoutName, getSensorA, getSensorAName, getSensorB, getSensorBName, getSensorC, getSensorCName, getSensorD, getSensorDName, getShowUnknown, getSignalA1, getSignalA1Name, getSignalA2, getSignalA2Name, getSignalA3, getSignalA3Name, getSignalAMast, getSignalAMastName, getSignalB1, getSignalB1Name, getSignalB2, getSignalB2Name, getSignalBMast, getSignalBMastName, getSignalC1, getSignalC1Name, getSignalC2, getSignalC2Name, getSignalCMast, getSignalCMastName, getSignalD1, getSignalD1Name, getSignalD2, getSignalD2Name, getSignalDMast, getSignalDMastName, getSignalHead, getState, getTurnout, getTurnoutName, getTurnoutType, getVersion, hasEnteringDoubleTrack, hasEnteringDoubleTrack, hasEnteringSingleTrack, hasEnteringSingleTrack, isActive, isDisabled, isDisabledWhenOccupied, isInContinuingSenseState, isMainlineA, isMainlineB, isMainlineC, isMainlineD, isTurnoutTypeSlip, isTurnoutTypeSlip, isTurnoutTypeTurnout, isTurnoutTypeTurnout, isTurnoutTypeXover, isTurnoutTypeXover, reCalculateCenter, removeBeanReference, removeSML, rotateCoords, scaleCoords, setAdditionalEditPopUpMenu, setAdditionalViewPopUpMenu, setAllLayoutBlocks, setConnectA, setConnectB, setConnectC, setConnectD, setContinuingSense, setDisabled, setDisableWhenOccupied, setLayoutBlock, setLayoutBlockB, setLayoutBlockBByName, setLayoutBlockByName, setLayoutBlockC, setLayoutBlockCByName, setLayoutBlockD, setLayoutBlockDByName, setLinkedTurnoutName, setLinkType, setSecondTurnout, setSecondTurnoutInverted, setSensorA, setSensorB, setSensorC, setSensorD, setShowUnknown, setSignalA1Name, setSignalA2Name, setSignalA3Name, setSignalAMast, setSignalB1Name, setSignalB2Name, setSignalBMast, setSignalC1Name, setSignalC2Name, setSignalCMast, setSignalD1Name, setSignalD2Name, setSignalDMast, setState, setTrackSegmentBlock, setTrackSegmentBlocks, setTurnout, setUpDefaultSize, setVersion, toggleTurnout, translateCoords, useBlockSpeed
-
Methods 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, setDecorations, setHidden, setIdent, setLogixNG, setLogixNG_SystemName, setLogixNGPositionableMenu, setupLogixNG, showPopup, showPopup, trackControlCircleAt, trackControlCircleRectAt, trackEditControlCircleAt
-
-
-
-
Field Detail
-
currentState
public int currentState
-
popup
javax.swing.JPopupMenu popup
-
-
Constructor Detail
-
LayoutSlipView
public LayoutSlipView(@Nonnull LayoutSlip slip, java.awt.geom.Point2D c, double rot, @Nonnull LayoutEditor layoutEditor)
Constructor method.- Parameters:
slip- the layout sip to create view for.c- 2D point.rot- rotation.layoutEditor- the layout editor.
-
-
Method Detail
-
getSlip
public LayoutSlip getSlip()
-
toString
public java.lang.String toString()
Description copied from class:LayoutTurnoutView- Overrides:
toStringin classLayoutTurnoutView
-
getSlipType
public LayoutTurnout.TurnoutType getSlipType()
-
getSlipState
public int getSlipState()
-
getTurnoutBName
public java.lang.String getTurnoutBName()
-
getTurnoutB
public Turnout getTurnoutB()
-
setTurnoutB
public void setTurnoutB(@CheckForNull java.lang.String tName)
-
getConnection
public LayoutTrack getConnection(HitPointType connectionType) throws JmriException
get the LayoutTrack connected at the specified connection type- Overrides:
getConnectionin classLayoutTurnoutView- 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, @CheckForNull LayoutTrack o, HitPointType type) throws JmriException
set the LayoutTrack connected at the specified connection type- Overrides:
setConnectionin classLayoutTurnoutView- 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
-
getDisplayName
public java.lang.String getDisplayName()
-
toggleState
public void toggleState(HitPointType selectedPointType)
Toggle slip states if clicked on, physical turnout exists, and not disabled- Parameters:
selectedPointType- SeeLayoutSlip.toggleState(jmri.jmrit.display.layoutEditor.HitPointType)for definition
-
getCoordsA
public java.awt.geom.Point2D getCoordsA()
- Overrides:
getCoordsAin classLayoutTurnoutView
-
getCoordsB
public java.awt.geom.Point2D getCoordsB()
- Overrides:
getCoordsBin classLayoutTurnoutView
-
getCoordsC
public java.awt.geom.Point2D getCoordsC()
- Overrides:
getCoordsCin classLayoutTurnoutView
-
getCoordsD
public java.awt.geom.Point2D getCoordsD()
- Overrides:
getCoordsDin classLayoutTurnoutView
-
getCoordsLeft
java.awt.geom.Point2D getCoordsLeft()
-
getCoordsRight
java.awt.geom.Point2D getCoordsRight()
-
getCoordsForConnectionType
public java.awt.geom.Point2D getCoordsForConnectionType(HitPointType connectionType)
return the coordinates for the specified connection type- Overrides:
getCoordsForConnectionTypein classLayoutTurnoutView- Parameters:
connectionType- the connection type- Returns:
- the Point2D coordinates
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
- Overrides:
getBoundsin classLayoutTurnoutView- Returns:
- the bounds of this track
-
updateBlockInfo
public void updateBlockInfo()
- Overrides:
updateBlockInfoin classLayoutTurnoutView
-
findHitPointType
protected HitPointType findHitPointType(@Nonnull java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)
find the hit (location) type for a point- Overrides:
findHitPointTypein classLayoutTurnoutView- 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)
-
setCoordsCenter
public void setCoordsCenter(@Nonnull java.awt.geom.Point2D p)
set center coordinates- Overrides:
setCoordsCenterin classLayoutTurnoutView- Parameters:
p- the coordinates to set
-
setCoordsA
public void setCoordsA(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsAin classLayoutTurnoutView
-
setCoordsB
public void setCoordsB(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsBin classLayoutTurnoutView
-
setCoordsC
public void setCoordsC(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsCin classLayoutTurnoutView
-
setCoordsD
public void setCoordsD(@Nonnull java.awt.geom.Point2D p)
- Overrides:
setCoordsDin classLayoutTurnoutView
-
showPopup
@Nonnull protected javax.swing.JPopupMenu showPopup(@Nonnull JmriMouseEvent mouseEvent)
show the popup menu for this layout track- Overrides:
showPopupin classLayoutTurnoutView- Parameters:
mouseEvent- the mouse down event that triggered this popup- Returns:
- the popup menu for this layout track
-
getBlockBoundaries
public java.lang.String[] getBlockBoundaries()
- Overrides:
getBlockBoundariesin classLayoutTurnoutView
-
dispose
public void dispose()
Clean up when this object is no longer needed. Should not be called while the object is still displayed; see remove()- Overrides:
disposein classLayoutTurnoutView
-
remove
public void remove()
Removes this object from display and persistance- Overrides:
removein classLayoutTurnoutView
-
getTurnoutState
public int getTurnoutState(@Nonnull Turnout turn, int state)
-
getTurnoutState
public int getTurnoutState(int state)
-
getTurnoutBState
public int getTurnoutBState(int state)
-
setTurnoutStates
public void setTurnoutStates(int state, @Nonnull java.lang.String turnStateA, @Nonnull java.lang.String turnStateB)
-
draw1
protected void draw1(java.awt.Graphics2D g2, boolean drawMain, boolean isBlock)
Description copied from class:LayoutTurnoutViewdraw one line (Ballast, ties, center or 3rd rail, block lines)- Overrides:
draw1in classLayoutTurnoutView- Parameters:
g2- the graphics contextdrawMain- true if drawing mainlinesisBlock- true if drawing block lines
-
draw2
protected void draw2(java.awt.Graphics2D g2, boolean drawMain, float railDisplacement)
draw two lines (rails)- Overrides:
draw2in classLayoutTurnoutView- Parameters:
g2- the graphics contextdrawMain- true if drawing mainlinesrailDisplacement- the offset from center to draw the lines
-
highlightUnconnected
protected void highlightUnconnected(java.awt.Graphics2D g2, HitPointType specificType)
highlight unconnected connections- Overrides:
highlightUnconnectedin classLayoutTurnoutView- Parameters:
g2- the graphics contextspecificType- the specific connection to draw (or NONE for all)
-
drawTurnoutControls
protected void drawTurnoutControls(java.awt.Graphics2D g2)
Description copied from class:LayoutTurnoutViewDraw the turnout controls- Overrides:
drawTurnoutControlsin classLayoutTurnoutView- Parameters:
g2- the graphics context
-
getConnectivityStateForLayoutBlocks
protected int getConnectivityStateForLayoutBlocks(@CheckForNull LayoutBlock thisLayoutBlock, @CheckForNull LayoutBlock prevLayoutBlock, @CheckForNull LayoutBlock nextLayoutBlock, boolean suppress)
- Overrides:
getConnectivityStateForLayoutBlocksin classLayoutTurnoutView
-
reCheckBlockBoundary
public void reCheckBlockBoundary()
Description copied from class:LayoutTurnoutViewabstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Overrides:
reCheckBlockBoundaryin classLayoutTurnoutView
-
getLayoutConnectivity
@Nonnull protected java.util.List<LayoutConnectivity> getLayoutConnectivity()
Description copied from class:LayoutTurnoutViewget the layout connectivity for this track- Overrides:
getLayoutConnectivityin classLayoutTurnoutView- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
public java.util.List<HitPointType> checkForFreeConnections()
return a list of the available connections for this layout track- Overrides:
checkForFreeConnectionsin classLayoutTurnoutView- Returns:
- the list of available connections
-
-