public class CubeSurfaceFactory extends Object implements SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
This can be used in one of two modes (determined at construction time),
isotropic and non-isotropic.
In isotropic mode, the scaling on each of the 3 axes is the same,
and in non-isotropic mode they can vary independently of each other.
The profile and aspect configuration keys (that is, the user interface)
are different according to which mode is in effect, but the actual
surfaces generated are the same either way, undistinguished instances
of CubeSurface
.
Modifier and Type | Class and Description |
---|---|
static class |
CubeSurfaceFactory.Profile
Profile class which defines fixed configuration items for
an isotropic or non-isotropic CubeSurface.
|
Modifier and Type | Field and Description |
---|---|
static ConfigKey<Boolean> |
FRAME_KEY
Config key for whether to draw axis wire frame.
|
static double |
ISO_CENTER_TOLERANCE
Proportional auto-ranging isotropic snap-to-origin threshold.
|
static ConfigKey<Double> |
ISOCROWD_KEY
Config key for isotropic tick mark crowding.
|
static ConfigKey<Double> |
PHI_KEY
Config key for first Euler angle of rotation, units of degrees.
|
static ConfigKey<Double> |
PSI_KEY
Config key for third Euler angle of rotation, units of degrees.
|
static ConfigKey<Double> |
SCALE_KEY
Config key for cube edge length (isotropic only).
|
static ConfigKey<Double> |
THETA_KEY
Config key for second Euler angle of rotation, units of degrees.
|
static ConfigKey<Double> |
XC_KEY
Config key for X axis central position key (isotropic only).
|
static ConfigKey<Double> |
XCROWD_KEY
Config key for X axis tick mark crowding.
|
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<Double> |
XOFF_KEY
Config key for graphics X offset, units of 1/2 screen size.
|
static ConfigKey<Subrange> |
XSUBRANGE_KEY
Config key for X axis subrange.
|
static ConfigKey<Double> |
YC_KEY
Config key for Y axis central position key (isotropic only).
|
static ConfigKey<Double> |
YCROWD_KEY
Config key for Y axis tick mark crowding.
|
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<Double> |
YOFF_KEY
Config key for graphics Y offset, units of 1/2 screen size.
|
static ConfigKey<Subrange> |
YSUBRANGE_KEY
Config key for Y axis subrange.
|
static ConfigKey<Double> |
ZC_KEY
Config key for Z axis central position key (isotropic only).
|
static ConfigKey<Double> |
ZCROWD_KEY
Config key for Z axis tick mark crowding.
|
static ConfigKey<Boolean> |
ZFLIP_KEY
Config key for Z axis flip flag.
|
static ConfigKey<String> |
ZLABEL_KEY
Config key for Z axis text label.
|
static ConfigKey<Boolean> |
ZLOG_KEY
Config key for Z axis log scale flag.
|
static ConfigKey<Double> |
ZMAX_KEY
Config key for Z axis upper bound, before subranging.
|
static ConfigKey<Double> |
ZMIN_KEY
Config key for Z axis lower bound, before subranging.
|
static ConfigKey<Double> |
ZOOM_KEY
Config key for zoom factor.
|
static ConfigKey<Subrange> |
ZSUBRANGE_KEY
Config key for Z axis subrange.
|
Constructor and Description |
---|
CubeSurfaceFactory(boolean isIso)
Constructs an isotropic or non-isotropic cube surface factory.
|
Modifier and Type | Method and Description |
---|---|
CubeAspect |
createAspect(CubeSurfaceFactory.Profile profile,
ConfigMap config,
Range[] ranges)
Creates an aspect from configuration information.
|
Navigator<CubeAspect> |
createNavigator(ConfigMap navConfig)
Creates a navigator from configuration information.
|
CubeSurfaceFactory.Profile |
createProfile(ConfigMap config)
Creates a profile that can be used when creating a plot surface.
|
Surface |
createSurface(Rectangle plotBounds,
CubeSurfaceFactory.Profile profile,
CubeAspect aspect)
Returns a new plot surface.
|
static double[] |
eulerToRotationDegrees(double[] eulers)
Converts three ZXZ Euler angles to a rotation matrix.
|
ConfigMap |
getAspectConfig(Surface surface)
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.
|
ConfigKey<?>[] |
getNavigatorKeys()
Returns the configuration keys that may be used to configure
a navigator for use with this surface factory.
|
PlotMetric |
getPlotMetric()
Returns null.
|
ConfigKey<?>[] |
getProfileKeys()
Returns the configuration keys used to configure profile for this
surface factory.
|
static double[] |
getRotation(ConfigMap config)
Reads the intended rotation matrix from a configuration map.
|
Range[] |
readRanges(CubeSurfaceFactory.Profile profile,
PlotLayer[] layers,
DataStore dataStore)
Provides the ranges that may be passed to
createAspect . |
static double[] |
rotationToEulerDegrees(double[] rotmat)
Converts rotation matrix to three ZXZ Euler angles in degrees.
|
boolean |
useRanges(CubeSurfaceFactory.Profile profile,
ConfigMap config)
Indicates whether ranges should be provided to generate an aspect.
|
public static final ConfigKey<Boolean> FRAME_KEY
public static final ConfigKey<Double> XCROWD_KEY
public static final ConfigKey<Double> YCROWD_KEY
public static final ConfigKey<Double> ZCROWD_KEY
public static final ConfigKey<Double> ISOCROWD_KEY
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<Double> ZMIN_KEY
public static final ConfigKey<Double> ZMAX_KEY
public static final ConfigKey<Double> XC_KEY
public static final ConfigKey<Double> YC_KEY
public static final ConfigKey<Double> ZC_KEY
public static final ConfigKey<Double> SCALE_KEY
public static final ConfigKey<Double> PHI_KEY
public static final ConfigKey<Double> THETA_KEY
public static final ConfigKey<Double> PSI_KEY
public static final ConfigKey<Double> XOFF_KEY
public static final ConfigKey<Double> YOFF_KEY
public static final double ISO_CENTER_TOLERANCE
public CubeSurfaceFactory(boolean isIso)
isIso
- whether to operate in isotropic modepublic Surface createSurface(Rectangle plotBounds, CubeSurfaceFactory.Profile profile, CubeAspect aspect)
SurfaceFactory
createSurface
in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
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<CubeSurfaceFactory.Profile,CubeAspect>
public CubeSurfaceFactory.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<CubeSurfaceFactory.Profile,CubeAspect>
config
- map of profile configuration itemspublic ConfigKey<?>[] getAspectKeys()
SurfaceFactory
useRanges
and
createAspect
methods.getAspectKeys
in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
public boolean useRanges(CubeSurfaceFactory.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<CubeSurfaceFactory.Profile,CubeAspect>
profile
- surface configuration profileconfig
- configuration map that may contain keys from
getAspectKeys
public CubeAspect createAspect(CubeSurfaceFactory.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<CubeSurfaceFactory.Profile,CubeAspect>
profile
- surface configuration profileconfig
- configuration map that may contain keys from
getAspectKeys
ranges
- range data filled in from layers, or nullpublic ConfigMap getAspectConfig(Surface surface)
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<CubeSurfaceFactory.Profile,CubeAspect>
surface
- plot surface; if it was not created by this factory,
behaviour is undefinedpublic Range[] readRanges(CubeSurfaceFactory.Profile profile, PlotLayer[] layers, DataStore dataStore)
SurfaceFactory
createAspect
.
There is only any point calling this if useRanges
returns true.readRanges
in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
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<CubeSurfaceFactory.Profile,CubeAspect>
public Navigator<CubeAspect> createNavigator(ConfigMap navConfig)
SurfaceFactory
createNavigator
in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
navConfig
- configuration map that may contain keys from
getNavigatorKeys
public PlotMetric getPlotMetric()
getPlotMetric
in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
public static double[] getRotation(ConfigMap config)
config
- config mappublic static double[] eulerToRotationDegrees(double[] eulers)
eulers
- 1, 2 or 3-element array giving Euler angles
phi, theta, psi in degrees; if fewer elements than 3,
later angles are assumed zeropublic static double[] rotationToEulerDegrees(double[] rotmat)
rotmat
- 9-element rotation matrixCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.