Class LayoutEditorAuxTools
- java.lang.Object
-
- jmri.jmrit.display.layoutEditor.LayoutEditorAuxTools
-
public final class LayoutEditorAuxTools extends java.lang.Object
LayoutEditorAuxTools provides tools making use of layout connectivity available in Layout Editor panels. (More tools are in LayoutEditorTools.java.)This module manages block connectivity for its associated LayoutEditor.
A single object of this type, obtained via
LayoutEditor.getLEAuxTools()
is shared across all instances ofConnectivityUtil
.The tools in this module are accessed via the Tools menu in Layout Editor, or directly from LayoutEditor or LayoutEditor specific modules.
-
-
Constructor Summary
Constructors Constructor Description LayoutEditorAuxTools(LayoutModels theModels)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBeanSettings(Path p, LayoutConnectivity lc, LayoutBlock layoutBlock)
Searches for and adds BeanSetting's to a Path as needed.java.util.List<LayoutConnectivity>
getConnectivityList(LayoutBlock blk)
Get Connectivity involving a specific Layout Block.void
initializeBlockConnectivity()
Initializes the block connectivity (block boundaries) for a Layout Editor panel.void
setBlockConnectivityChanged()
-
-
-
Constructor Detail
-
LayoutEditorAuxTools
public LayoutEditorAuxTools(LayoutModels theModels)
-
-
Method Detail
-
setBlockConnectivityChanged
public void setBlockConnectivityChanged()
-
getConnectivityList
public java.util.List<LayoutConnectivity> getConnectivityList(LayoutBlock blk)
Get Connectivity involving a specific Layout Block.This routine returns an ArrayList of BlockConnectivity objects involving the specified LayoutBlock.
- Parameters:
blk
- the layout block.- Returns:
- the layout connectivity list, not null.
-
initializeBlockConnectivity
public void initializeBlockConnectivity()
Initializes the block connectivity (block boundaries) for a Layout Editor panel.This routine sets up the LayoutConnectivity objects needed to show the current connectivity. It gets its information from arrays contained in LayoutEditor.
One LayoutConnectivity object is created for each block boundary -- connection points where two blocks join. Block boundaries can occur where ever a track segment in one block joins with: 1) a track segment in another block -OR- 2) a connection point in a layout turnout in another block -OR- 3) a connection point in a level crossing in another block.
The first block is always a track segment. The direction set in the LayoutConnectivity is the direction of the track segment alone for cases 2) and 3) above. For case 1), two track segments, the direction reflects an "average" over the two track segments. See LayoutConnectivity for the allowed values of direction.
Normally the initialization only occurs once after the panel is loaded. When edge connectors are used, an incomplete LayoutConnectivity table can occur due to the panel loading sequence and the complexity of edge connector relationships. An additional initialization is allowed to build the final LayoutConnectivity table.
-
addBeanSettings
public void addBeanSettings(Path p, LayoutConnectivity lc, LayoutBlock layoutBlock)
Searches for and adds BeanSetting's to a Path as needed.This method starts at the entry point to the LayoutBlock given in the Path at the block boundary specified in the LayoutConnectivity. It follows the track looking for turnout settings that are required for a train entering on this block boundary point to exit the block. If a required turnout setting is found, the turnout and its required state are used to create a BeanSetting, which is added to the Path. Such a setting can occur, for example, if a track enters a right-handed turnout from either the diverging track or the continuing track.
If the track branches into two tracks (for example, by entering a right-handed turnout via the throat track), the search is stopped. The search is also stopped when the track reaches a different block (or an undefined block), or reaches an end bumper.
- Parameters:
p
- path to follow until branch.lc
- layout connectivity.layoutBlock
- the layout block.
-
-