Interface CoordinateAccess

  • All Superinterfaces:
    Cloneable, CoordinateSequence

    public interface CoordinateAccess
    extends CoordinateSequence
    Allows manipulation of a Geometry's CoordinateSequence.

    The number of ordinates in each Coordinate is getDimension() + getNumAttributes()
    The examples given in this interface are based on a 2-dimensional coordinate system, x and y,
    with two attributes: z and t.
    In this case z is the third dimension, but is not used for rendering and the coordinate
    remains 2-dimensional.

    Author:
    jgarnett
    • Method Detail

      • getDimension

        int getDimension()
        Retrieve the number of spatial dimensions of Coordinates.

        This is the number of spatially significant ordinates (usually 2 or 3)

        Specified by:
        getDimension in interface CoordinateSequence
        Returns:
        Number of spatially significant ordinates
      • getNumAttributes

        int getNumAttributes()
        Retrieve number of measures associated with a Coordinate

        This is the number of non spatially significant ordinates.

        Returns:
        Number of measures, or 0 if measures not used
      • getOrdinate

        double getOrdinate​(int coordinate,
                           int ordinate)
        Retrive a single ordinate
        Specified by:
        getOrdinate in interface CoordinateSequence
        Parameters:
        coordinate - Coordinate to retrieve from
        ordinate - Ordinate to retrieve from coordinate
        Returns:
        Specified ordinate
      • getAttribute

        Object getAttribute​(int coordinate,
                            int attribute)
        getAttribute purpose.

        attribute is between 0 and getNumAttributes()

        Parameters:
        attribute - is between 0 and getNumAttributes()
      • setOrdinate

        void setOrdinate​(int coordinate,
                         int ordinate,
                         double value)
        Set a single ordinate.
        Specified by:
        setOrdinate in interface CoordinateSequence
        Parameters:
        coordinate - Corrdinate to modify
        ordinate - Ordinate to modify in coordinate
        value - new value
      • setAttribute

        void setAttribute​(int coordinate,
                          int attribute,
                          Object value)
        setAttribute purpose.

        attribute is between 0 and getNumAttributes()

        Parameters:
        coordinate - the coordinate to be modified
        attribute - between 0 and getNumAttributes()
      • toOrdinateArray

        double[] toOrdinateArray​(int ordinate)
        Retrive ordinates as an array.

        Example: (x,y) getDimension()==2
        This is defined for the number of dimensions. If the other attributes happen to be a double, they can still be accessed by using an ordinate value greater than getDimension().

        • ordinate 0: x ordinate
        • ordinate 1: y ordinate
        • ordinate 2: m attribute
        • ordinate 3: g attribute
        Parameters:
        ordinate - Ordinate to retrieve. ordinate is less than
        getDimension()+getMeasures() if the measures are doubles as well. Otherwise
        ordinate is less than getDimensions().
        Returns:
        ordinate array
      • toAttributeArray

        Object[] toAttributeArray​(int attribute)
        toAttributeArray purpose.

        Description ...

        Parameters:
        attribute - Between 0 and getNumAttrributes()
        Returns:
        an array of attributes
      • setOrdinateArray

        void setOrdinateArray​(int ordinate,
                              double[] ordinateArray)
        Supplies an array of ordinates.

        The ordinateArray should be the same length as the CoordinateSequence.
        ordinate should be between 0 and getDimension().
        If the attributes are doubles as well, then ordinate can be as great as
        getDimension() + getNumAttributes().

      • setAttributeArray

        void setAttributeArray​(int attribute,
                               Object attributeArray)
        setAttributeArray purpose.

        Description ...

        Parameters:
        attribute - between 0 and getNumAttributes()
        attributeArray - May be an object or primitive array
      • toOrdinateArrays

        double[][] toOrdinateArrays()
        Retrieve ordinate information (an array of ordinates for each coordinate).

        Example: (x,y,m,g) getDimension()==2, getNumAttributes()==2

        
         [ [ x1, x2,...,xN], [ y1, y2,...,yN] ]
         
        Returns:
        column major ordinate arrays (these are spatially significant)
      • toAttributeArrays

        Object[] toAttributeArrays()
        Retrieve Attribute information (an array of attributes for each coordinate).

        Example: (x,y,m,g) getDimension()==2, getAttributes()==2

        
         [ [ m1, m2,...,mN], [ g1, g2,..., gN] ]
         

        Returns:
        Attribute Arrays, may be object or primitive arrays
      • setCoordinateArrays

        void setCoordinateArrays​(double[][] ordinateArrays,
                                 Object[] attributeArrays)
        Completely replace sequence with the provided information.

        Example: (x,y,m,g) getDimension()==2, getNumAttributes()==2

        
         dimensions:[ [ x1, x2,...,xN], [ y1, y2,...,yN] ]
         attributes:[ [ m1, m2,...,mN], [ g1, g2,..., gN] ]
         
        Parameters:
        ordinateArrays - dimensions column major ordinate arrays (these are spatially significant)
        attributeArrays - Individual attribute arrays may be primitive or object arrays
      • setAt

        void setAt​(int coordinate,
                   double[] ordinates,
                   Object[] attributes)
        Allows modification of a single coordinate (including attribute values).

        Normal Use: where D is getDimensions() and N is getNumAttributes():

        
         dimensions: [ ordX, ordY, ..., ordD ]
         attributes: [ atr1, atr2, ...., atrN ]
         

        When dealing with attributes that are all double values the ordinates array may be used to set both ordinates and attribute values.

        Optimized Use: where D is getDimensions() and N is getNumAttributes():

        
         dimensions: [ ordX, ordY, ..., ordD, atr1, atr2, ... attrN ]
         attributes: null
         

        Parameters:
        coordinate - index of coordinate to be modified
        ordinates - array ordinate values (may be extended with attribute values)
        attributes - array of attribute values, or null is ordinates has been extended