Class LayoutConnectivity
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutConnectivity
-
public class LayoutConnectivity extends java.lang.Object
A LayoutConnectivity object represents a junction between two LayoutBlocks on a LayoutEditor panel.LayoutConnectivity objects do not persist (are not saved when panels are saved). Instead they are initialized when a panel is loaded and changed dynamically as a panel is edited.
The direction stored here is the direction for proceeding across the block boundary from block1 to block2. The directions represent directions on the LayoutEditor panel. Allowed values (using Path object definitions) are: Path.NORTH (up on panel) Path.SOUTH (down on panel) Path.EAST (right on panel) Path.WEST (left on panel) and points in between: Path.NORTH + Path.EAST Path.NORTH_WEST, Path.SOUTH_EAST Path.SOUTH + Path.WEST
The connected object in the first block is usually a track segment. This track segment is connected to an object in the second block. The connection point in the second block can be either one end of a track segment, or one of the connection points on a turnout, or one of the connection points on a level crossing. The allowed values for the connection points at the second block are defined in LayoutEditor.
The exception to the above is when a crossover turnout has multiple blocks. If so, at least one block boundary is internal to the crossover turnout. Such cases are handled differently, as "crossover block boundary types", see definition of the type codes below. The first letter in the boundary type corresponds to the first block, and the second letter corresponds to the second block. All four block boundaries are possible for the double crossover. One of the crossed over boundaries is not possible with each single crossover.
Note that each LayoutEditor panel has its own list of LayoutConnectivity objects, nominally called its "block connectivity". In contrast, there is only one set of LayoutBlocks, Blocks, and Paths, which are used by all LayoutEditor panels.
-
-
Field Summary
Fields Modifier and Type Field Description static int
NONE
static int
XOVER_BOUNDARY_AB
static int
XOVER_BOUNDARY_AC
static int
XOVER_BOUNDARY_AD
static int
XOVER_BOUNDARY_BC
static int
XOVER_BOUNDARY_BD
static int
XOVER_BOUNDARY_CD
-
Constructor Summary
Constructors Constructor Description LayoutConnectivity(LayoutBlock b1, LayoutBlock b2)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
PositionablePoint
getAnchor()
LayoutBlock
getBlock1()
Get Block 1.LayoutBlock
getBlock2()
LayoutTrack
getConnectedObject()
HitPointType
getConnectedType()
int
getDirection()
int
getReverseDirection()
TrackSegment
getTrackSegment()
LayoutTurnout
getXover()
int
getXoverBoundaryType()
int
hashCode()
void
setConnections(TrackSegment t, LayoutTrack o, HitPointType type, PositionablePoint p)
boolean
setDirection(int dir)
void
setXoverBoundary(LayoutTurnout t, int type)
java.lang.String
toString()
-
-
-
Field Detail
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
XOVER_BOUNDARY_AB
public static final int XOVER_BOUNDARY_AB
- See Also:
- Constant Field Values
-
XOVER_BOUNDARY_CD
public static final int XOVER_BOUNDARY_CD
- See Also:
- Constant Field Values
-
XOVER_BOUNDARY_AC
public static final int XOVER_BOUNDARY_AC
- See Also:
- Constant Field Values
-
XOVER_BOUNDARY_BD
public static final int XOVER_BOUNDARY_BD
- See Also:
- Constant Field Values
-
XOVER_BOUNDARY_AD
public static final int XOVER_BOUNDARY_AD
- See Also:
- Constant Field Values
-
XOVER_BOUNDARY_BC
public static final int XOVER_BOUNDARY_BC
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LayoutConnectivity
public LayoutConnectivity(LayoutBlock b1, LayoutBlock b2)
Constructor.- Parameters:
b1
- layout block 1.b2
- layout block 2.
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getBlock1
public LayoutBlock getBlock1()
Get Block 1.- Returns:
- block 1, may be null.
-
getBlock2
public LayoutBlock getBlock2()
-
getDirection
public int getDirection()
-
getReverseDirection
public int getReverseDirection()
-
setDirection
public boolean setDirection(int dir)
-
setConnections
public void setConnections(TrackSegment t, LayoutTrack o, HitPointType type, PositionablePoint p)
-
setXoverBoundary
public void setXoverBoundary(LayoutTurnout t, int type)
-
getTrackSegment
public TrackSegment getTrackSegment()
-
getConnectedObject
public LayoutTrack getConnectedObject()
-
getConnectedType
public HitPointType getConnectedType()
-
getXover
public LayoutTurnout getXover()
-
getXoverBoundaryType
public int getXoverBoundaryType()
-
getAnchor
public PositionablePoint getAnchor()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-