Class CoordGroup


  • public abstract class CoordGroup
    extends java.lang.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 Detail

      • getPositionCount

        public abstract int getPositionCount()
        Returns the number of data positions per tuple used by this plotter. 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 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 positional coordinates
      • getExtraCoords

        public abstract Coord[] getExtraCoords()
      • getPosCoordIndex

        public abstract int getPosCoordIndex​(int ipos,
                                             DataGeom geom)
        Returns the starting coordinate index in a DataSpec at which a given one of the positional coordinates represented by this coord group will appear.
        Parameters:
        ipos - index of 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 non-positional coordinates represented by this coord group will appear.
        Parameters:
        iExtra - index of non-positional 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 npos,
                                                  Coord[] extras)
        Returns a coord group which contains zero or more positions and zero or more additional ("extra") coordinates.
        Parameters:
        npos - number of positions
        extras - non-positional coordinates
        Returns:
        new coord group
      • 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