Package uk.ac.starlink.topcat.plot2
Class AbstractZoneController<P,A>
java.lang.Object
uk.ac.starlink.topcat.plot2.AbstractZoneController<P,A>
- All Implemented Interfaces:
Configger
,ZoneController<P,
A>
Partial ZoneController implementation.
- Since:
- 18 Aug 2023
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractZoneController
(uk.ac.starlink.ttools.plot2.SurfaceFactory<P, A> surfFact) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
clearRange
(P oldProfile, P newProfile, uk.ac.starlink.ttools.plot2.PlotLayer[] oldLayers, uk.ac.starlink.ttools.plot2.PlotLayer[] newLayers, boolean lock) Indicates whether a new configuration should result in clearing the current ranges and plot aspect.protected abstract boolean
forceClearRange
(P oldProfile, P newProfile) Determines whether the change between two profiles forces an unconditional re-range of the plotting surface.Returns the plot aspect to use for setting up the plot surface.uk.ac.starlink.ttools.plot2.Navigator
<A> Returns the navigator specified by this control.uk.ac.starlink.ttools.plot.Range[]
Returns the current fixed data coordinate ranges.void
Sets the plot aspect which defines the view on the data.void
setLatestSurface
(uk.ac.starlink.ttools.plot2.Surface surface) Accepts information about the latest plotting surface to be plotted by the panel associated with this controller.void
setRanges
(uk.ac.starlink.ttools.plot.Range[] ranges) Sets fixed data position coordinate ranges.void
submitReports
(Map<LayerId, uk.ac.starlink.ttools.plot2.ReportMap> reports) Accepts report information generated by plotting layers.void
updateState
(P profile, uk.ac.starlink.ttools.plot2.PlotLayer[] layers, boolean axisLock) Configures this controller for a given set of plot layers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.starlink.topcat.plot2.ZoneController
clearAspect
-
Constructor Details
-
AbstractZoneController
Constructor.- Parameters:
surfFact
- surface factory
-
-
Method Details
-
setRanges
public void setRanges(uk.ac.starlink.ttools.plot.Range[] ranges) Sets fixed data position coordinate ranges. If these are not set then they may need to be calculated by examining the data to work out the plot aspect. Setting them to null ensures a re-range if required next time.- Specified by:
setRanges
in interfaceZoneController<P,
A> - Parameters:
ranges
- fixed data position coordinate ranges, or null to clear
-
getRanges
public uk.ac.starlink.ttools.plot.Range[] getRanges()Returns the current fixed data coordinate ranges. If not known, null is returned.- Specified by:
getRanges
in interfaceZoneController<P,
A> - Returns:
- fixed data position coordinate ranges, or null if not known
-
setAspect
Sets the plot aspect which defines the view on the data. If not set, it may have to be worked out from config and range inputs.- Specified by:
setAspect
in interfaceZoneController<P,
A> - Parameters:
aspect
- fixed aspect, or null to clear
-
getAspect
Returns the plot aspect to use for setting up the plot surface. If not known, null is returned.- Specified by:
getAspect
in interfaceZoneController<P,
A> - Returns:
- fixed aspect, or null if none set
-
updateState
public void updateState(P profile, uk.ac.starlink.ttools.plot2.PlotLayer[] layers, boolean axisLock) Configures this controller for a given set of plot layers. This may trigger a resetting of the aspect and ranges, generally if the new plot is sufficiently different from most recent one. Whether that's the case is determined by callingclearRange
.This isn't perfect, since it only allows to clear the range or not. Sometimes you might want finer control, e.g. to clear the range in one dimension and retain it in others. It may be possible to fit that into the updateState API, but it would require more work.
- Specified by:
updateState
in interfaceZoneController<P,
A> - Parameters:
profile
- surface profilelayers
- layers which will be plottedaxisLock
- whether re-ranging is inhibited; normally, if true axes will not be reset by this method, but the implementation can override that if it needs to
-
submitReports
Accepts report information generated by plotting layers. Null map values are permitted, with the same meaning as an empty map.The default implementation does nothing, but subclasses may override it to enquire about plot results.
- Specified by:
submitReports
in interfaceZoneController<P,
A> - Parameters:
reports
- per-layer plot reports for layers generated by the most recent plot
-
setLatestSurface
public void setLatestSurface(uk.ac.starlink.ttools.plot2.Surface surface) Accepts information about the latest plotting surface to be plotted by the panel associated with this controller. This method is intended for passing information back to this controller, which does not otherwise have access to the asynchronously constructed Surface object it has configured, it is not an instruction to adjust the current state.The default implementation does nothing, but subclasses may override it to acquire information about plot state.
- Specified by:
setLatestSurface
in interfaceZoneController<P,
A> - Parameters:
surface
- latest plotting surface.
-
clearRange
protected boolean clearRange(P oldProfile, P newProfile, uk.ac.starlink.ttools.plot2.PlotLayer[] oldLayers, uk.ac.starlink.ttools.plot2.PlotLayer[] newLayers, boolean lock) Indicates whether a new configuration should result in clearing the current ranges and plot aspect.- Parameters:
oldProfile
- profile for last plotnewProfile
- profile for next plotoldLayers
- layer set for last plotnewLayers
- layer set for next plotlock
- whether re-ranging is inhibited; normally, iflock
is true this method should return false, but the implementation can overrule this and return true even when locked if it needs to- Returns:
- true iff the range should be re-established for the next plot
-
forceClearRange
Determines whether the change between two profiles forces an unconditional re-range of the plotting surface. This method should return true if the plotting surface will change between the old and new supplied profiles sufficiently to invalidate previously calculated auto range data.- Parameters:
oldProfile
- profile before changenewProfile
- profile after change- Returns:
- true if a new auto-ranging is required
-