uk.ac.starlink.ttools.plot2.geom
Class CubeSurfaceFactory

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.geom.CubeSurfaceFactory
All Implemented Interfaces:
SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>

public class CubeSurfaceFactory
extends Object
implements SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>

Surface factory for 3-d plotting.

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.

Since:
20 Feb 2013
Author:
Mark Taylor

Nested Class Summary
static class CubeSurfaceFactory.Profile
          Profile class which defines fixed configuration items for an isotropic or non-isotropic CubeSurface.
 
Field Summary
static ConfigKey<Boolean> FRAME_KEY
          Config key for whether to draw axis wire frame.
static ConfigKey<Double> ISOCROWD_KEY
          Config key for isotropic tick mark crowding.
static ConfigKey<Double> PHI_KEY
          Config key for rotation about vertical, units of degrees.
static ConfigKey<double[]> ROTMAT_KEY
          Config key for rotation matrix.
static ConfigKey<Double> SCALE_KEY
          Config key for cube edge length (isotropic only).
static ConfigKey<Double> THETA_KEY
          Config key for rotation from vertical, 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 Summary
CubeSurfaceFactory(boolean isIso)
          Constructs an isotropic or non-isotropic cube surface factory.
 
Method Summary
 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.
 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.
 ConfigKey[] getProfileKeys()
          Returns the configuration keys used to configure profile for this surface factory.
static double[] getRotation(ConfigMap rangeConfig)
          Reads the intended rotation matrix from a range configuration map.
 Range[] readRanges(CubeSurfaceFactory.Profile profile, PlotLayer[] layers, DataStore dataStore)
          Provides the ranges that may be passed to createAspect.
 boolean useRanges(CubeSurfaceFactory.Profile profile, ConfigMap config)
          Indicates whether ranges should be provided to generate an aspect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XLOG_KEY

public static final ConfigKey<Boolean> XLOG_KEY
Config key for X axis log scale flag.


YLOG_KEY

public static final ConfigKey<Boolean> YLOG_KEY
Config key for Y axis log scale flag.


ZLOG_KEY

public static final ConfigKey<Boolean> ZLOG_KEY
Config key for Z axis log scale flag.


XFLIP_KEY

public static final ConfigKey<Boolean> XFLIP_KEY
Config key for X axis flip flag.


YFLIP_KEY

public static final ConfigKey<Boolean> YFLIP_KEY
Config key for Y axis flip flag.


ZFLIP_KEY

public static final ConfigKey<Boolean> ZFLIP_KEY
Config key for Z axis flip flag.


XLABEL_KEY

public static final ConfigKey<String> XLABEL_KEY
Config key for X axis text label.


YLABEL_KEY

public static final ConfigKey<String> YLABEL_KEY
Config key for Y axis text label.


ZLABEL_KEY

public static final ConfigKey<String> ZLABEL_KEY
Config key for Z axis text label.


FRAME_KEY

public static final ConfigKey<Boolean> FRAME_KEY
Config key for whether to draw axis wire frame.


XCROWD_KEY

public static final ConfigKey<Double> XCROWD_KEY
Config key for X axis tick mark crowding.


YCROWD_KEY

public static final ConfigKey<Double> YCROWD_KEY
Config key for Y axis tick mark crowding.


ZCROWD_KEY

public static final ConfigKey<Double> ZCROWD_KEY
Config key for Z axis tick mark crowding.


ISOCROWD_KEY

public static final ConfigKey<Double> ISOCROWD_KEY
Config key for isotropic tick mark crowding.


XMIN_KEY

public static final ConfigKey<Double> XMIN_KEY
Config key for X axis lower bound, before subranging.


XMAX_KEY

public static final ConfigKey<Double> XMAX_KEY
Config key for X axis upper bound, before subranging.


XSUBRANGE_KEY

public static final ConfigKey<Subrange> XSUBRANGE_KEY
Config key for X axis subrange.


YMIN_KEY

public static final ConfigKey<Double> YMIN_KEY
Config key for Y axis lower bound, before subranging.


YMAX_KEY

public static final ConfigKey<Double> YMAX_KEY
Config key for Y axis upper bound, before subranging.


YSUBRANGE_KEY

public static final ConfigKey<Subrange> YSUBRANGE_KEY
Config key for Y axis subrange.


ZMIN_KEY

public static final ConfigKey<Double> ZMIN_KEY
Config key for Z axis lower bound, before subranging.


ZMAX_KEY

public static final ConfigKey<Double> ZMAX_KEY
Config key for Z axis upper bound, before subranging.


ZSUBRANGE_KEY

public static final ConfigKey<Subrange> ZSUBRANGE_KEY
Config key for Z axis subrange.


XC_KEY

public static final ConfigKey<Double> XC_KEY
Config key for X axis central position key (isotropic only).


YC_KEY

public static final ConfigKey<Double> YC_KEY
Config key for Y axis central position key (isotropic only).


ZC_KEY

public static final ConfigKey<Double> ZC_KEY
Config key for Z axis central position key (isotropic only).


SCALE_KEY

public static final ConfigKey<Double> SCALE_KEY
Config key for cube edge length (isotropic only).


