public class Geometry
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected java.nio.ByteBuffer |
buffer |
As a general rule, the ~IndexEnd variables are non-inclusive (i.e.
|
protected int |
currentFigureIndex |
|
protected int |
currentPointIndex |
|
protected int |
currentSegmentIndex |
|
protected int |
currentShapeIndex |
|
protected int |
currentWktPos |
|
protected byte |
FA_ARC |
|
protected byte |
FA_COMPOSITE_CURVE |
|
protected byte |
FA_EXTERIOR_RING |
|
protected byte |
FA_INTERIOR_RING |
|
protected byte |
FA_LINE |
|
protected byte |
FA_POINT |
|
protected byte |
FA_STROKE |
|
protected java.util.List<com.microsoft.sqlserver.jdbc.Figure> |
figureList |
|
protected com.microsoft.sqlserver.jdbc.Figure[] |
figures |
|
protected boolean |
hasMvalues |
|
protected boolean |
hasZvalues |
|
protected InternalSpatialDatatype |
internalType |
|
protected boolean |
isLargerThanHemisphere |
|
protected boolean |
isNull |
|
protected boolean |
isSingleLineSegment |
|
protected boolean |
isSinglePoint |
|
protected boolean |
isValid |
|
protected double[] |
mValues |
|
protected int |
numberOfFigures |
|
protected int |
numberOfPoints |
|
protected int |
numberOfSegments |
|
protected int |
numberOfShapes |
|
protected java.util.List<com.microsoft.sqlserver.jdbc.Point> |
pointList |
|
protected java.util.List<com.microsoft.sqlserver.jdbc.Segment> |
segmentList |
|
protected com.microsoft.sqlserver.jdbc.Segment[] |
segments |
|
protected byte |
serializationProperties |
|
protected java.util.List<com.microsoft.sqlserver.jdbc.Shape> |
shapeList |
|
protected com.microsoft.sqlserver.jdbc.Shape[] |
shapes |
|
protected int |
srid |
|
protected byte |
version |
|
protected byte[] |
wkb |
|
protected byte[] |
wkbNoZM |
|
protected java.lang.String |
wkt |
|
protected java.lang.String |
wktNoZM |
|
protected java.lang.StringBuffer |
WKTsb |
|
protected java.lang.StringBuffer |
WKTsbNoZM |
|
protected double[] |
xValues |
|
protected double[] |
yValues |
|
protected double[] |
zValues |
Modifier and Type | Method | Description |
---|---|---|
protected void |
appendToWKTBuffers(java.lang.Object o) |
Append the data to both stringbuffers.
|
java.lang.String |
asTextZM() |
Returns the Well-Known Text (WKT) representation of the Geometry object.
|
protected boolean |
checkEmptyKeyword(int parentShapeIndex,
InternalSpatialDatatype isd,
boolean isInsideAnotherShape) |
|
protected void |
constructCompoundcurveWKT(int segmentStartIndex,
int segmentEndIndex,
int pointEndIndex) |
Constructs a CompoundCurve in WKT form.
|
protected void |
constructCurvepolygonWKT(int figureStartIndex,
int figureEndIndex,
int segmentStartIndex,
int segmentEndIndex) |
Constructs a CurvePolygon in WKT form.
|
protected void |
constructGeometryCollectionWKT(int shapeEndIndex) |
The starting point for constructing a GeometryCollection type in WKT form.
|
protected void |
constructLineWKT(int pointStartIndex,
int pointEndIndex) |
Constructs a line in WKT form.
|
protected void |
constructMultipolygonWKT(int shapeStartIndex,
int shapeEndIndex) |
Constructs a MultiPolygon in WKT form.
|
protected void |
constructMultiShapeWKT(int shapeStartIndex,
int shapeEndIndex) |
Constructs a mutli-shape (MultiPoint / MultiLineString) in WKT form.
|
protected void |
constructPointWKT(int pointIndex) |
Constructs and appends a Point type in WKT form to the stringbuffer.
|
protected void |
constructSegmentWKT(int currentSegment,
byte segment,
int pointEndIndex) |
Constructs a Segment in WKT form.
|
protected void |
constructShapeWKT(int figureStartIndex,
int figureEndIndex) |
Constructs a shape (simple Geometry/Geography entities that are contained within a single bracket) in WKT form.
|
protected void |
constructWKT(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype sd,
InternalSpatialDatatype isd,
int pointIndexEnd,
int figureIndexEnd,
int segmentIndexEnd,
int shapeIndexEnd) |
Constructs the WKT representation of Geometry/Geography from the deserialized data.
|
protected void |
createSerializationProperties() |
|
static Geometry |
deserialize(byte[] wkb) |
Constructor for a Geometry instance from an internal SQL Server format for spatial data.
|
protected void |
determineInternalType() |
|
protected int |
determineWkbCapacity() |
|
java.lang.Double |
getM() |
Returns the M (measure) value of the object.
|
protected java.lang.String |
getNextStringToken() |
Reads the next string token (usually POINT, LINESTRING, etc.).
|
int |
getSrid() |
Returns the Spatial Reference Identifier (SRID) value.
|
java.lang.Double |
getX() |
Returns the X coordinate value.
|
java.lang.Double |
getY() |
Returns the Y coordinate value.
|
java.lang.Double |
getZ() |
Returns the Z (elevation) value of the object.
|
boolean |
hasM() |
Returns if the object contains a M (measure) value.
|
protected boolean |
hasMoreToken() |
|
boolean |
hasZ() |
Returns if the object contains a Z (elevation) value.
|
protected void |
interpretSerializationPropBytes() |
|
boolean |
isNull() |
Returns if the Geometry object is null.
|
static Geometry |
parse(java.lang.String wkt) |
Constructor for a Geometry instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT)
representation.
|
protected void |
parseWkb(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype type) |
Deserializes the buffer (that contains WKB representation of Geometry/Geography data), and stores it into
multiple corresponding data structures.
|
protected void |
parseWKTForSerialization(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype sd,
int startPos,
int parentShapeIndex,
boolean isGeoCollection) |
Parses WKT and populates the data structures of the Geometry/Geography instance.
|
static Geometry |
point(double x,
double y,
int srid) |
Constructor for a Geometry instance that represents a Point instance from its X and Y values and an Spatial
Reference Identifier.
|
protected void |
populateStructures() |
Populates the various data structures contained within the Geometry/Geography instance.
|
protected byte |
readByte() |
|
protected void |
readCloseBracket() |
|
protected void |
readCompoundCurveWkt(boolean isFirstIteration) |
Reads a CompoundCurve WKT.
|
protected void |
readCurvePolygon() |
Reads a CurvePolygon WKT.
|
protected double |
readDouble() |
|
protected void |
readFigures() |
|
protected int |
readInt() |
|
protected void |
readLineWkt() |
Reads a series of Point types.
|
protected void |
readMultiPolygonWkt(int thisShapeIndex,
java.lang.String nextToken) |
Reads a MultiPolygon WKT.
|
protected void |
readMvalues() |
|
protected void |
readNumberOfFigures() |
|
protected void |
readNumberOfPoints() |
|
protected void |
readNumberOfSegments() |
|
protected void |
readNumberOfShapes() |
|
protected void |
readOpenBracket() |
|
protected void |
readPointWkt() |
Reads Point WKT and adds it to the list of points.
|
protected void |
readSegments() |
|
protected void |
readSegmentWkt(int segmentType,
boolean isFirstIteration) |
Reads a Segment WKT.
|
protected void |
readShapes() |
|
protected void |
readShapeWkt(int parentShapeIndex,
java.lang.String nextToken) |
Reads a shape (simple Geometry/Geography entities that are contained within a single bracket) WKT.
|
protected void |
readZvalues() |
|
byte[] |
serialize() |
Returns the bytes that represent an internal SQL Server format of Geometry type.
|
protected void |
serializeToWkb(boolean noZM,
com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype type) |
Serializes the Geogemetry/Geography instance to WKB.
|
byte[] |
STAsBinary() |
Returns the Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation of a Geometry instance.
|
java.lang.String |
STAsText() |
Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a Geometry instance.
|
java.lang.String |
STGeometryType() |
Returns the Open Geospatial Consortium (OGC) type name represented by a geometry instance.
|
static Geometry |
STGeomFromText(java.lang.String wkt,
int srid) |
Constructor for a Geometry instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation
augmented with any Z (elevation) and M (measure) values carried by the instance.
|
static Geometry |
STGeomFromWKB(byte[] wkb) |
Constructor for a Geometry instance from an Open Geospatial Consortium (OGC) Well-Known Binary (WKB)
representation.
|
int |
STNumPoints() |
Returns the number of points in the Geometry object.
|
protected void |
throwIllegalWKB() |
|
protected void |
throwIllegalWKT() |
|
java.lang.String |
toString() |
Returns the String representation of the Geometry object.
|
protected java.nio.ByteBuffer buffer
protected InternalSpatialDatatype internalType
protected java.lang.String wkt
protected java.lang.String wktNoZM
protected byte[] wkb
protected byte[] wkbNoZM
protected int srid
protected byte version
protected int numberOfPoints
protected int numberOfFigures
protected int numberOfShapes
protected int numberOfSegments
protected java.lang.StringBuffer WKTsb
protected java.lang.StringBuffer WKTsbNoZM
protected int currentPointIndex
protected int currentFigureIndex
protected int currentSegmentIndex
protected int currentShapeIndex
protected double[] xValues
protected double[] yValues
protected double[] zValues
protected double[] mValues
protected com.microsoft.sqlserver.jdbc.Figure[] figures
protected com.microsoft.sqlserver.jdbc.Shape[] shapes
protected com.microsoft.sqlserver.jdbc.Segment[] segments
protected boolean hasZvalues
protected boolean hasMvalues
protected boolean isValid
protected boolean isSinglePoint
protected boolean isSingleLineSegment
protected boolean isLargerThanHemisphere
protected boolean isNull
protected final byte FA_INTERIOR_RING
protected final byte FA_STROKE
protected final byte FA_EXTERIOR_RING
protected final byte FA_POINT
protected final byte FA_LINE
protected final byte FA_ARC
protected final byte FA_COMPOSITE_CURVE
protected int currentWktPos
protected java.util.List<com.microsoft.sqlserver.jdbc.Point> pointList
protected java.util.List<com.microsoft.sqlserver.jdbc.Figure> figureList
protected java.util.List<com.microsoft.sqlserver.jdbc.Shape> shapeList
protected java.util.List<com.microsoft.sqlserver.jdbc.Segment> segmentList
protected byte serializationProperties
public static Geometry STGeomFromText(java.lang.String wkt, int srid) throws SQLServerException
wkt
- Well-Known Text (WKT) provided by the user.srid
- Spatial Reference Identifier (SRID) provided by the user.SQLServerException
- if an exception occurspublic static Geometry STGeomFromWKB(byte[] wkb) throws SQLServerException
wkb
- Well-Known Binary (WKB) provided by the user.SQLServerException
- if an exception occurspublic static Geometry deserialize(byte[] wkb) throws SQLServerException
wkb
- Well-Known Binary (WKB) provided by the user.SQLServerException
- if an exception occurspublic static Geometry parse(java.lang.String wkt) throws SQLServerException
wkt
- Well-Known Text (WKT) provided by the user.SQLServerException
- if an exception occurspublic static Geometry point(double x, double y, int srid) throws SQLServerException
x
- x coordinatey
- y coordinatesrid
- Spatial Reference Identifier valueSQLServerException
- if an exception occurspublic java.lang.String STAsText() throws SQLServerException
SQLServerException
- if an exception occurspublic byte[] STAsBinary()
public byte[] serialize()
public boolean hasM()
public boolean hasZ()
public java.lang.Double getX()
public java.lang.Double getY()
public java.lang.Double getM()
public java.lang.Double getZ()
public int getSrid()
public boolean isNull()
public int STNumPoints()
public java.lang.String STGeometryType()
public java.lang.String asTextZM()
public java.lang.String toString()
toString
in class java.lang.Object
protected void serializeToWkb(boolean noZM, com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype type)
noZM
- flag to indicate if Z and M coordinates should be includedprotected void parseWkb(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype type) throws SQLServerException
SQLServerException
protected void constructWKT(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype sd, InternalSpatialDatatype isd, int pointIndexEnd, int figureIndexEnd, int segmentIndexEnd, int shapeIndexEnd) throws SQLServerException
sd
- the Geometry/Geography instance.isd
- internal spatial datatype objectpointIndexEnd
- upper bound for reading pointsfigureIndexEnd
- upper bound for reading figuressegmentIndexEnd
- upper bound for reading segmentsshapeIndexEnd
- upper bound for reading shapesSQLServerException
- if an exception occursprotected void parseWKTForSerialization(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype sd, int startPos, int parentShapeIndex, boolean isGeoCollection) throws SQLServerException
sd
- the Geometry/Geography instance.startPos
- The index to start from from the WKT.parentShapeIndex
- The index of the parent's Shape in the shapes array. Used to determine this shape's parent.isGeoCollection
- flag to indicate if this is part of a GeometryCollection.SQLServerException
- if an exception occursprotected void constructPointWKT(int pointIndex)
pointIndex
- indicates which point to append to the stringbuffer.protected void constructLineWKT(int pointStartIndex, int pointEndIndex)
pointStartIndex
- .pointEndIndex
- .protected void constructShapeWKT(int figureStartIndex, int figureEndIndex)
figureStartIndex
- .figureEndIndex
- .protected void constructMultiShapeWKT(int shapeStartIndex, int shapeEndIndex)
shapeStartIndex
- .shapeEndIndex
- .protected void constructCompoundcurveWKT(int segmentStartIndex, int segmentEndIndex, int pointEndIndex)
segmentStartIndex
- .segmentEndIndex
- .pointEndIndex
- .protected void constructMultipolygonWKT(int shapeStartIndex, int shapeEndIndex)
shapeStartIndex
- .shapeEndIndex
- .protected void constructCurvepolygonWKT(int figureStartIndex, int figureEndIndex, int segmentStartIndex, int segmentEndIndex)
figureStartIndex
- .figureEndIndex
- .segmentStartIndex
- .segmentEndIndex
- .protected void constructSegmentWKT(int currentSegment, byte segment, int pointEndIndex)
currentSegment
- .segment
- .pointEndIndex
- .protected void constructGeometryCollectionWKT(int shapeEndIndex) throws SQLServerException
shapeEndIndex
- .SQLServerException
- if an exception occursprotected void readPointWkt() throws SQLServerException
SQLServerException
- if an exception occursprotected void readLineWkt() throws SQLServerException
SQLServerException
- if an exception occursprotected void readShapeWkt(int parentShapeIndex, java.lang.String nextToken) throws SQLServerException
parentShapeIndex
- shape index of the parent shape that called this methodnextToken
- next string tokenSQLServerException
- if an exception occursprotected void readCurvePolygon() throws SQLServerException
SQLServerException
- if an exception occursprotected void readMultiPolygonWkt(int thisShapeIndex, java.lang.String nextToken) throws SQLServerException
thisShapeIndex
- shape index of current shapenextToken
- next string tokenSQLServerException
- if an exception occursprotected void readSegmentWkt(int segmentType, boolean isFirstIteration) throws SQLServerException
segmentType
- segment typeisFirstIteration
- flag that indicates if this is the first iteration from the loop outsideSQLServerException
- if an exception occursprotected void readCompoundCurveWkt(boolean isFirstIteration) throws SQLServerException
isFirstIteration
- flag that indicates if this is the first iteration from the loop outsideSQLServerException
- if an exception occursprotected java.lang.String getNextStringToken()
protected void populateStructures()
protected void readOpenBracket() throws SQLServerException
SQLServerException
protected void readCloseBracket() throws SQLServerException
SQLServerException
protected boolean hasMoreToken()
protected void createSerializationProperties()
protected int determineWkbCapacity()
protected void appendToWKTBuffers(java.lang.Object o)
o
- data to append to the stringbuffers.protected void interpretSerializationPropBytes()
protected void readNumberOfPoints() throws SQLServerException
SQLServerException
protected void readZvalues() throws SQLServerException
SQLServerException
protected void readMvalues() throws SQLServerException
SQLServerException
protected void readNumberOfFigures() throws SQLServerException
SQLServerException
protected void readFigures() throws SQLServerException
SQLServerException
protected void readNumberOfShapes() throws SQLServerException
SQLServerException
protected void readShapes() throws SQLServerException
SQLServerException
protected void readNumberOfSegments() throws SQLServerException
SQLServerException
protected void readSegments() throws SQLServerException
SQLServerException
protected void determineInternalType()
protected boolean checkEmptyKeyword(int parentShapeIndex, InternalSpatialDatatype isd, boolean isInsideAnotherShape) throws SQLServerException
SQLServerException
protected void throwIllegalWKT() throws SQLServerException
SQLServerException
protected void throwIllegalWKB() throws SQLServerException
SQLServerException
protected byte readByte() throws SQLServerException
SQLServerException
protected int readInt() throws SQLServerException
SQLServerException
protected double readDouble() throws SQLServerException
SQLServerException
Copyright © 2018 Microsoft Corporation. All rights reserved.