|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.display.layoutEditor.ConnectivityUtil
public class ConnectivityUtil
ConnectivityUtil provides methods supporting use of layout connectivity available in Layout Editor panels. These tools allow outside classes to inquire into connectivity information contained in a specified Layout Editor panel.
Connectivity information is stored in the track diagram of a Layout Editor panel. The "connectivity graph" of the layout consists of nodes (LayoutTurnouts, LevelXings, and PositionablePoints) connected by lines (TrackSegments). These methods extract information from the connection graph and make it available. Each instance of ConnectivityUtil is associated with a specific Layout Editor panel, and is accessed via that LayoutEditor panel's 'getConnectivityUtil' method.
The methods in this module do not modify the Layout in any way, or change the state of items on the layout. They only provide information to allow other modules to do so as appropriate. For example, the "getTurnoutList" method provides information about the turnouts in a block, but does not test the state, or change the state, of any turnout.
The methods in this module are accessed via direct calls from the inquiring method.
| Field Summary | |
|---|---|
static int |
CONTINUING
|
static int |
DIVERGING
|
(package private) LayoutBlock |
lb
|
(package private) static org.slf4j.Logger |
log
|
(package private) LayoutBlock |
nlb
|
static int |
OVERALL
|
(package private) LayoutBlock |
plb
|
(package private) ResourceBundle |
rb
|
| Constructor Summary | |
|---|---|
ConnectivityUtil(LayoutEditor thePanel)
|
|
| Method Summary | |
|---|---|
boolean |
addSensorToSignalHeadLogic(String name,
SignalHead sh,
int where)
|
boolean |
blockInternalToLevelXing(LevelXing x,
Block block)
Returns 'true' if the specified block is internal to the Level Xing, and if all else is OK. |
ArrayList<LayoutTurnout> |
getAllTurnoutsThisBlock(LayoutBlock lb)
|
ArrayList<PositionablePoint> |
getAnchorBoundariesThisBlock(Block block)
Returns a list of all anchor point boundaries involving the specified Block |
ArrayList<Block> |
getConnectedBlocks(Block block)
Returns a list of all Blocks connected to a specified Block |
int |
getDirectionFromAnchor(ArrayList<EntryPoint> mForwardEntryPoints,
ArrayList<EntryPoint> mReverseEntryPoints,
PositionablePoint p)
Matches the anchor point to an Entry Point, and returns the direction specified in the Entry Point If no match is found, UNKNOWN is returned, indicating that the block boundary is internal to the Section. |
Block |
getExitBlockForTrackNode(TrackNode node,
Block excludedBlock)
Returns an "exit block" for the specified track node if there is one, else returns null. |
ArrayList<LayoutTurnout> |
getLayoutTurnoutsThisBlock(Block block)
Returns a list of all layout turnouts involving the specified Block |
ArrayList<LevelXing> |
getLevelCrossingsThisBlock(Block block)
Returns a list of all levelXings involving the specified Block. |
TrackNode |
getNextNode(TrackNode cNode,
int cNodeState)
Returns the next Node following the specified TrackNode If the specified track node can lead to different paths to the next node, for example, if the specified track node is a turnout entered at its throat, then "cNodeState" must be specified to choose between the possible paths. |
SignalHead |
getSignalHeadAtAnchor(PositionablePoint p,
Block block,
boolean facing)
Returns the Signal Head at the Anchor block boundary If 'facing' is 'true', returns the head that faces toward the specified Block If 'facing' is 'false', returns the head that faces away from the specified Block |
SignalHead |
getSignalHeadAtLevelXing(LevelXing x,
Block block,
boolean facing)
Returns the Signal Head at the level crossing If 'facing' is 'true', returns the head that faces toward the specified Block If 'facing' is 'false', returns the head that faces away from the specified Block |
SignalMast |
getSignalMastAtAnchor(PositionablePoint p,
Block block,
boolean facing)
Returns the Signal Mast at the Anchor block boundary If 'facing' is 'true', returns the head that faces toward the specified Block If 'facing' is 'false', returns the head that faces away from the specified Block |
TrackNode |
getTrackNode(Object cNode,
int cNodeType,
TrackSegment cTrack,
int cNodeState)
Returns the next Node following the node specified by "cNode" and "cNodeType", assuming that cNode was reached via the specified TrackSegment. |
ArrayList<LayoutTurnout> |
getTurnoutList(Block block,
Block prevBlock,
Block nextBlock)
Provides a list of LayoutTurnouts in a specified Block (block), in order, beginning at the connection to the specified previous Block (prevBlock) and continuing to the specfied next Block (nextBlock). |
ArrayList<Integer> |
getTurnoutSettingList()
Returns a list of turnout settings (as Integer Objects) to accomplish the transition through the Block specified in 'getTurnoutList'. |
boolean |
isInternalLevelXingAC(LevelXing x,
Block block)
Checks if a Level Crossing's AC track and its two connecting Track Segments are internal to the specified block. |
boolean |
isInternalLevelXingBD(LevelXing x,
Block block)
Checks if a Level Crossing's BD track and its two connecting Track Segments are internal to the specified block. |
boolean |
isTurnoutConnectivityComplete()
This flag can be checked after performing a getTurnoutList() to check if the connectivity of the turnouts has been completed in the block when the getTurnoutList() was called. |
boolean |
layoutTurnoutHasRequiredSignals(LayoutTurnout t)
Returns 'true' if specified Layout Turnout has required signal heads. |
boolean |
layoutTurnoutHasSignalMasts(LayoutTurnout t)
|
boolean |
removeSensorsFromSignalHeadLogic(ArrayList<String> names,
SignalHead sh)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
ResourceBundle rb
LayoutBlock lb
LayoutBlock nlb
LayoutBlock plb
public static final int OVERALL
public static final int CONTINUING
public static final int DIVERGING
static org.slf4j.Logger log
| Constructor Detail |
|---|
public ConnectivityUtil(LayoutEditor thePanel)
| Method Detail |
|---|
public ArrayList<LayoutTurnout> getTurnoutList(Block block,
Block prevBlock,
Block nextBlock)
public ArrayList<Integer> getTurnoutSettingList()
public ArrayList<Block> getConnectedBlocks(Block block)
public ArrayList<PositionablePoint> getAnchorBoundariesThisBlock(Block block)
public ArrayList<LevelXing> getLevelCrossingsThisBlock(Block block)
public ArrayList<LayoutTurnout> getLayoutTurnoutsThisBlock(Block block)
public boolean layoutTurnoutHasRequiredSignals(LayoutTurnout t)
public SignalHead getSignalHeadAtAnchor(PositionablePoint p,
Block block,
boolean facing)
public SignalMast getSignalMastAtAnchor(PositionablePoint p,
Block block,
boolean facing)
public boolean layoutTurnoutHasSignalMasts(LayoutTurnout t)
public SignalHead getSignalHeadAtLevelXing(LevelXing x,
Block block,
boolean facing)
public boolean blockInternalToLevelXing(LevelXing x,
Block block)
public int getDirectionFromAnchor(ArrayList<EntryPoint> mForwardEntryPoints,
ArrayList<EntryPoint> mReverseEntryPoints,
PositionablePoint p)
public boolean isInternalLevelXingAC(LevelXing x,
Block block)
public boolean isInternalLevelXingBD(LevelXing x,
Block block)
public boolean addSensorToSignalHeadLogic(String name,
SignalHead sh,
int where)
public boolean removeSensorsFromSignalHeadLogic(ArrayList<String> names,
SignalHead sh)
public TrackNode getNextNode(TrackNode cNode,
int cNodeState)
If the specified track node can lead to different paths to the next node, for example, if the specified track node is a turnout entered at its throat, then "cNodeState" must be specified to choose between the possible paths. Returns a TrackNode if one is reached. Returns null if trouble following the track. .
public TrackNode getTrackNode(Object cNode,
int cNodeType,
TrackSegment cTrack,
int cNodeState)
If the specified track node can lead to different paths to the next node, for example, if the specified track node is a turnout entered at its throat, then "cNodeState" must be specified to choose between the possible paths. If cNodeState = 0, the search will follow the 'continuing' track; if cNodeState = 1, the search will follow the 'diverging' track; if cNodeState = 2 (3-way turnouts only), the search will follow the second 'diverging' track.
In determining which track is the 'continuing' track for RH, LH, and WYE turnouts, this search routine uses the layout turnout's 'continuingState'.
When following track, this method skips over anchor points that are not block boundaries.
When following track, this method treats a modelled 3-way turnout as a single turnout. It also treats two THROAT_TO_THROAT turnouts as a single turnout, but with each turnout having a continuing sense.
Returns a TrackNode if a node or end_of-track is reached. Returns null if trouble following the track.
public Block getExitBlockForTrackNode(TrackNode node,
Block excludedBlock)
public boolean isTurnoutConnectivityComplete()
public ArrayList<LayoutTurnout> getAllTurnoutsThisBlock(LayoutBlock lb)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||