Class LayoutTurnoutView
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutTrackView
-
- jmri.jmrit.display.layoutEditor.LayoutTurnoutView
-
- All Implemented Interfaces:
InlineLogixNG
- Direct Known Subclasses:
LayoutLHTurnoutView
,LayoutRHTurnoutView
,LayoutSlipView
,LayoutWyeView
,LayoutXOverView
public class LayoutTurnoutView extends LayoutTrackView
MVC View component for the LayoutTurnout class.
-
-
Field Summary
-
Fields inherited from class jmri.jmrit.display.layoutEditor.LayoutTrackView
decorations, layoutEditor, NUM_ARROW_TYPES
-
-
Constructor Summary
Constructors Constructor Description LayoutTurnoutView(LayoutTurnout turnout, java.awt.geom.Point2D c, double rot, double xFactor, double yFactor, LayoutEditor layoutEditor)
Constructor method.LayoutTurnoutView(LayoutTurnout turnout, java.awt.geom.Point2D c, double rot, LayoutEditor layoutEditor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEditPopUpMenu(javax.swing.JMenuItem menu)
void
addViewPopUpMenu(javax.swing.JMenuItem menu)
boolean
canRemove()
Check for active block boundaries.java.util.List<HitPointType>
checkForFreeConnections()
return a list of the available connections for this layout trackvoid
checkForNonContiguousBlocks(java.util.HashMap<java.lang.String,java.util.List<java.util.Set<java.lang.String>>> blockNamesToTrackNameSetsMap)
check this track and its neighbors for non-contiguous blocksboolean
checkForUnAssignedBlocks()
determine if all the appropriate blocks have been assigned to this trackvoid
collectContiguousTracksNamesInBlockNamed(java.lang.String blockName, java.util.Set<java.lang.String> TrackNameSet)
recursive routine to check for all contiguous tracks in this blockNamevoid
dispose()
Clean up when this object is no longer needed.protected void
draw1(java.awt.Graphics2D g2, boolean isMain, boolean isBlock)
draw one line (Ballast, ties, center or 3rd rail, block lines)protected void
draw2(java.awt.Graphics2D g2, boolean isMain, float railDisplacement)
draw two lines (rails)protected void
drawDecorations(java.awt.Graphics2D g2)
Draw track decorations.protected void
drawEditControls(java.awt.Graphics2D g2)
draw the edit controlsprotected void
drawTurnoutControls(java.awt.Graphics2D g2)
Draw the turnout controlsprotected HitPointType
findHitPointType(java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)
find the hit (location) type for a pointjava.util.ArrayList<java.lang.String>
getBeanReferences(java.lang.String pointName)
Build a list of sensors, signal heads, and signal masts attached to a turnout point.java.lang.String
getBlockBName()
java.lang.String[]
getBlockBoundaries()
java.lang.String
getBlockCName()
java.lang.String
getBlockDName()
java.lang.String
getBlockName()
java.awt.geom.Rectangle2D
getBounds()
LayoutTrack
getConnectA()
LayoutTrack
getConnectB()
LayoutTrack
getConnectC()
LayoutTrack
getConnectD()
LayoutTrack
getConnection(HitPointType connectionType)
get the LayoutTrack connected at the specified connection typeprotected int
getConnectivityStateForLayoutBlocks(LayoutBlock currLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress)
int
getContinuingSense()
java.awt.geom.Point2D
getCoordsA()
java.awt.geom.Point2D
getCoordsB()
java.awt.geom.Point2D
getCoordsC()
java.awt.geom.Point2D
getCoordsD()
java.awt.geom.Point2D
getCoordsForConnectionType(HitPointType connectionType)
return the coordinates for a specified connection type (abstract: should be overridden by ALL subclasses)LayoutBlock
getLayoutBlock()
LayoutBlock
getLayoutBlockB()
LayoutBlock
getLayoutBlockC()
LayoutBlock
getLayoutBlockD()
protected java.util.List<LayoutConnectivity>
getLayoutConnectivity()
get the layout connectivity for this trackLayoutTurnout
getLayoutTurnout()
java.lang.String
getLinkedTurnoutName()
LayoutTurnout.LinkType
getLinkType()
java.util.ArrayList<LayoutBlock>
getProtectedBlocks(NamedBean bean)
double
getRotationDEG()
Turnout
getSecondTurnout()
java.lang.String
getSecondTurnoutName()
Sensor
getSensorA()
java.lang.String
getSensorAName()
Sensor
getSensorB()
java.lang.String
getSensorBName()
Sensor
getSensorC()
java.lang.String
getSensorCName()
Sensor
getSensorD()
java.lang.String
getSensorDName()
SignalHead
getSignalA1()
java.lang.String
getSignalA1Name()
SignalHead
getSignalA2()
java.lang.String
getSignalA2Name()
SignalHead
getSignalA3()
java.lang.String
getSignalA3Name()
SignalMast
getSignalAMast()
java.lang.String
getSignalAMastName()
SignalHead
getSignalB1()
java.lang.String
getSignalB1Name()
SignalHead
getSignalB2()
java.lang.String
getSignalB2Name()
SignalMast
getSignalBMast()
java.lang.String
getSignalBMastName()
SignalHead
getSignalC1()
java.lang.String
getSignalC1Name()
SignalHead
getSignalC2()
java.lang.String
getSignalC2Name()
SignalMast
getSignalCMast()
java.lang.String
getSignalCMastName()
SignalHead
getSignalD1()
java.lang.String
getSignalD1Name()
SignalHead
getSignalD2()
java.lang.String
getSignalD2Name()
SignalMast
getSignalDMast()
java.lang.String
getSignalDMastName()
SignalHead
getSignalHead(LayoutTurnout.Geometry loc)
int
getState()
Get the LayoutTurnout stateTurnout
getTurnout()
java.lang.String
getTurnoutName()
LayoutTurnout.TurnoutType
getTurnoutType()
int
getVersion()
boolean
hasEnteringDoubleTrack()
Returns true if this has double track on the entrance end (crossover or slip)static boolean
hasEnteringDoubleTrack(LayoutTurnout.TurnoutType type)
Returns true if this has double track on the entrance end (crossover or slip)boolean
hasEnteringSingleTrack()
Returns true if this has a single-track entrance end.static boolean
hasEnteringSingleTrack(LayoutTurnout.TurnoutType type)
Returns true if this has a single-track entrance end.protected void
highlightUnconnected(java.awt.Graphics2D g2, HitPointType specificType)
highlight unconnected connectionsboolean
isActive()
"active" means that the object is still displayed, and should be stored.boolean
isDisabled()
boolean
isDisabledWhenOccupied()
boolean
isInContinuingSenseState()
boolean
isMainlineA()
Test if turnout legs are mainline track or not.boolean
isMainlineB()
boolean
isMainlineC()
boolean
isMainlineD()
boolean
isTurnoutTypeSlip()
Returns true if this is a slipstatic boolean
isTurnoutTypeSlip(LayoutTurnout.TurnoutType type)
Returns true if this is a slipboolean
isTurnoutTypeTurnout()
Returns true if this is a turnout (not a crossover or slip)static boolean
isTurnoutTypeTurnout(LayoutTurnout.TurnoutType type)
Returns true if this is a turnout (not a crossover or slip)boolean
isTurnoutTypeXover()
Returns true if this is a crossoverstatic boolean
isTurnoutTypeXover(LayoutTurnout.TurnoutType type)
Returns true if this is a crossover(package private) void
reCalculateCenter()
void
reCheckBlockBoundary()
abstract method... subclasses should implement _IF_ they need to recheck their block boundariesvoid
remove()
Remove this object from display and persistance.void
removeBeanReference(NamedBean nb)
protected void
removeSML(SignalMast signalMast)
void
rotateCoords(double angleDEG)
rotate this LayoutTrack's coordinates by angleDEG'svoid
scaleCoords(double xFactor, double yFactor)
scale this LayoutTrack's coordinates by the x and y factorsvoid
setAdditionalEditPopUpMenu(javax.swing.JPopupMenu popup)
void
setAdditionalViewPopUpMenu(javax.swing.JPopupMenu popup)
void
setAllLayoutBlocks(LayoutBlock layoutBlock)
Assign all the layout blocks in this trackvoid
setConnectA(LayoutTrack o, HitPointType type)
void
setConnectB(LayoutTrack o, HitPointType type)
void
setConnectC(LayoutTrack o, HitPointType type)
void
setConnectD(LayoutTrack o, HitPointType type)
void
setConnection(HitPointType connectionType, LayoutTrack o, HitPointType type)
set the LayoutTrack connected at the specified connection typevoid
setContinuingSense(int sense)
void
setCoordsA(java.awt.geom.Point2D p)
void
setCoordsB(java.awt.geom.Point2D p)
void
setCoordsC(java.awt.geom.Point2D p)
void
setCoordsCenter(java.awt.geom.Point2D p)
Set center coordinates.void
setCoordsD(java.awt.geom.Point2D p)
void
setDisabled(boolean state)
void
setDisableWhenOccupied(boolean state)
void
setLayoutBlock(LayoutBlock newLayoutBlock)
Set up Layout Block(s) for this Turnout.void
setLayoutBlockB(LayoutBlock newLayoutBlock)
void
setLayoutBlockBByName(java.lang.String name)
void
setLayoutBlockByName(java.lang.String name)
void
setLayoutBlockC(LayoutBlock newLayoutBlock)
void
setLayoutBlockCByName(java.lang.String name)
void
setLayoutBlockD(LayoutBlock newLayoutBlock)
void
setLayoutBlockDByName(java.lang.String name)
void
setLinkedTurnoutName(java.lang.String s)
void
setLinkType(LayoutTurnout.LinkType ltype)
void
setSecondTurnout(java.lang.String tName)
void
setSecondTurnoutInverted(boolean inverted)
void
setSensorA(java.lang.String sensorName)
void
setSensorB(java.lang.String sensorName)
void
setSensorC(java.lang.String sensorName)
void
setSensorD(java.lang.String sensorName)
void
setSignalA1Name(java.lang.String signalHead)
void
setSignalA2Name(java.lang.String signalHead)
void
setSignalA3Name(java.lang.String signalHead)
void
setSignalAMast(java.lang.String signalMast)
void
setSignalB1Name(java.lang.String signalHead)
void
setSignalB2Name(java.lang.String signalHead)
void
setSignalBMast(java.lang.String signalMast)
void
setSignalC1Name(java.lang.String signalHead)
void
setSignalC2Name(java.lang.String signalHead)
void
setSignalCMast(java.lang.String signalMast)
void
setSignalD1Name(java.lang.String signalHead)
void
setSignalD2Name(java.lang.String signalHead)
void
setSignalDMast(java.lang.String signalMast)
void
setState(int state)
Set the LayoutTurnout state.(package private) void
setTrackSegmentBlock(HitPointType pointType, boolean isAutomatic)
Update the block for a track segment that provides a (graphically) short connection between a turnout and another object, normally another turnout.(package private) void
setTrackSegmentBlocks()
Check each connection point and update the block value for very short track segments.void
setTurnout(java.lang.String tName)
protected void
setUpDefaultSize()
Set default size parameters to correspond to this turnout's size.void
setVersion(int v)
protected javax.swing.JPopupMenu
showPopup(JmriMouseEvent mouseEvent)
show the popup menu for this layout trackvoid
toggleTurnout()
Toggle turnout if clicked on, physical turnout exists, and not disabled.java.lang.String
toString()
void
translateCoords(double xFactor, double yFactor)
translate this LayoutTrack's coordinates by the x and y factorsvoid
updateBlockInfo()
boolean
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
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
INCONSISTENT
public static final int INCONSISTENT
- See Also:
- Constant Field Values
-
STATE_AC
public static final int STATE_AC
- See Also:
- Constant Field Values
-
STATE_BD
public static final int STATE_BD
- See Also:
- Constant Field Values
-
STATE_AD
public static final int STATE_AD
- See Also:
- Constant Field Values
-
STATE_BC
public static final int STATE_BC
- See Also:
- Constant Field Values
-
turnoutBXDefault
public static final double turnoutBXDefault
- See Also:
- Constant Field Values
-
turnoutCXDefault
public static final double turnoutCXDefault
- See Also:
- Constant Field Values
-
turnoutWidDefault
public static final double turnoutWidDefault
- See Also:
- Constant Field Values
-
xOverLongDefault
public static final double xOverLongDefault
- See Also:
- Constant Field Values
-
xOverHWidDefault
public static final double xOverHWidDefault
- See Also:
- Constant Field Values
-
xOverShortDefault
public static final double xOverShortDefault
- See Also:
- Constant Field Values
-
namedTurnout
protected NamedBeanHandle<Turnout> namedTurnout
-
secondNamedTurnout
protected NamedBeanHandle<Turnout> secondNamedTurnout
-
namedLayoutBlockA
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockA
-
namedLayoutBlockB
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockB
-
namedLayoutBlockC
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockC
-
namedLayoutBlockD
protected NamedBeanHandle<LayoutBlock> namedLayoutBlockD
-
signalA1HeadNamed
protected NamedBeanHandle<SignalHead> signalA1HeadNamed
-
signalA2HeadNamed
protected NamedBeanHandle<SignalHead> signalA2HeadNamed
-
signalA3HeadNamed
protected NamedBeanHandle<SignalHead> signalA3HeadNamed
-
signalB1HeadNamed
protected NamedBeanHandle<SignalHead> signalB1HeadNamed
-
signalB2HeadNamed
protected NamedBeanHandle<SignalHead> signalB2HeadNamed
-
signalC1HeadNamed
protected NamedBeanHandle<SignalHead> signalC1HeadNamed
-
signalC2HeadNamed
protected NamedBeanHandle<SignalHead> signalC2HeadNamed
-
signalD1HeadNamed
protected NamedBeanHandle<SignalHead> signalD1HeadNamed
-
signalD2HeadNamed
protected NamedBeanHandle<SignalHead> signalD2HeadNamed
-
dispB
public java.awt.geom.Point2D dispB
-
dispA
public java.awt.geom.Point2D dispA
-
pointA
public java.awt.geom.Point2D pointA
-
pointB
public java.awt.geom.Point2D pointB
-
pointC
public java.awt.geom.Point2D pointC
-
pointD
public java.awt.geom.Point2D pointD
-
editor
protected LayoutTurnoutEditor editor
-
connectAName
public java.lang.String connectAName
-
connectBName
public java.lang.String connectBName
-
connectCName
public java.lang.String connectCName
-
connectDName
public java.lang.String connectDName
-
tBlockAName
public java.lang.String tBlockAName
-
tBlockBName
public java.lang.String tBlockBName
-
tBlockCName
public java.lang.String tBlockCName
-
tBlockDName
public java.lang.String tBlockDName
-
editAdditionalMenu
java.util.ArrayList<javax.swing.JMenuItem> editAdditionalMenu
-
viewAdditionalMenu
java.util.ArrayList<javax.swing.JMenuItem> viewAdditionalMenu
-
-
Constructor Detail
-
LayoutTurnoutView
public LayoutTurnoutView(@Nonnull LayoutTurnout turnout, @Nonnull java.awt.geom.Point2D c, double rot, @Nonnull LayoutEditor layoutEditor)
-
LayoutTurnoutView
public LayoutTurnoutView(@Nonnull LayoutTurnout turnout, @Nonnull java.awt.geom.Point2D c, double rot, double xFactor, double yFactor, @Nonnull LayoutEditor layoutEditor)
Constructor method.- Parameters:
turnout
- the layout turnout to create the view for.c
- where to put itrot
- for displayxFactor
- for displayyFactor
- for displaylayoutEditor
- what layout editor panel to put it in
-
-
Method Detail
-
isTurnoutTypeTurnout
public static boolean isTurnoutTypeTurnout(LayoutTurnout.TurnoutType type)
Returns true if this is a turnout (not a crossover or slip)- Parameters:
type
- the turnout type- Returns:
- boolean true if this is a turnout
-
isTurnoutTypeTurnout
public boolean isTurnoutTypeTurnout()
Returns true if this is a turnout (not a crossover or slip)- Returns:
- boolean true if this is a turnout
-
isTurnoutTypeXover
public static boolean isTurnoutTypeXover(LayoutTurnout.TurnoutType type)
Returns true if this is a crossover- Parameters:
type
- the turnout type- Returns:
- boolean true if this is a crossover
-
isTurnoutTypeXover
public boolean isTurnoutTypeXover()
Returns true if this is a crossover- Returns:
- boolean true if this is a crossover
-
isTurnoutTypeSlip
public static boolean isTurnoutTypeSlip(LayoutTurnout.TurnoutType type)
Returns true if this is a slip- Parameters:
type
- the turnout type- Returns:
- boolean true if this is a slip
-
isTurnoutTypeSlip
public boolean isTurnoutTypeSlip()
Returns true if this is a slip- Returns:
- boolean true if this is a slip
-
hasEnteringSingleTrack
public static boolean hasEnteringSingleTrack(LayoutTurnout.TurnoutType type)
Returns true if this has a single-track entrance end. (turnout or wye)- Parameters:
type
- the turnout type- Returns:
- boolean true if single track entrance
-
hasEnteringSingleTrack
public boolean hasEnteringSingleTrack()
Returns true if this has a single-track entrance end. (turnout or wye)- Returns:
- boolean true if single track entrance
-
hasEnteringDoubleTrack
public static boolean hasEnteringDoubleTrack(LayoutTurnout.TurnoutType type)
Returns true if this has double track on the entrance end (crossover or slip)- Parameters:
type
- the turnout type- Returns:
- boolean true if double track entrance
-
hasEnteringDoubleTrack
public boolean hasEnteringDoubleTrack()
Returns true if this has double track on the entrance end (crossover or slip)- Returns:
- boolean true if double track entrance
-
getLayoutTurnout
public final LayoutTurnout getLayoutTurnout()
-
getVersion
public int getVersion()
-
setVersion
public void setVersion(int v)
-
useBlockSpeed
public boolean useBlockSpeed()
-
getTurnoutName
public java.lang.String getTurnoutName()
-
getSecondTurnoutName
public java.lang.String getSecondTurnoutName()
-
getBlockName
@Nonnull public java.lang.String getBlockName()
-
getBlockBName
@Nonnull public java.lang.String getBlockBName()
-
getBlockCName
@Nonnull public java.lang.String getBlockCName()
-
getBlockDName
@Nonnull public java.lang.String getBlockDName()
-
getSignalHead
@CheckForNull public SignalHead getSignalHead(LayoutTurnout.Geometry loc)
-
getSignalA1
@CheckForNull public SignalHead getSignalA1()
-
getSignalA1Name
@Nonnull public java.lang.String getSignalA1Name()
-
setSignalA1Name
public void setSignalA1Name(@CheckForNull java.lang.String signalHead)
-
getSignalA2
@CheckForNull public SignalHead getSignalA2()
-
getSignalA2Name
@Nonnull public java.lang.String getSignalA2Name()
-
setSignalA2Name
public void setSignalA2Name(@CheckForNull java.lang.String signalHead)
-
getSignalA3
@CheckForNull public SignalHead getSignalA3()
-
getSignalA3Name
@Nonnull public java.lang.String getSignalA3Name()
-
setSignalA3Name
public void setSignalA3Name(@CheckForNull java.lang.String signalHead)
-
getSignalB1
@CheckForNull public SignalHead getSignalB1()
-
getSignalB1Name
@Nonnull public java.lang.String getSignalB1Name()
-
setSignalB1Name
public void setSignalB1Name(@CheckForNull java.lang.String signalHead)
-
getSignalB2
@CheckForNull public SignalHead getSignalB2()
-
getSignalB2Name
@Nonnull public java.lang.String getSignalB2Name()
-
setSignalB2Name
public void setSignalB2Name(@CheckForNull java.lang.String signalHead)
-
getSignalC1
@CheckForNull public SignalHead getSignalC1()
-
getSignalC1Name
@Nonnull public java.lang.String getSignalC1Name()
-
setSignalC1Name
public void setSignalC1Name(@CheckForNull java.lang.String signalHead)
-
getSignalC2
@CheckForNull public SignalHead getSignalC2()
-
getSignalC2Name
@Nonnull public java.lang.String getSignalC2Name()
-
setSignalC2Name
public void setSignalC2Name(@CheckForNull java.lang.String signalHead)
-
getSignalD1
@CheckForNull public SignalHead getSignalD1()
-
getSignalD1Name
@Nonnull public java.lang.String getSignalD1Name()
-
setSignalD1Name
public void setSignalD1Name(@CheckForNull java.lang.String signalHead)
-
getSignalD2
@CheckForNull public SignalHead getSignalD2()
-
getSignalD2Name
@Nonnull public java.lang.String getSignalD2Name()
-
setSignalD2Name
public void setSignalD2Name(@CheckForNull java.lang.String signalHead)
-
removeBeanReference
public void removeBeanReference(@CheckForNull NamedBean nb)
-
canRemove
public boolean 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:
canRemove
in classLayoutTrackView
- Returns:
- true if the layout track object can be deleted.
-
getBeanReferences
@Nonnull public java.util.ArrayList<java.lang.String> getBeanReferences(java.lang.String pointName)
Build a list of sensors, signal heads, and signal masts attached to a turnout point.- Parameters:
pointName
- Specify the point (A-D) or all (All) points.- Returns:
- a list of bean reference names.
-
getSignalAMastName
@Nonnull public java.lang.String getSignalAMastName()
-
getSignalAMast
@CheckForNull public SignalMast getSignalAMast()
-
setSignalAMast
public void setSignalAMast(@CheckForNull java.lang.String signalMast)
-
getSignalBMastName
@Nonnull public java.lang.String getSignalBMastName()
-
getSignalBMast
@CheckForNull public SignalMast getSignalBMast()
-
setSignalBMast
public void setSignalBMast(@CheckForNull java.lang.String signalMast)
-
getSignalCMastName
@Nonnull public java.lang.String getSignalCMastName()
-
getSignalCMast
@CheckForNull public SignalMast getSignalCMast()
-
setSignalCMast
public void setSignalCMast(@CheckForNull java.lang.String signalMast)
-
getSignalDMastName
@Nonnull public java.lang.String getSignalDMastName()
-
getSignalDMast
@CheckForNull public SignalMast getSignalDMast()
-
setSignalDMast
public void setSignalDMast(@CheckForNull java.lang.String signalMast)
-
getSensorAName
@Nonnull public java.lang.String getSensorAName()
-
getSensorA
@CheckForNull public Sensor getSensorA()
-
setSensorA
public void setSensorA(@CheckForNull java.lang.String sensorName)
-
getSensorBName
@Nonnull public java.lang.String getSensorBName()
-
getSensorB
@CheckForNull public Sensor getSensorB()
-
setSensorB
public void setSensorB(@CheckForNull java.lang.String sensorName)
-
getSensorCName
@Nonnull public java.lang.String getSensorCName()
-
getSensorC
@CheckForNull public Sensor getSensorC()
-
setSensorC
public void setSensorC(@CheckForNull java.lang.String sensorName)
-
getSensorDName
@Nonnull public java.lang.String getSensorDName()
-
getSensorD
@CheckForNull public Sensor getSensorD()
-
setSensorD
public void setSensorD(@CheckForNull java.lang.String sensorName)
-
getLinkedTurnoutName
public java.lang.String getLinkedTurnoutName()
-
setLinkedTurnoutName
public void setLinkedTurnoutName(@Nonnull java.lang.String s)
-
getLinkType
public LayoutTurnout.LinkType getLinkType()
-
setLinkType
public void setLinkType(LayoutTurnout.LinkType ltype)
-
getTurnoutType
public LayoutTurnout.TurnoutType getTurnoutType()
-
getConnectA
public LayoutTrack getConnectA()
-
getConnectB
public LayoutTrack getConnectB()
-
getConnectC
public LayoutTrack getConnectC()
-
getConnectD
public LayoutTrack getConnectD()
-
getTurnout
public Turnout getTurnout()
- Returns:
- null if no turnout set // temporary? Might want to run all calls through this class; but this is getModel equiv
-
getContinuingSense
public int getContinuingSense()
-
isInContinuingSenseState
public boolean isInContinuingSenseState()
- Returns:
- true is the continuingSense matches the known state
-
setTurnout
public void setTurnout(@Nonnull java.lang.String tName)
-
getSecondTurnout
public Turnout getSecondTurnout()
-
setSecondTurnout
public void setSecondTurnout(@Nonnull java.lang.String tName)
-
setSecondTurnoutInverted
public void setSecondTurnoutInverted(boolean inverted)
-
setContinuingSense
public void setContinuingSense(int sense)
-
setDisabled
public void setDisabled(boolean state)
-
isDisabled
public boolean isDisabled()
-
setDisableWhenOccupied
public void setDisableWhenOccupied(boolean state)
-
isDisabledWhenOccupied
public boolean isDisabledWhenOccupied()
-
getConnection
@CheckForNull public LayoutTrack getConnection(HitPointType connectionType) throws JmriException
get the LayoutTrack connected at the specified connection type- Specified by:
getConnection
in 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, @CheckForNull LayoutTrack o, HitPointType type) throws JmriException
set the LayoutTrack connected at the specified connection type- Specified by:
setConnection
in 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
-
setConnectA
public void setConnectA(@CheckForNull LayoutTrack o, HitPointType type)
-
setConnectB
public void setConnectB(@CheckForNull LayoutTrack o, HitPointType type)
-
setConnectC
public void setConnectC(@CheckForNull LayoutTrack o, HitPointType type)
-
setConnectD
public void setConnectD(@CheckForNull LayoutTrack o, HitPointType type)
-
getLayoutBlock
public LayoutBlock getLayoutBlock()
-
getLayoutBlockB
public LayoutBlock getLayoutBlockB()
-
getLayoutBlockC
public LayoutBlock getLayoutBlockC()
-
getLayoutBlockD
public LayoutBlock getLayoutBlockD()
-
getCoordsA
@Nonnull public java.awt.geom.Point2D getCoordsA()
-
getCoordsB
@Nonnull public java.awt.geom.Point2D getCoordsB()
-
getCoordsC
@Nonnull public java.awt.geom.Point2D getCoordsC()
-
getCoordsD
@Nonnull public java.awt.geom.Point2D getCoordsD()
-
getCoordsForConnectionType
@Nonnull public java.awt.geom.Point2D getCoordsForConnectionType(HitPointType connectionType)
return the coordinates for a specified connection type (abstract: should be overridden by ALL subclasses)- Specified by:
getCoordsForConnectionType
in classLayoutTrackView
- Parameters:
connectionType
- the connection type- Returns:
- the coordinates for the specified connection type
-
getBounds
@Nonnull public java.awt.geom.Rectangle2D getBounds()
- Specified by:
getBounds
in classLayoutTrackView
- Returns:
- the bounds of this track
-
updateBlockInfo
public void updateBlockInfo()
-
setUpDefaultSize
protected void setUpDefaultSize()
Set default size parameters to correspond to this turnout's size.note: only protected so LayoutTurnoutTest can call it
-
setLayoutBlock
public void setLayoutBlock(LayoutBlock newLayoutBlock)
Set up Layout Block(s) for this Turnout.- Parameters:
newLayoutBlock
- SeeLayoutTurnout.setLayoutBlock(jmri.jmrit.display.layoutEditor.LayoutBlock)
for definition
-
setLayoutBlockB
public void setLayoutBlockB(LayoutBlock newLayoutBlock)
-
setLayoutBlockC
public void setLayoutBlockC(LayoutBlock newLayoutBlock)
-
setLayoutBlockD
public void setLayoutBlockD(LayoutBlock newLayoutBlock)
-
setLayoutBlockByName
public void setLayoutBlockByName(@Nonnull java.lang.String name)
-
setLayoutBlockBByName
public void setLayoutBlockBByName(@Nonnull java.lang.String name)
-
setLayoutBlockCByName
public void setLayoutBlockCByName(@Nonnull java.lang.String name)
-
setLayoutBlockDByName
public void setLayoutBlockDByName(@Nonnull java.lang.String name)
-
setTrackSegmentBlocks
void setTrackSegmentBlocks()
Check each connection point and update the block value for very short track segments.- Since:
- 4.11.6
-
setTrackSegmentBlock
void setTrackSegmentBlock(HitPointType pointType, boolean isAutomatic)
Update the block for a track segment that provides a (graphically) short connection between a turnout and another object, normally another turnout. These are hard to see and are frequently missed.Skip block changes if signal heads, masts or sensors have been assigned. Only track segments with a length less than the turnout circle radius will be changed.
- Parameters:
pointType
- The point type which indicates which turnout connection.isAutomatic
- True for the automatically generated track segment created by the drag-n-drop process. False for existing connections which require a track segment length calculation.- Since:
- 4.11.6
-
isMainlineA
public boolean isMainlineA()
Test if turnout legs are mainline track or not.- Returns:
- true if connecting track segment is mainline; Defaults to not mainline if connecting track segment is missing
-
isMainlineB
public boolean isMainlineB()
-
isMainlineC
public boolean isMainlineC()
-
isMainlineD
public boolean isMainlineD()
-
findHitPointType
protected HitPointType findHitPointType(@Nonnull java.awt.geom.Point2D hitPoint, boolean useRectangles, boolean requireUnconnected)
find the hit (location) type for a point- Specified by:
findHitPointType
in 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)
-
setCoordsCenter
public void setCoordsCenter(@Nonnull java.awt.geom.Point2D p)
Set center coordinates.Some subtypes may reimplement this is "center" is a more complicated idea, i.e. for Bezier curves
- Overrides:
setCoordsCenter
in classLayoutTrackView
- Parameters:
p
- the coordinates to set
-
reCalculateCenter
void reCalculateCenter()
-
setCoordsA
public void setCoordsA(@Nonnull java.awt.geom.Point2D p)
-
setCoordsB
public void setCoordsB(java.awt.geom.Point2D p)
-
setCoordsC
public void setCoordsC(java.awt.geom.Point2D p)
-
setCoordsD
public void setCoordsD(java.awt.geom.Point2D p)
-
scaleCoords
public void scaleCoords(double xFactor, double yFactor)
scale this LayoutTrack's coordinates by the x and y factors- Specified by:
scaleCoords
in classLayoutTrackView
- Parameters:
xFactor
- the amount to scale X coordinatesyFactor
- the amount to scale Y coordinates
-
translateCoords
public void translateCoords(double xFactor, double yFactor)
translate this LayoutTrack's coordinates by the x and y factors- Specified by:
translateCoords
in classLayoutTrackView
- Parameters:
xFactor
- the amount to translate X coordinatesyFactor
- the amount to translate Y coordinates
-
rotateCoords
public void rotateCoords(double angleDEG)
rotate this LayoutTrack's coordinates by angleDEG's- Specified by:
rotateCoords
in classLayoutTrackView
- Parameters:
angleDEG
- the amount to rotate in degrees
-
getRotationDEG
public double getRotationDEG()
-
toggleTurnout
public void toggleTurnout()
Toggle turnout if clicked on, physical turnout exists, and not disabled.
-
setState
public void setState(int state)
Set the LayoutTurnout state. Used for sending the toggle command Checks not disabled, disable when occupied Also sets secondary Turnout commanded state- Parameters:
state
- New state to set, eg Turnout.CLOSED
-
getState
public int getState()
Get the LayoutTurnout stateEnsures the secondary Turnout state matches the primary
- Returns:
- the state, eg Turnout.CLOSED or Turnout.INCONSISTENT
-
showPopup
@Nonnull protected javax.swing.JPopupMenu showPopup(@Nonnull JmriMouseEvent mouseEvent)
show the popup menu for this layout track- Specified by:
showPopup
in classLayoutTrackView
- Parameters:
mouseEvent
- the mouse down event that triggered this popup- Returns:
- the popup menu for this layout track
-
getBlockBoundaries
public java.lang.String[] getBlockBoundaries()
-
getProtectedBlocks
public java.util.ArrayList<LayoutBlock> getProtectedBlocks(NamedBean bean)
-
removeSML
protected void removeSML(SignalMast signalMast)
-
dispose
public void dispose()
Clean up when this object is no longer needed. Should not be called while the object is still displayed; seeremove()
-
remove
public void remove()
Remove this object from display and persistance.
-
isActive
public boolean isActive()
"active" means that the object is still displayed, and should be stored.- Returns:
- true if active
-
addEditPopUpMenu
public void addEditPopUpMenu(javax.swing.JMenuItem menu)
-
addViewPopUpMenu
public void addViewPopUpMenu(javax.swing.JMenuItem menu)
-
setAdditionalEditPopUpMenu
public void setAdditionalEditPopUpMenu(javax.swing.JPopupMenu popup)
-
setAdditionalViewPopUpMenu
public void setAdditionalViewPopUpMenu(javax.swing.JPopupMenu popup)
-
drawDecorations
protected void drawDecorations(java.awt.Graphics2D g2)
Draw track decorations.This type of track has none, so this method is empty.
- Specified by:
drawDecorations
in classLayoutTrackView
- Parameters:
g2
- the graphics context
-
draw1
protected void draw1(java.awt.Graphics2D g2, boolean isMain, boolean isBlock)
draw one line (Ballast, ties, center or 3rd rail, block lines)- Specified by:
draw1
in classLayoutTrackView
- Parameters:
g2
- the graphics contextisMain
- true if drawing mainlinesisBlock
- true if drawing block lines
-
draw2
protected void draw2(java.awt.Graphics2D g2, boolean isMain, float railDisplacement)
draw two lines (rails)- Specified by:
draw2
in classLayoutTrackView
- Parameters:
g2
- the graphics contextisMain
- 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- Specified by:
highlightUnconnected
in classLayoutTrackView
- Parameters:
g2
- the graphics contextspecificType
- the specific connection to draw (or NONE for all)
-
drawTurnoutControls
protected void drawTurnoutControls(java.awt.Graphics2D g2)
Draw the turnout controls- Specified by:
drawTurnoutControls
in classLayoutTrackView
- Parameters:
g2
- the graphics context
-
drawEditControls
protected void drawEditControls(java.awt.Graphics2D g2)
draw the edit controls- Specified by:
drawEditControls
in classLayoutTrackView
- Parameters:
g2
- the graphics context
-
getConnectivityStateForLayoutBlocks
protected int getConnectivityStateForLayoutBlocks(LayoutBlock currLayoutBlock, LayoutBlock prevLayoutBlock, LayoutBlock nextLayoutBlock, boolean suppress)
-
reCheckBlockBoundary
public void reCheckBlockBoundary()
abstract method... subclasses should implement _IF_ they need to recheck their block boundaries- Specified by:
reCheckBlockBoundary
in classLayoutTrackView
-
getLayoutConnectivity
protected java.util.List<LayoutConnectivity> getLayoutConnectivity()
get the layout connectivity for this track- Specified by:
getLayoutConnectivity
in classLayoutTrackView
- Returns:
- the list of Layout Connectivity objects
-
checkForFreeConnections
@Nonnull public java.util.List<HitPointType> checkForFreeConnections()
return a list of the available connections for this layout track- Specified by:
checkForFreeConnections
in classLayoutTrackView
- Returns:
- the list of available connections
-
checkForUnAssignedBlocks
public boolean checkForUnAssignedBlocks()
determine if all the appropriate blocks have been assigned to this track- Specified by:
checkForUnAssignedBlocks
in classLayoutTrackView
- Returns:
- true if all appropriate blocks have been assigned
-
checkForNonContiguousBlocks
public void checkForNonContiguousBlocks(@Nonnull java.util.HashMap<java.lang.String,java.util.List<java.util.Set<java.lang.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:
checkForNonContiguousBlocks
in classLayoutTrackView
- Parameters:
blockNamesToTrackNameSetsMap
- hashmap of key:block names to lists of track name sets for those blocks
-
collectContiguousTracksNamesInBlockNamed
public void collectContiguousTracksNamesInBlockNamed(@Nonnull java.lang.String blockName, @Nonnull java.util.Set<java.lang.String> TrackNameSet)
recursive routine to check for all contiguous tracks in this blockName- Specified by:
collectContiguousTracksNamesInBlockNamed
in classLayoutTrackView
- Parameters:
blockName
- the block that we're checking forTrackNameSet
- the set of track names in this block
-
setAllLayoutBlocks
public void setAllLayoutBlocks(LayoutBlock layoutBlock)
Assign all the layout blocks in this track- Specified by:
setAllLayoutBlocks
in classLayoutTrackView
- Parameters:
layoutBlock
- to this layout block (used by the Tools menu's "Assign block to selection" item)
-
-