Package uk.ac.starlink.ttools.plot2.data
Class AreaCoord<DG extends DataGeom>
java.lang.Object
uk.ac.starlink.ttools.plot2.data.AreaCoord<DG>
- All Implemented Interfaces:
Coord
Coord implementation for Area (shape) values.
It can currently work with shapes specified as strings using
(a subset of) the STC-S syntax referenced by TAP 1.0,
and as floating point arrays using the CIRCLE, POLYGON and POINT xtypes
defined in DALI 1.1.
The serialisation to floating point array is in three parts:
- characteristic (typically central) position in data space (2 elements for plane coords, 3 elements for sky coords)
- type code (1 element, equal to an integer)
- data array giving area details (variable length, interpretation dependent on type code)
getAreaDataGeom(DG)
method must be used.- Since:
- 27 Mar 2020
- Author:
- Mark Taylor
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AreaCoord<PlaneDataGeom>
Instance for use with Plane plot type.static final AreaCoord<SkyDataGeom>
Instance for use with Sky plot type.static final AreaCoord<SphereDataGeom>
Instance for use with Sphere plot type. -
Method Summary
Modifier and TypeMethodDescriptionstatic AreaCoord<PlaneDataGeom>
createPlaneCoord
(InputMeta meta, boolean isRequired) Constructs a custom AreaCoord instance for use with Plane plot type.static AreaCoord<SkyDataGeom>
createSkyCoord
(InputMeta meta, boolean isRequired) Constructs a custom AreaCoord instance for use with Sky plot type.static AreaCoord<SphereDataGeom>
createSphereCoord
(InputMeta meta, boolean isRequired) Constructs a custom AreaCoord instance for use with Sphere plot type.abstract DG
getAreaDataGeom
(DG baseGeom) Returns a DataGeom that can be used to read position data from objects serialized by this coordinate.Input[]
Returns specifications of the one or more input values the user supplies to provide the data values for this coord.Returns a code indicating how the quantity defined by this object is stored internally and presented to the plotting classes.inputStorage
(uk.ac.starlink.table.ValueInfo[] infos, uk.ac.starlink.table.DomainMapper[] dms) Provides a function to turn a quantity in the user view to a plotting view object.boolean
Indicates whether this item must have a non-blank value in order for a plot to be possible.readAreaCoord
(Tuple tuple, int icol) Reads an Area value from an appropriate field in a given Tuple.protected abstract void
writeDataPos
(Area area, double[] dpos) Writes the position in data coordinates of the characteristic (typically central) point of a given area object into the start of a supplied array.
-
Field Details
-
PLANE_COORD
Instance for use with Plane plot type. -
SKY_COORD
Instance for use with Sky plot type. -
SPHERE_COORD
Instance for use with Sphere plot type.
-
-
Method Details
-
writeDataPos
Writes the position in data coordinates of the characteristic (typically central) point of a given area object into the start of a supplied array.- Parameters:
area
- area objectdpos
- coordinate array into which characteristic position data coords are written
-
getAreaDataGeom
Returns a DataGeom that can be used to read position data from objects serialized by this coordinate. The returned DataGeom instance is based on a given instance; it may inherit some behaviour (for instance coordinate rotation in case of a SkyDataGeom).- Parameters:
baseGeom
- DataGeom instance providing context behaviour- Returns:
- data geom
-
getInputs
Description copied from interface:Coord
Returns specifications of the one or more input values the user supplies to provide the data values for this coord. -
getStorageType
Description copied from interface:Coord
Returns a code indicating how the quantity defined by this object is stored internally and presented to the plotting classes.- Specified by:
getStorageType
in interfaceCoord
- Returns:
- storage type enum instance
-
isRequired
public boolean isRequired()Description copied from interface:Coord
Indicates whether this item must have a non-blank value in order for a plot to be possible.- Specified by:
isRequired
in interfaceCoord
- Returns:
- if true, values must be supplied to make a plot
-
inputStorage
public Function<Object[],double[]> inputStorage(uk.ac.starlink.table.ValueInfo[] infos, uk.ac.starlink.table.DomainMapper[] dms) Description copied from interface:Coord
Provides a function to turn a quantity in the user view to a plotting view object.The supplied
infos
anddomainMappers
arrays correspond to (have the same length as) this object's Inputs array, and may influence the return values. However, Coord instances that always behave the same way (for instance whose Input Domains have fixed DomainMappers) are free to ignore these arguments.The returned function converts an array of per-input user values to a storable object of the type corresponding to the result of
Coord.getStorageType()
; the return value of the returned function is never null.- Specified by:
inputStorage
in interfaceCoord
- Parameters:
infos
- per-input array of column input metadatadms
- per-input array of input value->domain value mappers- Returns:
- input values to storage object conversion function, or null if such conversions will never be possible
-
readAreaCoord
Reads an Area value from an appropriate field in a given Tuple.- Parameters:
tuple
- tuple- Returns:
- icol index of column in tuple corresponding to this coord
-
createPlaneCoord
Constructs a custom AreaCoord instance for use with Plane plot type.- Parameters:
meta
- user coordinate metadataisRequired
- true iff this coordinate is required for plot- Returns:
- new instance
-
createSkyCoord
Constructs a custom AreaCoord instance for use with Sky plot type.- Parameters:
meta
- user coordinate metadataisRequired
- true iff this coordinate is required for plot- Returns:
- new instance
-
createSphereCoord
Constructs a custom AreaCoord instance for use with Sphere plot type. Note this assumes that the supplied Tuples have the radial coordinate directly after the area coordinate.- Parameters:
meta
- user coordinate metadataisRequired
- true iff this coordinate is required for plot- Returns:
- new instance
-