# Class CoordGroup

java.lang.Object
uk.ac.starlink.ttools.plot2.data.CoordGroup

public abstract class CoordGroup extends Object
Expresses the content of a set of coordinates used for a plot layer, and how to find the values of these coordinates from a corresponding DataSpec. A given CoordGroup instance is tied to a particular arrangement of corresponding DataSpec objects.

This abstraction is defined in a somewhat ad hoc way at present; features have been introduced according to what is required from existing plotters. It may be changed or rationalised in the future. That is one reason this functionality is split out into its own class rather than being part of the Plotter interface itself, and also why implementation of this class is controlled (instances only available from factory methods of this class).

Since:
  20 Jan 2014
Author:
  Mark Taylor

## Method Summary

Modifier and Type
Method
Description
`static CoordGroup`
`createCoordGroup(int nBasicPos, Coord[] extras)`
Returns a coord group which contains zero or more basic positions and zero or more additional non-positional ("extra") coordinates.
`static CoordGroup`
`createCoordGroup(int nBasicPos, Coord[] extras, int nExtraPos)`
Returns a coord group with zero or more basic positions and zero or more extra coordinates, some of which may be positional.
`static CoordGroup`
`createEmptyCoordGroup()`
Returns a coord group with no coordinates.
`static CoordGroup`
`createNoBasicCoordGroup(Coord[] coords, int nExtraPos, boolean[] rangeCoordFlags)`
Returns a coord group with no basic positional coordinates.
`static CoordGroup`
`createPartialCoordGroup(Coord[] coords, boolean[] rangeCoordFlags)`
Returns a coord group which contains a single partial position.
`static CoordGroup`
`createSinglePositionCoordGroup()`
Returns a coord group which contains only a single data space position.
`abstract int`
`getBasicPositionCount()`
Returns the number of basic data positions per tuple.
`abstract int`
`getExtraCoordIndex(int iExtra, DataGeom geom)`
Returns the coordinate index in a DataSpec at which a given one of the extra coordinates represented by this coord group will appear.
`abstract Coord[]`
`getExtraCoords()`
`abstract int`
`getExtraPositionCount()`
Returns a count of the extra coordinates that can be considered to represent data positions.
`abstract int`
`getPosCoordIndex(int ipos, DataGeom geom)`
Returns the starting coordinate index in a DataSpec at which a given one of the basic positional coordinates represented by this coord group will appear.
`abstract int[]`
`getRangeCoordIndices(DataGeom geom)`
Returns a list of the coordinate indices in a DataSpec of those coordinates whose change should trigger a re-range of the plot surface.
`abstract boolean`
`isSinglePartialPosition()`
Indicates whether this group deals with "partial" positions.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getBasicPositionCount

public abstract int getBasicPositionCount()
Returns the number of basic data positions per tuple. For instance a scatter plot would use 1, a plot linking pairs of positions in the same table would use 2, and an analytic function would use 0. Each of these can be represented by standard positional coordinates as appropriate for the geometry, and is turned into a data space position by use of the DataGeom presented at layer creation time. A position corresponds to a (fixed) number of coordinate values.

Returns:
  number of sets of basic positional coordinates

### getExtraCoords

public abstract Coord[] getExtraCoords()

### getExtraPositionCount

public abstract int getExtraPositionCount()
Returns a count of the extra coordinates that can be considered to represent data positions. These can be turned into positions by the DataGeom presented at layer creation time, but they are not suitable for representation by standard positional coordinates.

These positional coordinates are assumed to come at the start of the list of extra coordinates.

Returns:
  number of sets of positional coordinates in the extras

### getPosCoordIndex

public abstract int getPosCoordIndex(int ipos, DataGeom geom)
Returns the starting coordinate index in a DataSpec at which a given one of the basic positional coordinates represented by this coord group will appear.

Parameters:
  `ipos` - index of basic position supplied by this group (first position is zero)
  `geom` - data geom with which index will be used
Returns:
  index of starting coordinate for given position in dataspec

### getExtraCoordIndex

public abstract int getExtraCoordIndex(int iExtra, DataGeom geom)
Returns the coordinate index in a DataSpec at which a given one of the extra coordinates represented by this coord group will appear.

Parameters:
  `iExtra` - index of extra coordinate (first extra coord is zero)
  `geom` - data geom with which index will be used
Returns:
  index of given extra coordinate in dataspec

### getRangeCoordIndices

public abstract int[] getRangeCoordIndices(DataGeom geom)
Returns a list of the coordinate indices in a DataSpec of those coordinates whose change should trigger a re-range of the plot surface.

Parameters:
  `geom` - data geom with which indices will be used
Returns:
  array of indices into DataSpec coordinates

### isSinglePartialPosition

public abstract boolean isSinglePartialPosition()
Indicates whether this group deals with "partial" positions. That is to say that the coordinates represent data positions, but that those data position arrays have at least one element equal to NaN, indicating for instance a line rather than a point in the data space.

Returns:
  true iff this group represents a single partial position

### createSinglePositionCoordGroup

public static CoordGroup createSinglePositionCoordGroup()
Returns a coord group which contains only a single data space position.

Returns:
  new coord group

### createCoordGroup

public static CoordGroup createCoordGroup(int nBasicPos, Coord[] extras)
Returns a coord group which contains zero or more basic positions and zero or more additional non-positional ("extra") coordinates.

Parameters:
  `nBasicPos` - number of basic positional coordinates
  `extras` - non-positional coordinates
Returns:
  new coord group

### createCoordGroup

public static CoordGroup createCoordGroup(int nBasicPos, Coord[] extras, int nExtraPos)
Returns a coord group with zero or more basic positions and zero or more extra coordinates, some of which may be positional.

Parameters:
  `nBasicPos` - number of basic positional coordinates
  `extras` - additional coordinates
  `nExtraPos` - number of extra coordinates which are positional

### createNoBasicCoordGroup

public static CoordGroup createNoBasicCoordGroup(Coord[] coords, int nExtraPos, boolean[] rangeCoordFlags)
Returns a coord group with no basic positional coordinates.

Parameters:
  `coords` - all coordinates
  `nExtraPos` - number of the extra coordinates which can be considered to represent data positions
  `rangeCoordFlags` - array of flags corresponding to the `coords` array, true for any coord whose change should cause a re-range

### createPartialCoordGroup

public static CoordGroup createPartialCoordGroup(Coord[] coords, boolean[] rangeCoordFlags)
Returns a coord group which contains a single partial position.

Parameters:
  `coords` - all coordinates, starting with those constituting the partial position
  `rangeCoordFlags` - array of flags corresponding to the `coords` array, true for any coord whose change should cause a re-range
Returns:
  new coord group

### createEmptyCoordGroup

public static CoordGroup createEmptyCoordGroup()
Returns a coord group with no coordinates.

Returns:
  new coord group