public class DirectPosition1D extends AbstractDirectPosition implements Serializable, Cloneable
DirectPosition2D
,
GeneralDirectPosition
,
CoordinateFormat
,
Serialized FormDefined in the sis-referencing
module
Modifier and Type | Field and Description |
---|---|
double |
ordinate
The ordinate value.
|
Constructor and Description |
---|
DirectPosition1D()
Constructs a position initialized to (0) with a
null
coordinate reference system. |
DirectPosition1D(CharSequence wkt)
Constructs a position initialized to the values parsed from the given string in
Well Known Text (WKT) format.
|
DirectPosition1D(CoordinateReferenceSystem crs)
Constructs a position with the specified coordinate reference system.
|
DirectPosition1D(double ordinate)
Constructs a 1D position from the specified ordinate.
|
Modifier and Type | Method and Description |
---|---|
DirectPosition1D |
clone()
Returns a copy of this position.
|
double[] |
getCoordinate()
Returns a sequence of numbers that hold the coordinate of this position in its reference system.
|
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the coordinate reference system in which the coordinate is given.
|
int |
getDimension()
The length of coordinate sequence (the number of entries).
|
double |
getOrdinate(int dimension)
Returns the ordinate at the specified dimension.
|
int |
hashCode()
Returns a hash value for this coordinate.
|
void |
setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
Sets the coordinate reference system in which the coordinate is given.
|
void |
setLocation(DirectPosition position)
Sets this coordinate to the specified direct position.
|
void |
setOrdinate(int dimension,
double value)
Sets the ordinate value along the specified dimension.
|
String |
toString()
Formats this position in the Well Known Text (WKT) format.
|
equals, getDirectPosition, normalize
public DirectPosition1D()
null
coordinate reference system.public DirectPosition1D(CoordinateReferenceSystem crs)
crs
- the coordinate reference system.public DirectPosition1D(double ordinate)
ordinate
- the ordinate value.public DirectPosition1D(CharSequence wkt) throws IllegalArgumentException
POINT
element like below:
POINT(6)
wkt
- the POINT
or other kind of element to parse.IllegalArgumentException
- if the given string can not be parsed.MismatchedDimensionException
- if the given point is not one-dimensional.toString()
,
CoordinateFormat
public final int getDimension()
DirectPosition1D
objects.getDimension
in interface DirectPosition
public final CoordinateReferenceSystem getCoordinateReferenceSystem()
null
if this particular DirectPosition
is included
in a larger object with such a reference to a CRS.getCoordinateReferenceSystem
in interface DirectPosition
null
.public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
crs
- the new coordinate reference system, or null
.public final double[] getCoordinate()
ordinate
field, which is public.getCoordinate
in interface DirectPosition
getCoordinate
in class AbstractDirectPosition
public final double getOrdinate(int dimension) throws IndexOutOfBoundsException
ordinate
field, which is public.getOrdinate
in interface DirectPosition
dimension
- the dimension, which must be 0.IndexOutOfBoundsException
- if the specified dimension is out of bounds.public void setOrdinate(int dimension, double value) throws IndexOutOfBoundsException
setOrdinate
in interface DirectPosition
dimension
- the dimension, which must be 0.value
- the ordinate value.IndexOutOfBoundsException
- if the specified dimension is out of bounds.public void setLocation(DirectPosition position) throws MismatchedDimensionException
setLocation
in class AbstractDirectPosition
position
- the new position for this point.MismatchedDimensionException
- if this point doesn't have the expected dimension.public String toString()
POINT(ordinate)The string returned by this method can be parsed by the
DirectPosition1D
constructor.toString
in class AbstractDirectPosition
POINT
in Well Known Text (WKT) format.public DirectPosition1D clone()
public int hashCode()
DirectPosition.hashCode()
javadoc.
Consequently, it should be possible to mix different DirectPosition
implementations in the same hash map.hashCode
in interface DirectPosition
hashCode
in class AbstractDirectPosition
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.