Package com.microsoft.sqlserver.jdbc

## Class Geometry

- java.lang.Object
- - com.microsoft.sqlserver.jdbc.Geometry

    public class Geometry
    extends java.lang.Object

Geometry datatype represents data in a Euclidean (flat) coordinate system.

### Field Summary

Fields
`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`

### Constructor Summary

Constructors
`protected` `Geometry()`
`protected` `Geometry​(byte[] wkb)` Private constructor used for creating a Geometry object from WKB.
`protected` `Geometry​(java.lang.String wkt, int srid)` Private constructor used for creating a Geometry object from WKT and Spatial Reference Identifier.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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​(boolean excludeZMFromWKB)`
`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 excludeZMFromWKB, 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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### buffer

    protected java.nio.ByteBuffer buffer

As a general rule, the ~IndexEnd variables are non-inclusive (i.e. pointIndexEnd = 8 means the shape using it will only go up to the 7th index of the array)

#### internalType

    protected InternalSpatialDatatype internalType

#### wkt

    protected java.lang.String wkt

#### wktNoZM

    protected java.lang.String wktNoZM

#### wkb

    protected byte[] wkb

#### wkbNoZM

    protected byte[] wkbNoZM

#### srid

    protected int srid

#### version

    protected byte version

#### numberOfPoints

    protected int numberOfPoints

#### numberOfFigures

    protected int numberOfFigures

#### numberOfShapes

    protected int numberOfShapes

#### numberOfSegments

    protected int numberOfSegments

#### WKTsb

    protected java.lang.StringBuffer WKTsb

#### WKTsbNoZM

    protected java.lang.StringBuffer WKTsbNoZM

#### currentPointIndex

    protected int currentPointIndex

#### currentFigureIndex

    protected int currentFigureIndex

#### currentSegmentIndex

    protected int currentSegmentIndex

#### currentShapeIndex

    protected int currentShapeIndex

#### xValues

    protected double[] xValues

#### yValues

    protected double[] yValues

#### zValues

    protected double[] zValues

#### mValues

    protected double[] mValues

#### figures

    protected com.microsoft.sqlserver.jdbc.Figure[] figures

#### shapes

    protected com.microsoft.sqlserver.jdbc.Shape[] shapes

#### segments

    protected com.microsoft.sqlserver.jdbc.Segment[] segments

#### hasZvalues

    protected boolean hasZvalues

#### hasMvalues

    protected boolean hasMvalues

#### isValid

    protected boolean isValid

#### isSinglePoint

    protected boolean isSinglePoint

#### isSingleLineSegment

    protected boolean isSingleLineSegment

#### isLargerThanHemisphere

    protected boolean isLargerThanHemisphere

#### isNull

    protected boolean isNull

#### FA_INTERIOR_RING

    protected final byte FA_INTERIOR_RING

See Also:
  Constant Field Values

#### FA_STROKE

    protected final byte FA_STROKE

See Also:
  Constant Field Values

#### FA_EXTERIOR_RING

    protected final byte FA_EXTERIOR_RING

See Also:
  Constant Field Values

#### FA_POINT

    protected final byte FA_POINT

See Also:
  Constant Field Values

#### FA_LINE

    protected final byte FA_LINE

See Also:
  Constant Field Values

#### FA_ARC

    protected final byte FA_ARC

See Also:
  Constant Field Values

#### FA_COMPOSITE_CURVE

    protected final byte FA_COMPOSITE_CURVE

See Also:
  Constant Field Values

#### currentWktPos

    protected int currentWktPos

#### pointList

    protected java.util.List<com.microsoft.sqlserver.jdbc.Point> pointList

#### figureList

    protected java.util.List<com.microsoft.sqlserver.jdbc.Figure> figureList

#### shapeList

    protected java.util.List<com.microsoft.sqlserver.jdbc.Shape> shapeList

#### segmentList

    protected java.util.List<com.microsoft.sqlserver.jdbc.Segment> segmentList

#### serializationProperties

    protected byte serializationProperties

### Constructor Detail

#### Geometry

    protected Geometry()

#### Geometry

    protected Geometry​(java.lang.String wkt,
                       int srid)
                throws SQLServerException

Private constructor used for creating a Geometry object from WKT and Spatial Reference Identifier.

Parameters:
  `wkt` - Well-Known Text (WKT) provided by the user.
  `srid` - Spatial Reference Identifier (SRID) provided by the user.
Throws:
  `SQLServerException` - if an exception occurs

#### Geometry

    protected Geometry​(byte[] wkb)
                throws SQLServerException

Private constructor used for creating a Geometry object from WKB.

Parameters:
  `wkb` - Well-Known Binary (WKB) provided by the user.
Throws:
  `SQLServerException` - if an exception occurs

### Method Detail

