Package uk.ac.starlink.ttools.plot2.geom
Class SkySurfaceFactory
java.lang.Object
uk.ac.starlink.ttools.plot2.geom.SkySurfaceFactory
- All Implemented Interfaces:
SurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect>
public class SkySurfaceFactory
extends Object
implements SurfaceFactory<SkySurfaceFactory.Profile,SkyAspect>
Surface factory for plotting on the surface of the celestial sphere.
- Since:
- 20 Feb 2013
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Profile class which defines fixed configuration items for a SkySurface. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConfigKey<SkyAxisLabeller>
Config key to control axis label positioning.Config key to control tick mark crowding.Config key for the sky system used for supplying data.Config key for specifying aspect field of view, in degrees.Config key to determine whether grid lines are drawn.Config key for specifying aspect central latitude, in degrees.Config key for specifying aspect central longitude, in degrees.static final ConfigKey<Projection>
Config key for sky projection type.Config key to determine whether longitude runs right to left.Config key to determine whether sexagesimal coordinates are used.Config key for the sky system used for projecting the data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateAspect
(SkySurfaceFactory.Profile profile, ConfigMap config, Range[] ranges) Creates an aspect from configuration information.createNavigator
(ConfigMap navConfig) Creates a navigator from configuration information.createProfile
(ConfigMap config) Creates a profile that can be used when creating a plot surface.createSurface
(Rectangle plotBounds, SkySurfaceFactory.Profile p, SkyAspect aspect) Returns a new plot surface.getAspectConfig
(Surface surf) Returns a ConfigMap that corresponds to the configuration of the given surface, which must have been created by this factory.ConfigKey<?>[]
Returns the configuration keys that may be used to configure aspect for this surface factory.ConfigKey<?>[]
Returns the configuration keys that may be used to configure a navigator for use with this surface factory.Returns an object that can assess distances between graphic positions on the plot surface.ConfigKey<?>[]
Returns the configuration keys used to configure profile for this surface factory.static boolean
Determines whether a set of ranges of normalised data coordinates cover enough of the full data cube (-1..+1 in each dimension) to count as full sky coverage.Range[]
readRanges
(SkySurfaceFactory.Profile profile, PlotLayer[] layers, DataStore dataStore) Provides the ranges that may be passed tocreateAspect
.boolean
useRanges
(SkySurfaceFactory.Profile profile, ConfigMap config) Indicates whether ranges should be provided to generate an aspect.
-
Field Details
-
PROJECTION_KEY
Config key for sky projection type. -
REFLECT_KEY
Config key to determine whether longitude runs right to left. -
VIEWSYS_KEY
Config key for the sky system used for projecting the data. -
DATASYS_KEY
Config key for the sky system used for supplying data. Note this is not used by SkySurfaceFactory, but client UI code may find it useful in conjunction withVIEWSYS_KEY
. -
GRID_KEY
Config key to determine whether grid lines are drawn. -
CROWD_KEY
Config key to control tick mark crowding. -
AXISLABELLER_KEY
Config key to control axis label positioning. -
SCALEBAR_KEY
-
SEX_KEY
Config key to determine whether sexagesimal coordinates are used. -
LON_KEY
Config key for specifying aspect central longitude, in degrees. -
LAT_KEY
Config key for specifying aspect central latitude, in degrees. -
FOV_RADIUS_KEY
Config key for specifying aspect field of view, in degrees.
-
-
Constructor Details
-
SkySurfaceFactory
public SkySurfaceFactory()
-
-
Method Details
-
createSurface
Description copied from interface:SurfaceFactory
Returns a new plot surface.- Specified by:
createSurface
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Parameters:
plotBounds
- rectangle to containing actual plot data (not insets)p
- configuration object defining plot styleaspect
- configuration object defining plot viewpoint- Returns:
- new plot surface
-
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 thecreateProfile
method.- Specified by:
getProfileKeys
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Returns:
- profile configuration keys
-
createProfile
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 bygetProfileKeys
. The return value can be used as input tocreateSurface
and other methods in this class.- Specified by:
createProfile
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Parameters:
config
- map of profile configuration items- Returns:
- factory-specific plot surface profile
-
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 theuseRanges
andcreateAspect
methods.- Specified by:
getAspectKeys
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Returns:
- aspect configuration keys
-
useRanges
Description copied from interface:SurfaceFactory
Indicates whether ranges should be provided to generate an aspect. If true, it is beneficial to pass the result ofreadRanges
tocreateAspect
alongside the arguments of this method. If false, any such ranges will be ignored.- Specified by:
useRanges
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Parameters:
profile
- surface configuration profileconfig
- configuration map that may contain keys fromgetAspectKeys
- Returns:
- true iff calculated ranges will be of use
-
createAspect
Description copied from interface:SurfaceFactory
Creates an aspect from configuration information. The ranges argument will be used only ifuseRanges
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 bycreateSurface
.- Specified by:
createAspect
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Parameters:
profile
- surface configuration profileconfig
- configuration map that may contain keys fromgetAspectKeys
ranges
- range data filled in from layers, or null- Returns:
- new aspect
-
getAspectConfig
Description copied from interface:SurfaceFactory
Returns a ConfigMap that corresponds to the configuration of the given surface, which must have been created by this factory. The intention is that supplying the returned config items to this object'screateAspect
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.
- Specified by:
getAspectConfig
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Parameters:
surf
- plot surface; if it was not created by this factory, behaviour is undefined- Returns:
- config map populated with items that should approximately reproduce the supplied surface
-
readRanges
public Range[] readRanges(SkySurfaceFactory.Profile profile, PlotLayer[] layers, DataStore dataStore) Description copied from interface:SurfaceFactory
Provides the ranges that may be passed tocreateAspect
. There is only any point calling this ifuseRanges
returns true.- Specified by:
readRanges
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Parameters:
profile
- surface configuration profilelayers
- plot layers to be plotteddataStore
- contains actual data- Returns:
- data ranges covered by the given layers filled in from data
-
getPlotMetric
Description copied from interface:SurfaceFactory
Returns an object that can assess distances between graphic positions on the plot surface. If no such metric exists, null may be returned.- Specified by:
getPlotMetric
in interfaceSurfaceFactory<SkySurfaceFactory.Profile,
SkyAspect> - Returns:
- plot metric, or null
-
isAllSky
Determines whether a set of ranges of normalised data coordinates cover enough of the full data cube (-1..+1 in each dimension) to count as full sky coverage. It's a bit arbitrary what this means, but in case of full sky the view should not be centred on any particular position.- Parameters:
vxyzRanges
- 3-element array giving data ranges for normalised X,Y,Z coordinates- Returns:
- true if they cover most of the sky
-