Package jmri.jmrit.display.layoutEditor
Interface LayoutModels
- All Known Implementing Classes:
LayoutEditor
public interface LayoutModels
This interface serves as a manager for the overall layout model via
collections of i.e. LayoutTurnout, LayoutBlock,
PositionablePoint, Track Segment, LayoutSlip and LevelXing objects
along with their corresponding *View objects.
(Having *View objects here, which are specific to a panel, may
only be here as a temporary measure)
Provides a temporary setDirty()/isDirty() and redrawPanel() mechanism for marking changes. That may have to grow and/or change. For example, redrawPanel() (which could be renamed) might fire listeners to cause repaints.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayoutTrack(LayoutTrack trk, LayoutTrackView v) Add a LayoutTrack and LayoutTrackView to the list of LayoutTrack family objects.intcomputeDirection(LayoutTrack trk1, HitPointType h1, LayoutTrack trk2, HitPointType h2) Compute octagonal direction of vector from p1 to p2.default intcomputeDirectionAB(LayoutTurnout track) default intcomputeDirectionAC(LayoutTurnout track) default intcomputeDirectionAD(LayoutTurnout track) default intcomputeDirectionBC(LayoutTurnout track) default intcomputeDirectionBD(LayoutTurnout track) default intcomputeDirectionCD(LayoutTurnout track) intintcomputeDirectionToCenter(LayoutTrack trk1, HitPointType h1, PositionablePoint p) default voiddisplayRemoveWarning(LayoutTrack track, List<String> itemList, String typeKey) Invoked to display a warning about removal.Read-only access to the list of LayoutTrack family objects.getLayoutTracksOfClass(Class<? extends LayoutTrack> layoutTrackClass) Read-only access to the list of LayoutTrackView family objects.getLayoutTrackViewsOfClass(Class<? extends LayoutTrackView> layoutTrackViewClass) getLevelXingView(LevelXing xing) booleanisDirty()Check the dirty statevoidA change has happen that might not need to be stored, but should cause the presentation to be updated.voidIf item present, delete from the list of LayoutTracks and force a dirty redraw.voidsetDirty()
-
Method Details
-
isDirty
boolean isDirty()Check the dirty state- Returns:
- true if contents of models have changed,
-
setDirty
void setDirty() -
redrawPanel
void redrawPanel()A change has happen that might not need to be stored, but should cause the presentation to be updated. -
getLEAuxTools
-
getLayoutTracksOfClass
-
getLayoutTrackViewsOfClass
@Nonnull Stream<LayoutTrackView> getLayoutTrackViewsOfClass(Class<? extends LayoutTrackView> layoutTrackViewClass) -
getPositionablePointViews
-
getPositionablePoints
-
getLayoutSlips
-
getTrackSegmentViews
-
getTrackSegments
-
getLayoutTurnouts
-
getLayoutTurntables
-
getLevelXings
-
getLevelXingViews
-
getLayoutTracks
Read-only access to the list of LayoutTrack family objects. The returned list will throw UnsupportedOperationException if you attempt to modify it.- Returns:
- unmodifiable copy of layout track list.
-
getLayoutTrackViews
Read-only access to the list of LayoutTrackView family objects. The returned list will throw UnsupportedOperationException if you attempt to modify it.- Returns:
- unmodifiable copy of track views.
-
getLayoutTrackView
-
getLevelXingView
-
getLayoutTurnoutView
-
getLayoutTurntableView
-
getTrackSegmentView
-
getPositionablePointView
-
addLayoutTrack
Add a LayoutTrack and LayoutTrackView to the list of LayoutTrack family objects.- Parameters:
trk- to be storedv- corresponding view
-
removeLayoutTrack
If item present, delete from the list of LayoutTracks and force a dirty redraw.- Parameters:
trk- the layout track to remove.
-
getLayoutTurnoutsAndSlips
-
getLayoutShapes
-
computeDirection
int computeDirection(@Nonnull LayoutTrack trk1, @Nonnull HitPointType h1, @Nonnull LayoutTrack trk2, @Nonnull HitPointType h2) Compute octagonal direction of vector from p1 to p2.The octagonal (8) directions are: North, North-East, East, South-East, South, South-West, West and North-West; see
Pathfor more on this.This method must eventually be in terms _other_ than the screen geometry of the associated LayoutTrackView objects, as it's meant to be the track connectivity direction not the on the screen implementation.
- Parameters:
trk1- track at "from" endh1- the hit point for "from" endtrk2- the track at the "to" endh2- the hit at the "to" end- Returns:
- the octagonal direction from p1 to p2
-
computeDirectionToCenter
int computeDirectionToCenter(@Nonnull LayoutTrack trk1, @Nonnull HitPointType h1, @Nonnull PositionablePoint p) -
computeDirectionFromCenter
int computeDirectionFromCenter(@Nonnull PositionablePoint p, @Nonnull LayoutTrack trk1, @Nonnull HitPointType h1) -
computeDirectionAB
-
computeDirectionAC
-
computeDirectionAD
-
computeDirectionBC
-
computeDirectionBD
-
computeDirectionCD
-
displayRemoveWarning
Invoked to display a warning about removal. Lists the attached items that prevent removing the layout track item.The default implementation refers this to a View object for displaying a Dialog.
- Parameters:
track- The involved trackitemList- A list of the attached heads, masts and/or sensors.typeKey- The object type such as Turnout, Level Crossing, etc.
-