#### STGeomFromText

    public static Geometry STGeomFromText​(java.lang.String wkt,
                                          int srid)
                                   throws SQLServerException

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.

Parameters:
  `wkt` - Well-Known Text (WKT) provided by the user.
  `srid` - Spatial Reference Identifier (SRID) provided by the user.
Returns:
  Geometry Geometry instance created from WKT and SRID
Throws:
  `SQLServerException` - if an exception occurs

#### STGeomFromWKB

    public static Geometry STGeomFromWKB​(byte[] wkb)
                                  throws SQLServerException

Constructor for a Geometry instance from an Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation.

Parameters:
  `wkb` - Well-Known Binary (WKB) provided by the user.
Returns:
  Geometry Geometry instance created from WKB
Throws:
  `SQLServerException` - if an exception occurs

#### deserialize

    public static Geometry deserialize​(byte[] wkb)
                                throws SQLServerException

Constructor for a Geometry instance from an internal SQL Server format for spatial data.

Parameters:
  `wkb` - Well-Known Binary (WKB) provided by the user.
Returns:
  Geometry Geometry instance created from WKB
Throws:
  `SQLServerException` - if an exception occurs

#### parse

    public static Geometry parse​(java.lang.String wkt)
                          throws SQLServerException

Constructor for a Geometry instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation. Spatial Reference Identifier is defaulted to 0.

Parameters:
  `wkt` - Well-Known Text (WKT) provided by the user.
Returns:
  Geometry Geometry instance created from WKT
Throws:
  `SQLServerException` - if an exception occurs

#### point

    public static Geometry point​(double x,
                                 double y,
                                 int srid)
                          throws SQLServerException

Constructor for a Geometry instance that represents a Point instance from its X and Y values and an Spatial Reference Identifier.

Parameters:
  `x` - x coordinate
  `y` - y coordinate
  `srid` - Spatial Reference Identifier value
Returns:
  Geometry Geography instance
Throws:
  `SQLServerException` - if an exception occurs

#### STAsText

    public java.lang.String STAsText()
                              throws SQLServerException

Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a Geometry instance. This text will not contain any Z (elevation) or M (measure) values carried by the instance.

Returns:
  the WKT representation without the Z and M values.
Throws:
  `SQLServerException` - if an exception occurs

#### STAsBinary

    public byte[] STAsBinary()

Returns the Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation of a Geometry instance. This value will not contain any Z or M values carried by the instance.

Returns:
  byte array representation of the Geometry object.

#### serialize

    public byte[] serialize()

Returns the bytes that represent an internal SQL Server format of Geometry type.

Returns:
  byte array representation of the Geometry object.

#### hasM

    public boolean hasM()

Returns if the object contains a M (measure) value.

Returns:
  boolean that indicates if the object contains M value.

#### hasZ

    public boolean hasZ()

Returns if the object contains a Z (elevation) value.

Returns:
  boolean that indicates if the object contains Z value.

#### getX

    public java.lang.Double getX()

Returns the X coordinate value.

Returns:
  double value that represents the X coordinate.

#### getY

    public java.lang.Double getY()

Returns the Y coordinate value.

Returns:
  double value that represents the Y coordinate.

#### getM

    public java.lang.Double getM()

Returns the M (measure) value of the object.

Returns:
  double value that represents the M value.

#### getZ

    public java.lang.Double getZ()

Returns the Z (elevation) value of the object.

Returns:
  double value that represents the Z value.

#### getSrid

    public int getSrid()

Returns the Spatial Reference Identifier (SRID) value.

Returns:
  int value of SRID.

#### isNull

    public boolean isNull()

Returns if the Geometry object is null.

Returns:
  boolean that indicates if the object is null.

#### STNumPoints

    public int STNumPoints()

Returns the number of points in the Geometry object.

Returns:
  int that indicates the number of points in the Geometry object.

#### STGeometryType

    public java.lang.String STGeometryType()

Returns the Open Geospatial Consortium (OGC) type name represented by a geometry instance.

Returns:
  String that contains the Geometry object's type name

#### asTextZM

    public java.lang.String asTextZM()

Returns the Well-Known Text (WKT) representation of the Geometry object.

Returns:
  String that contains the WKT representation of the Geometry object.

#### toString

    public java.lang.String toString()

Returns the String representation of the Geometry object.

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  String that contains the WKT representation of the Geometry object.

#### serializeToWkb

    protected void serializeToWkb​(boolean excludeZMFromWKB,
                                  com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype type)

Serializes the Geogemetry/Geography instance to WKB.

Parameters:
  `excludeZMFromWKB` - flag to indicate if Z and M coordinates should be excluded from the WKB representation
  `type` - Type of Spatial Datatype (Geometry/Geography)

#### parseWkb

    protected void parseWkb​(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype type)
                     throws SQLServerException

Deserializes the buffer (that contains WKB representation of Geometry/Geography data), and stores it into multiple corresponding data structures.

