public class PlaneSurfaceFactory extends Object implements SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
Modifier and Type | Class and Description |
---|---|
static interface |
PlaneSurfaceFactory.Config
Specifies configuration options for the PlaneSurfaceFactory.
|
static class |
PlaneSurfaceFactory.Profile
Profile class which defines fixed configuration items for
a PlaneSurface.
|
Modifier and Type | Field and Description |
---|---|
static PlaneSurfaceFactory.Config |
DFLT_CONFIG
Default configuration for plane surface factory.
|
static ConfigKey<Boolean> |
GRID_KEY
Config key to determine if grid lines are drawn.
|
static ConfigKey<boolean[]> |
NAVAXES_KEY
Config key to select which axes navigation actions will operate on.
|
static ConfigKey<OrientationPolicy> |
ORIENTATIONS_KEY_MATRIX
OrientationPolicy key for use with Matrix plot.
|
static ConfigKey<OrientationPolicy> |
ORIENTATIONS_KEY_PLANE
OrientationPolicy key for use with Plane plot.
|
static ConfigKey<JELFunction> |
X2FUNC_KEY
Config key for secondary X axis function.
|
static ConfigKey<String> |
X2LABEL_KEY
Config key for secondary X axis text label.
|
static ConfigKey<Boolean> |
XANCHOR_KEY
Config key to anchor X axis during zooms.
|
static ConfigKey<Double> |
XCROWD_KEY
Config key to control tick mark crowding on X axis.
|
static ConfigKey<Boolean> |
XFLIP_KEY
Config key for X axis flip flag.
|
static ConfigKey<String> |
XLABEL_KEY
Config key for X axis text label.
|
static ConfigKey<Boolean> |
XLOG_KEY
Config key for X axis log scale flag.
|
static ConfigKey<Double> |
XMAX_KEY
Config key for X axis upper bound, before subranging.
|
static ConfigKey<Double> |
XMIN_KEY
Config key for X axis lower bound, before subranging.
|
static ConfigKey<Subrange> |
XSUBRANGE_KEY
Config key for X axis subrange.
|
static ConfigKey<Double> |
XYFACTOR_KEY
Config key for axis aspect ratio fix.
|
static ConfigKey<JELFunction> |
Y2FUNC_KEY
Config key for secondary Y axis function.
|
static ConfigKey<String> |
Y2LABEL_KEY
Config key for secondary Y axis text label.
|
static ConfigKey<Boolean> |
YANCHOR_KEY
Config key to anchor Y axis during zooms.
|
static ConfigKey<Double> |
YCROWD_KEY
Config key to control tick mark crowding on Y axis.
|
static ConfigKey<Boolean> |
YFLIP_KEY
Config key for Y axis flip flag.
|
static ConfigKey<String> |
YLABEL_KEY
Config key for Y axis text label.
|
static ConfigKey<Boolean> |
YLOG_KEY
Config key for Y axis log scale flag.
|
static ConfigKey<Double> |
YMAX_KEY
Config key for Y axis upper bound, before subranging.
|
static ConfigKey<Double> |
YMIN_KEY
Config key for Y axis lower bound, before subranging.
|
static ConfigKey<Subrange> |
YSUBRANGE_KEY
Config key for Y axis subrange.
|
Constructor and Description |
---|
PlaneSurfaceFactory()
Constructs a PlaneSurfaceFactory with default characteristics.
|
PlaneSurfaceFactory(PlaneSurfaceFactory.Config config)
Constructs a PlaneSurfaceFactory with configurable characteristics.
|
Modifier and Type | Method and Description |
---|---|
PlaneAspect |
createAspect(PlaneSurfaceFactory.Profile profile,
ConfigMap config,
Range[] ranges)
Creates an aspect from configuration information.
|
static ConfigKey<Boolean> |
createAxisAnchorKey(String axname,
boolean dflt)
Creates a config key for determining whether a named axis is
to be anchored at a data value of zero.
|
static ConfigKey<Double> |
createAxisCrowdKey(String axname)
Creates a config key for determining tickmark crowding on a named axis.
|
static ConfigKey<Boolean> |
createAxisFlipKey(String axname)
Creates a config key for determining whether a named Cartesian axis
is to be reversed.
|
static ConfigKey<Double> |
createAxisLimitKey(String axname,
boolean isMax)
Creates a config key for fixing a minimum or maximum limit
for a named axis.
|
static ConfigKey<Boolean> |
createAxisLogKey(String axname)
Creates a config key for determining whether a named Cartesian axis
is logarithmic or linear.
|
static ConfigKey<Subrange> |
createAxisSubrangeKey(String axname)
Creates a config key for selecting a subrange on a named Cartesian axis.
|
Navigator<PlaneAspect> |
createNavigator(ConfigMap navConfig)
Creates a navigator from configuration information.
|
static ConfigKey<OrientationPolicy> |
createOrientationsKey(OrientationPolicy dflt)
Returns an OrientationPolicy config key suitable for use with this
factory, but with a configurable default value.
|
PlaneSurfaceFactory.Profile |
createProfile(ConfigMap config)
Creates a profile that can be used when creating a plot surface.
|
static ConfigKey<JELFunction> |
createSecondaryAxisFunctionKey(String primaryAxisName)
Creates a config key for a secondary axis function.
|
static ConfigKey<String> |
createSecondaryAxisLabelKey(String primaryAxisName)
Returns a labelling config key for a secondary axis.
|
Surface |
createSurface(Rectangle plotBounds,
PlaneSurfaceFactory.Profile profile,
PlaneAspect aspect)
Returns a new plot surface.
|
ConfigMap |
getAspectConfig(Surface surf)
Returns a ConfigMap that corresponds to the configuration of
the given surface, which must have been created by this factory.
|
ConfigKey<?>[] |
getAspectKeys()
Returns the configuration keys that may be used to configure aspect
for this surface factory.
|
static double[] |
getLimits(ConfigMap config,
ConfigKey<Double> minKey,
ConfigKey<Double> maxKey,
ConfigKey<Subrange> subrangeKey,
boolean isLog,
Range range)
Utility method to interrogate axis range configuration variables
and work out the actual range to use on a given Cartesian axis.
|
static double[] |
getLimits(double lo,
double hi,
Subrange subrange,
boolean isLog,
Range range)
Utility method to determine actual axis limits based on
requested high/low values and a subrange.
|
ConfigKey<?>[] |
getNavigatorKeys()
Returns the configuration keys that may be used to configure
a navigator for use with this surface factory.
|
ConfigKey<OrientationPolicy> |
getOrientationsKey()
Returns the OrientationPolicy config key used by this factory.
|
PlotMetric |
getPlotMetric()
Returns an object that can assess distances between graphic
positions on the plot surface.
|
ConfigKey<?>[] |
getProfileKeys()
Returns the configuration keys used to configure profile for this
surface factory.
|
XyKeyPair<?>[] |
getXyKeyPairs()
Returns a list of those keys which apply equally to the X and Y axes.
|
Range[] |
readRanges(PlaneSurfaceFactory.Profile profile,
PlotLayer[] layers,
DataStore dataStore)
Provides the ranges that may be passed to
createAspect . |
boolean |
useRanges(PlaneSurfaceFactory.Profile profile,
ConfigMap config)
Indicates whether ranges should be provided to generate an aspect.
|
public static final ConfigKey<Double> XMIN_KEY
public static final ConfigKey<Double> XMAX_KEY
public static final ConfigKey<Double> YMIN_KEY
public static final ConfigKey<Double> YMAX_KEY
public static final ConfigKey<JELFunction> X2FUNC_KEY
public static final ConfigKey<JELFunction> Y2FUNC_KEY
public static final ConfigKey<String> X2LABEL_KEY
public static final ConfigKey<String> Y2LABEL_KEY
public static final ConfigKey<Double> XYFACTOR_KEY
public static final ConfigKey<Boolean> GRID_KEY
public static final ConfigKey<Double> XCROWD_KEY
public static final ConfigKey<Double> YCROWD_KEY
public static final ConfigKey<boolean[]> NAVAXES_KEY
public static final ConfigKey<Boolean> XANCHOR_KEY
public static final ConfigKey<Boolean> YANCHOR_KEY
public static final ConfigKey<OrientationPolicy> ORIENTATIONS_KEY_PLANE
public static final ConfigKey<OrientationPolicy> ORIENTATIONS_KEY_MATRIX
public static final PlaneSurfaceFactory.Config DFLT_CONFIG
public PlaneSurfaceFactory()
public PlaneSurfaceFactory(PlaneSurfaceFactory.Config config)
config
- configuration optionspublic Surface createSurface(Rectangle plotBounds, PlaneSurfaceFactory.Profile profile, PlaneAspect aspect)
SurfaceFactory
createSurface
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
plotBounds
- rectangle to containing actual plot data
(not insets)profile
- configuration object defining plot styleaspect
- configuration object defining plot viewpointpublic ConfigKey<?>[] getProfileKeys()
SurfaceFactory
createProfile
method.getProfileKeys
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
public PlaneSurfaceFactory.Profile createProfile(ConfigMap config)
SurfaceFactory
getProfileKeys
.
The return value can be used as input to
createSurface
and other methods in this class.createProfile
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
config
- map of profile configuration itemspublic ConfigKey<?>[] getAspectKeys()
SurfaceFactory
useRanges
and
createAspect
methods.getAspectKeys
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
public boolean useRanges(PlaneSurfaceFactory.Profile profile, ConfigMap config)
SurfaceFactory
readRanges
to createAspect
alongside the arguments of this method.
If false, any such ranges will be ignored.useRanges
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
profile
- surface configuration profileconfig
- configuration map that may contain keys from
getAspectKeys
public PlaneAspect createAspect(PlaneSurfaceFactory.Profile profile, ConfigMap config, Range[] ranges)
SurfaceFactory
useRanges
returns true.
It is legal to give the ranges argument as null in any case.
In all cases, the returned value must be non-null and usable by
createSurface
.createAspect
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
profile
- surface configuration profileconfig
- configuration map that may contain keys from
getAspectKeys
ranges
- range data filled in from layers, or nullpublic ConfigMap getAspectConfig(Surface surf)
SurfaceFactory
createAspect
method with
the right profile should come up with approximately the same
surface, preferably without reference to any supplied ranges.
The returned config items should be optimised for presentation to the user, so that for instance decimal values are reported to a reasonable level of precision. Because of this, and perhaps for other reasons related to implementation, a surface resulting from feeding the returned config back to this factory may not be identical to the supplied surface, so round-tripping is not guaranteed to be exact.
getAspectConfig
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
surf
- plot surface; if it was not created by this factory,
behaviour is undefinedpublic Range[] readRanges(PlaneSurfaceFactory.Profile profile, PlotLayer[] layers, DataStore dataStore)
SurfaceFactory
createAspect
.
There is only any point calling this if useRanges
returns true.readRanges
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
profile
- surface configuration profilelayers
- plot layers to be plotteddataStore
- contains actual datapublic ConfigKey<?>[] getNavigatorKeys()
SurfaceFactory
SurfaceFactory.createNavigator(uk.ac.starlink.ttools.plot2.config.ConfigMap)
method.getNavigatorKeys
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
public Navigator<PlaneAspect> createNavigator(ConfigMap navConfig)
SurfaceFactory
createNavigator
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
navConfig
- configuration map that may contain keys from
getNavigatorKeys
public PlotMetric getPlotMetric()
SurfaceFactory
getPlotMetric
in interface SurfaceFactory<PlaneSurfaceFactory.Profile,PlaneAspect>
public XyKeyPair<?>[] getXyKeyPairs()
public ConfigKey<OrientationPolicy> getOrientationsKey()
public static ConfigKey<Boolean> createAxisAnchorKey(String axname, boolean dflt)
axname
- axis namedflt
- anchor default valuepublic static ConfigKey<Double> createAxisLimitKey(String axname, boolean isMax)
axname
- axis nameisMax
- true for upper limit, false for lower limitpublic static ConfigKey<Boolean> createAxisLogKey(String axname)
axname
- axis namepublic static ConfigKey<Boolean> createAxisFlipKey(String axname)
axname
- axis namepublic static ConfigKey<Subrange> createAxisSubrangeKey(String axname)
axname
- axis namepublic static ConfigKey<Double> createAxisCrowdKey(String axname)
axname
- axis namepublic static ConfigKey<JELFunction> createSecondaryAxisFunctionKey(String primaryAxisName)
primaryAxisName
- name of primary axis, for instance "X"public static ConfigKey<String> createSecondaryAxisLabelKey(String primaryAxisName)
primaryAxisName
- name of primary axis to which the
secondary axis relatespublic static ConfigKey<OrientationPolicy> createOrientationsKey(OrientationPolicy dflt)
public static double[] getLimits(ConfigMap config, ConfigKey<Double> minKey, ConfigKey<Double> maxKey, ConfigKey<Subrange> subrangeKey, boolean isLog, Range range)
config
- config map containing config valuesminKey
- config key giving axis lower bound before subrangingmaxKey
- config key giving axis upper bound before subrangingsubrangeKey
- config key giving subrange valueisLog
- true for logarithmic axis, false for linearrange
- data range on axis; may be partially populated or nullpublic static double[] getLimits(double lo, double hi, Subrange subrange, boolean isLog, Range range)
lo
- requested lower bound before subranging, may be NaNhi
- requested upper bound before subranging, may be NaNsubrange
- requested subrangeisLog
- true for logarithmic axis, false for linearrange
- actual data range on axis;
may be partially populated or nullCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.