THETA_KEY

public static final ConfigKey<Double> THETA_KEY
Config key for rotation from vertical, units of degrees.


PHI_KEY

public static final ConfigKey<Double> PHI_KEY
Config key for rotation about vertical, units of degrees.


ZOOM_KEY

public static final ConfigKey<Double> ZOOM_KEY
Config key for zoom factor.


XOFF_KEY

public static final ConfigKey<Double> XOFF_KEY
Config key for graphics X offset, units of 1/2 screen size.


YOFF_KEY

public static final ConfigKey<Double> YOFF_KEY
Config key for graphics Y offset, units of 1/2 screen size.


ROTMAT_KEY

public static final ConfigKey<double[]> ROTMAT_KEY
Config key for rotation matrix. This key is hidden, but if present it overrides THETA_KEY and PHI_KEY.

Constructor Detail

CubeSurfaceFactory

public CubeSurfaceFactory(boolean isIso)
Constructs an isotropic or non-isotropic cube surface factory.

Parameters:
isIso - whether to operate in isotropic mode
Method Detail

createSurface

public Surface createSurface(Rectangle plotBounds,
                             CubeSurfaceFactory.Profile profile,
                             CubeAspect aspect)
Description copied from interface: SurfaceFactory
Returns a new plot surface.

Specified by:
createSurface in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Parameters:
plotBounds - rectangle to containing actual plot data (not insets)
profile - configuration object defining plot style
aspect - configuration object defining plot viewpoint
Returns:
new plot surface

getProfileKeys

public ConfigKey[] getProfileKeys()
Description copied from interface: SurfaceFactory
Returns the configuration keys used to configure profile for this surface factory. The returned keys are used in the map supplied to the createProfile method.

Specified by:
getProfileKeys in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Returns:
profile configuration keys

createProfile

public CubeSurfaceFactory.Profile createProfile(ConfigMap config)
Description copied from interface: SurfaceFactory
Creates a profile that can be used when creating a plot surface. The keys that are significant in the supplied config map are those returned by getProfileKeys. The return value can be used as input to createSurface and other methods in this class.

Specified by:
createProfile in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Parameters:
config - map of profile configuration items
Returns:
factory-specific plot surface profile

getAspectKeys

public ConfigKey[] getAspectKeys()
Description copied from interface: SurfaceFactory
Returns the configuration keys that may be used to configure aspect for this surface factory. The returned keys are used in the map supplied to the useRanges and createAspect methods.

Specified by:
getAspectKeys in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Returns:
aspect configuration keys

useRanges

public boolean useRanges(CubeSurfaceFactory.Profile profile,
                         ConfigMap config)
Description copied from interface: SurfaceFactory
Indicates whether ranges should be provided to generate an aspect. If true, it is beneficial to pass the result of readRanges to createAspect alongside the arguments of this method. If false, any such ranges will be ignored.

Specified by:
useRanges in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Parameters:
profile - surface configuration profile
config - configuration map that may contain keys from getAspectKeys
Returns:
true iff calculated ranges will be of use

createAspect

public CubeAspect createAspect(CubeSurfaceFactory.Profile profile,
                               ConfigMap config,
                               Range[] ranges)
Description copied from interface: SurfaceFactory
Creates an aspect from configuration information. The ranges argument will be used only if 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.

Specified by:
createAspect in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Parameters:
profile - surface configuration profile
config - configuration map that may contain keys from getAspectKeys
ranges - range data filled in from layers, or null
Returns:
new aspect

readRanges

public Range[] readRanges(CubeSurfaceFactory.Profile profile,
                          PlotLayer[] layers,
                          DataStore dataStore)
Description copied from interface: SurfaceFactory
Provides the ranges that may be passed to createAspect. There is only any point calling this if useRanges returns true.

Specified by:
readRanges in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Parameters:
profile - surface configuration profile
layers - plot layers to be plotted
dataStore - contains actual data
Returns:
data ranges covered by the given layers filled in from data

getNavigatorKeys

public ConfigKey[] getNavigatorKeys()
Description copied from interface: SurfaceFactory
Returns the configuration keys that may be used to configure a navigator for use with this surface factory. The returned keys are used in the map supplied to the SurfaceFactory.createNavigator(uk.ac.starlink.ttools.plot2.config.ConfigMap) method.

Specified by:
getNavigatorKeys in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Returns:
navigator configuration keys

createNavigator

public Navigator<CubeAspect> createNavigator(ConfigMap navConfig)
Description copied from interface: SurfaceFactory
Creates a navigator from configuration information. The returned value will be non-null.

Specified by:
createNavigator in interface SurfaceFactory<CubeSurfaceFactory.Profile,CubeAspect>
Parameters:
navConfig - configuration map that may contain keys from getNavigatorKeys
Returns:
navigator for use with surfaces produced by this factory

getRotation

public static double[] getRotation(ConfigMap rangeConfig)
Reads the intended rotation matrix from a range configuration map. If the hidden key ROTMAT_KEY is present that is used, otherwise use the public keys THETA and PHI.

Parameters:
rangeConfig - config map from which range values may be read
Returns:
9-element rotation matrix


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.