Parameters:
  `type` - Type of Spatial Datatype (Geography/Geometry)
Throws:
  `SQLServerException` - if an Exception occurs

#### constructWKT

    protected void constructWKT​(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype sd,
                                InternalSpatialDatatype isd,
                                int pointIndexEnd,
                                int figureIndexEnd,
                                int segmentIndexEnd,
                                int shapeIndexEnd)
                         throws SQLServerException

Constructs the WKT representation of Geometry/Geography from the deserialized data.

Parameters:
  `sd` - the Geometry/Geography instance.
  `isd` - internal spatial datatype object
  `pointIndexEnd` - upper bound for reading points
  `figureIndexEnd` - upper bound for reading figures
  `segmentIndexEnd` - upper bound for reading segments
  `shapeIndexEnd` - upper bound for reading shapes
Throws:
  `SQLServerException` - if an exception occurs

#### parseWKTForSerialization

    protected void parseWKTForSerialization​(com.microsoft.sqlserver.jdbc.SQLServerSpatialDatatype sd,
                                            int startPos,
                                            int parentShapeIndex,
                                            boolean isGeoCollection)
                                     throws SQLServerException

Parses WKT and populates the data structures of the Geometry/Geography instance.

Parameters:
  `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.
Throws:
  `SQLServerException` - if an exception occurs

#### constructPointWKT

    protected void constructPointWKT​(int pointIndex)

Constructs and appends a Point type in WKT form to the stringbuffer. There are two stringbuffers - WKTsb and WKTsbNoZM. WKTsb contains the X, Y, Z and M coordinates, whereas WKTsbNoZM contains only X and Y coordinates.

Parameters:
  `pointIndex` - indicates which point to append to the stringbuffer.

#### constructLineWKT

    protected void constructLineWKT​(int pointStartIndex,
                                    int pointEndIndex)

Constructs a line in WKT form.

Parameters:
  `pointStartIndex` - .
  `pointEndIndex` - .

#### constructShapeWKT

    protected void constructShapeWKT​(int figureStartIndex,
                                     int figureEndIndex)

Constructs a shape (simple Geometry/Geography entities that are contained within a single bracket) in WKT form.

Parameters:
  `figureStartIndex` - .
  `figureEndIndex` - .

#### constructMultiShapeWKT

    protected void constructMultiShapeWKT​(int shapeStartIndex,
                                          int shapeEndIndex)

Constructs a mutli-shape (MultiPoint / MultiLineString) in WKT form.

Parameters:
  `shapeStartIndex` - .
  `shapeEndIndex` - .

#### constructCompoundcurveWKT

    protected void constructCompoundcurveWKT​(int segmentStartIndex,
                                             int segmentEndIndex,
                                             int pointEndIndex)

Constructs a CompoundCurve in WKT form.

Parameters:
  `segmentStartIndex` - .
  `segmentEndIndex` - .
  `pointEndIndex` - .

#### constructMultipolygonWKT

    protected void constructMultipolygonWKT​(int shapeStartIndex,
                                            int shapeEndIndex)

Constructs a MultiPolygon in WKT form.

Parameters:
  `shapeStartIndex` - .
  `shapeEndIndex` - .

#### constructCurvepolygonWKT

    protected void constructCurvepolygonWKT​(int figureStartIndex,
                                            int figureEndIndex,
                                            int segmentStartIndex,
                                            int segmentEndIndex)

Constructs a CurvePolygon in WKT form.

Parameters:
  `figureStartIndex` - .
  `figureEndIndex` - .
  `segmentStartIndex` - .
  `segmentEndIndex` - .

#### constructSegmentWKT

    protected void constructSegmentWKT​(int currentSegment,
                                       byte segment,
                                       int pointEndIndex)

Constructs a Segment in WKT form. SQL Server re-uses the last point of a segment if the following segment is of type 3 (first arc) or type 2 (first line). This makes sense because the last point of a segment and the first point of the next segment have to match for a valid curve. This means that the code has to look ahead and decide to decrement the currentPointIndex depending on what segment comes next, since it may have been reused (and it's reflected in the array of points)

Parameters:
  `currentSegment` - .
  `segment` - .
  `pointEndIndex` - .

#### constructGeometryCollectionWKT

    protected void constructGeometryCollectionWKT​(int shapeEndIndex)
                                           throws SQLServerException

The starting point for constructing a GeometryCollection type in WKT form.

Parameters:
  `shapeEndIndex` - .
Throws:
  `SQLServerException` - if an exception occurs

#### readPointWkt

    protected void readPointWkt()
                         throws SQLServerException

Reads Point WKT and adds it to the list of points. This method will read up until and including the comma that may come at the end of the Point WKT.

Throws:
  `SQLServerException` - if an exception occurs

#### readLineWkt

    protected void readLineWkt()
                        throws SQLServerException

Reads a series of Point types.

Throws:
  `SQLServerException` - if an exception occurs

#### readShapeWkt

    protected void readShapeWkt​(int parentShapeIndex,
                                java.lang.String nextToken)
                         throws SQLServerException

Reads a shape (simple Geometry/Geography entities that are contained within a single bracket) WKT.

Parameters:
  `parentShapeIndex` - shape index of the parent shape that called this method
  `nextToken` - next string token
Throws:
  `SQLServerException` - if an exception occurs

#### readCurvePolygon

    protected void readCurvePolygon()
                             throws SQLServerException

Reads a CurvePolygon WKT.

Throws:
  `SQLServerException` - if an exception occurs

#### readMultiPolygonWkt

    protected void readMultiPolygonWkt​(int thisShapeIndex,
                                       java.lang.String nextToken)
                                throws SQLServerException

Reads a MultiPolygon WKT.

Parameters:
  `thisShapeIndex` - shape index of current shape
  `nextToken` - next string token
Throws:
  `SQLServerException` - if an exception occurs

#### readSegmentWkt

    protected void readSegmentWkt​(int segmentType,
                                  boolean isFirstIteration)
                           throws SQLServerException

Reads a Segment WKT.

Parameters:
  `segmentType` - segment type
  `isFirstIteration` - flag that indicates if this is the first iteration from the loop outside
Throws:
  `SQLServerException` - if an exception occurs

#### readCompoundCurveWkt

    protected void readCompoundCurveWkt​(boolean isFirstIteration)
                                 throws SQLServerException

Reads a CompoundCurve WKT.

Parameters:
  `isFirstIteration` - flag that indicates if this is the first iteration from the loop outside
Throws:
  `SQLServerException` - if an exception occurs

#### getNextStringToken

    protected java.lang.String getNextStringToken()

Reads the next string token (usually POINT, LINESTRING, etc.). Then increments currentWktPos to the end of the string token.

Returns:
  the next string token

#### populateStructures

    protected void populateStructures()

Populates the various data structures contained within the Geometry/Geography instance.

#### readOpenBracket

    protected void readOpenBracket()
                            throws SQLServerException

Throws:
  `SQLServerException`

#### readCloseBracket

    protected void readCloseBracket()
                             throws SQLServerException

Throws:
  `SQLServerException`

#### hasMoreToken

    protected boolean hasMoreToken()

#### createSerializationProperties

    protected void createSerializationProperties()

#### determineWkbCapacity

    protected int determineWkbCapacity​(boolean excludeZMFromWKB)

#### appendToWKTBuffers

    protected void appendToWKTBuffers​(java.lang.Object o)

Append the data to both stringbuffers.

Parameters:
  `o` - data to append to the stringbuffers.

#### interpretSerializationPropBytes

    protected void interpretSerializationPropBytes()

#### readNumberOfPoints

    protected void readNumberOfPoints()
                               throws SQLServerException

Throws:
  `SQLServerException`

#### readZvalues

    protected void readZvalues()
                        throws SQLServerException

Throws:
  `SQLServerException`

#### readMvalues

    protected void readMvalues()
                        throws SQLServerException

Throws:
  `SQLServerException`

#### readNumberOfFigures

    protected void readNumberOfFigures()
                                throws SQLServerException

Throws:
  `SQLServerException`

#### readFigures

    protected void readFigures()
                        throws SQLServerException

Throws:
  `SQLServerException`

#### readNumberOfShapes

    protected void readNumberOfShapes()
                               throws SQLServerException

Throws:
  `SQLServerException`

#### readShapes

    protected void readShapes()
                       throws SQLServerException

Throws:
  `SQLServerException`

#### readNumberOfSegments

    protected void readNumberOfSegments()
                                 throws SQLServerException

Throws:
  `SQLServerException`

#### readSegments

    protected void readSegments()
                         throws SQLServerException

Throws:
  `SQLServerException`

#### determineInternalType

    protected void determineInternalType()

#### checkEmptyKeyword

    protected boolean checkEmptyKeyword​(int parentShapeIndex,
                                        InternalSpatialDatatype isd,
                                        boolean isInsideAnotherShape)
                                 throws SQLServerException

Throws:
  `SQLServerException`

#### throwIllegalWKT

    protected void throwIllegalWKT()
                            throws SQLServerException

Throws:
  `SQLServerException`

#### throwIllegalWKB

    protected void throwIllegalWKB()
                            throws SQLServerException

Throws:
  `SQLServerException`

#### readByte

    protected byte readByte()
                     throws SQLServerException

Throws:
  `SQLServerException`

#### readInt

    protected int readInt()
                   throws SQLServerException

Throws:
  `SQLServerException`

#### readDouble

    protected double readDouble()
                         throws SQLServerException

Throws:
  `SQLServerException`