public class GridCoordinates2D extends Point implements GridCoordinates
Point
for
interoperability with Java2D.GeneralGridCoordinates
,
Serialized FormPoint2D.Double, Point2D.Float
Constructor and Description |
---|
GridCoordinates2D()
Creates an initially empty grid coordinates.
|
GridCoordinates2D(int x,
int y)
Creates a grid coordinates initialized to the specified values.
|
GridCoordinates2D(Point coordinates)
Creates a grid coordinates initialized to the specified point.
|
Modifier and Type | Method and Description |
---|---|
GridCoordinates2D |
clone()
Returns a clone of this coordinates.
|
int |
getCoordinateValue(int dimension)
Returns the coordinate value at the specified dimension.
|
int[] |
getCoordinateValues()
Returns one integer value for each dimension of the grid.
|
int |
getDimension()
Returns the number of dimensions, which is always 2.
|
void |
setCoordinateValue(int dimension,
int value)
Sets the coordinate value at the specified dimension.
|
String |
toString()
Returns a string representation of this grid coordinates.
|
equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translate
distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
public GridCoordinates2D()
public GridCoordinates2D(int x, int y)
x
- The x coordinate value.y
- The y coordinate value.public GridCoordinates2D(Point coordinates)
coordinates
- The coordinate values to copy.public final int getDimension()
getDimension
in interface GridCoordinates
public int[] getCoordinateValues()
getCoordinateValues
in interface GridCoordinates
GridCoordinates
object.public int getCoordinateValue(int dimension) throws IndexOutOfBoundsException
getCoordinateValues()[i]
. It is provided for efficienty.getCoordinateValue
in interface GridCoordinates
dimension
- The dimension from 0 inclusive to getDimension()
exclusive.IndexOutOfBoundsException
- if the specified dimension is out of bounds.public void setCoordinateValue(int dimension, int value) throws IndexOutOfBoundsException, UnsupportedOperationException
setCoordinateValue
in interface GridCoordinates
dimension
- The index of the value to set.value
- The new value.IndexOutOfBoundsException
- if the specified dimension is out of bounds.UnsupportedOperationException
- if this grid coordinates is not modifiable.public String toString()
public GridCoordinates2D clone()
clone
in class Point2D
Object.clone()
Copyright © 1996–2019 Geotools. All rights reserved.