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:
LayoutEditorFindItems
,LayoutEditorAuxTools
-
-
Method Summary
-
-
-
Method Detail
-
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
@Nonnull LayoutEditorAuxTools getLEAuxTools()
-
getLayoutTracksOfClass
@Nonnull java.util.stream.Stream<LayoutTrack> getLayoutTracksOfClass(java.lang.Class<? extends LayoutTrack> layoutTrackClass)
-
getLayoutTrackViewsOfClass
@Nonnull java.util.stream.Stream<LayoutTrackView> getLayoutTrackViewsOfClass(java.lang.Class<? extends LayoutTrackView> layoutTrackViewClass)
-
getPositionablePointViews
@Nonnull java.util.List<PositionablePointView> getPositionablePointViews()
-
getPositionablePoints
@Nonnull java.util.List<PositionablePoint> getPositionablePoints()
-
getLayoutSlips
@Nonnull java.util.List<LayoutSlip> getLayoutSlips()
-
getTrackSegmentViews
@Nonnull java.util.List<TrackSegmentView> getTrackSegmentViews()
-
getTrackSegments
@Nonnull java.util.List<TrackSegment> getTrackSegments()
-
getLayoutTurnouts
@Nonnull java.util.List<LayoutTurnout> getLayoutTurnouts()
-
getLayoutTurntables
@Nonnull java.util.List<LayoutTurntable> getLayoutTurntables()
-
getLevelXings
@Nonnull java.util.List<LevelXing> getLevelXings()
-
getLevelXingViews
@Nonnull java.util.List<LevelXingView> getLevelXingViews()
-
getLayoutTracks
@Nonnull java.util.List<LayoutTrack> 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
@Nonnull java.util.List<LayoutTrackView> 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
LayoutTrackView getLayoutTrackView(LayoutTrack trk)
-
getLevelXingView
LevelXingView getLevelXingView(LevelXing xing)
-
getLayoutTurnoutView
LayoutTurnoutView getLayoutTurnoutView(LayoutTurnout to)
-
getLayoutTurntableView
LayoutTurntableView getLayoutTurntableView(LayoutTurntable to)
-
getTrackSegmentView
TrackSegmentView getTrackSegmentView(TrackSegment to)
-
getPositionablePointView
PositionablePointView getPositionablePointView(PositionablePoint to)
-
addLayoutTrack
void addLayoutTrack(@Nonnull LayoutTrack trk, @Nonnull LayoutTrackView v)
Add a LayoutTrack and LayoutTrackView to the list of LayoutTrack family objects.- Parameters:
trk
- to be storedv
- corresponding view
-
removeLayoutTrack
void removeLayoutTrack(@Nonnull LayoutTrack trk)
If item present, delete from the list of LayoutTracks and force a dirty redraw.- Parameters:
trk
- the layout track to remove.
-
getLayoutTurnoutsAndSlips
@Nonnull java.util.List<LayoutTurnout> getLayoutTurnoutsAndSlips()
-
getLayoutShapes
@Nonnull java.util.List<LayoutShape> 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
Path
for 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
default int computeDirectionAB(@Nonnull LayoutTurnout track)
-
computeDirectionAC
default int computeDirectionAC(@Nonnull LayoutTurnout track)
-
computeDirectionAD
default int computeDirectionAD(@Nonnull LayoutTurnout track)
-
computeDirectionBC
default int computeDirectionBC(@Nonnull LayoutTurnout track)
-
computeDirectionBD
default int computeDirectionBD(@Nonnull LayoutTurnout track)
-
computeDirectionCD
default int computeDirectionCD(@Nonnull LayoutTurnout track)
-
displayRemoveWarning
default void displayRemoveWarning(LayoutTrack track, java.util.List<java.lang.String> itemList, java.lang.String typeKey)
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.
-
-