public class GeographyValue
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LENGTH
The default length (in bytes) for a column with type GEOGRAPHY, if no
length is specified.
|
static int |
MAX_SERIALIZED_LENGTH
The maximum-allowed length (in bytes) for a column with type GEOGRAPHY.
|
static int |
MIN_SERIALIZED_LENGTH
The minimum-allowed length (in bytes) for a column with type GEOGRAPHY.
|
Constructor and Description |
---|
GeographyValue(java.util.List<java.util.List<GeographyPointValue>> rings)
Create a polygon from a list of rings.
|
GeographyValue(java.lang.String wkt)
Create a GeographyValue object from an OGC well-known text-formatted string.
|
Modifier and Type | Method and Description |
---|---|
GeographyValue |
add(GeographyPointValue offset)
Deprecated.
|
boolean |
equals(java.lang.Object o) |
void |
flattenToBuffer(java.nio.ByteBuffer buf)
Serialize this object to a ByteBuffer.
|
static GeographyValue |
fromWKT(java.lang.String text)
Create a GeographyValue object from a well-known text string.
|
int |
getLengthInBytes()
Return the number of bytes in the serialization for this polygon.
|
java.util.List<java.util.List<GeographyPointValue>> |
getRings()
Return the list of rings of a polygon.
|
static int |
getValueDisplaySize(int numBytes)
Given a column of type GEOGRAPHY(nbytes), return an upper bound on the
number of characters needed to represent any entity of this type in WKT.
|
void |
serialize(java.io.DataOutput output)
Serialize this object to a
DataOutput |
java.lang.String |
toString()
Return a representation of this object as well-known text.
|
java.lang.String |
toWKT()
Return a representation of this object as well-known text.
|
static GeographyValue |
unflattenFromBuffer(java.nio.ByteBuffer inBuffer)
Deserialize a GeographyValue from a ByteBuffer at the ByteBuffer's
current position.
|
static GeographyValue |
unflattenFromBuffer(java.nio.ByteBuffer inBuffer,
int offset)
Deserialize a GeographyValue from a ByteBuffer from an absolute offset.
|
public static final int DEFAULT_LENGTH
public static final int MIN_SERIALIZED_LENGTH
public static final int MAX_SERIALIZED_LENGTH
public GeographyValue(java.util.List<java.util.List<GeographyPointValue>> rings)
rings
- A list of lists of points that will form a polygon.public GeographyValue(java.lang.String wkt)
POLYGON((0 0, 20 0, 20 20, 0 20, 0 0),(5 5, 5 15, 15 15, 15 5, 5 5))
Each point in a ring is composed of a coordinate of longitude and a coordinate of latitude separated by a space. Note that longitude comes first in this notation. Additional notes about rings:wkt
- A well-known text-formatted string for a polygon.public static GeographyValue fromWKT(java.lang.String text)
the WKT constructor
for this class.text
- A well-known text stringpublic java.util.List<java.util.List<GeographyPointValue>> getRings()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toWKT()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int getLengthInBytes()
public static int getValueDisplaySize(int numBytes)
numBytes
- The size of the GEOGRAPHY value in bytespublic void flattenToBuffer(java.nio.ByteBuffer buf)
buf
- The ByteBuffer into which the serialization will be placed.public void serialize(java.io.DataOutput output) throws java.io.IOException
DataOutput
To be consisitent with flattenToBuffer(ByteBuffer)
(Assumes that the 4-byte length prefix for variable-length data has already been serialized.)
output
- into which this object will be serializedjava.io.IOException
- if any I/O error occurspublic static GeographyValue unflattenFromBuffer(java.nio.ByteBuffer inBuffer, int offset)
inBuffer
- The ByteBuffer from which to read a GeographyValueoffset
- The absolute offset in the ByteBuffer from which to read datapublic static GeographyValue unflattenFromBuffer(java.nio.ByteBuffer inBuffer)
inBuffer
- The ByteBuffer from which to read a GeographyValue@Deprecated public GeographyValue add(GeographyPointValue offset)
offset
- The point by which to translate vertices in this