Class WktShapeParser
An extensible parser for Well Known Text (WKT). The shapes supported by this class are:
parse___Shape
methods further describe these
shapes, or you
Most users of this class will call just one method: Parse(String), or ParseIfSupported(String) to not fail if it isn't parse-able.
To support more shapes, extend this class and override ParseShapeByType(WktShapeParser.State, String). It's also possible to delegate to a WKTParser by also delegating NewState(String).
Note, instances of this base class are threadsafe.
Inheritance
Inherited Members
Assembly: Spatial4n.dll
Syntax
[Serializable]
public class WktShapeParser
Constructors
Name | Description |
---|---|
WktShapeParser(SpatialContext, SpatialContextFactory) | This constructor is required by MakeWktShapeParser(SpatialContext). |
Fields
Name | Description |
---|---|
m_ctx |
Properties
Name | Description |
---|---|
Ctx |
Methods
Name | Description |
---|---|
NewState(String) | (internal) Creates a new State with the given String. It's only called by ParseIfSupported(String). This is an extension point for subclassing. |
NormDist(Double) | Called to normalize a value that isn't X or Y. X & Y or normalized via NormX(Double) & NormY(Double). |
Parse(String) | Parses the wktString, returning the defined IShape. |
ParseBufferShape(WktShapeParser.State) | Parses the BUFFER operation applied to a parsed shape.
Whereas 'number' is the distance to buffer the shape by. |
ParseEnvelopeShape(WktShapeParser.State) | Parses an ENVELOPE (aka Rectangle) shape from the raw string. The values are normalized.
Source: OGC "Catalogue Services Specification", the "CQL" (Common Query Language) sub-spec.
|
ParseGeometryCollectionShape(WktShapeParser.State) | Parses a GEOMETRYCOLLECTION shape from the raw string.
|
ParseIfSupported(String) | Parses the wktString, returning the defined IShape. If it can't because the shape name is unknown or an empty or blank string was passed, then it returns null. If the WKT starts with a supported shape but contains an inner unsupported shape then it will result in a ParseException. |
ParseLineStringShape(WktShapeParser.State) | Parses a LINESTRING shape from the raw string -- an ordered sequence of points.
|
ParseMultiLineStringShape(WktShapeParser.State) | Parses a MULTILINESTRING shape from the raw string -- a collection of line strings.
|
ParseMultiPointShape(WktShapeParser.State) | Parses a MULTIPOINT shape from the raw string -- a collection of points.
Furthermore, coordinate can optionally be wrapped in parenthesis. |
ParsePointShape(WktShapeParser.State) | Parses a POINT shape from the raw string.
|
ParseShapeByType(WktShapeParser.State, String) | (internal) Parses the remainder of a shape definition following the shape's name
given as When writing a parse method that reacts to a specific shape type, remember to handle the dimension and EMPTY token via NextIfEmptyAndSkipZM(). |
Point(WktShapeParser.State) | Reads a raw Point (AKA Coordinate) from the current position. Only the first 2 numbers are used. The values are normalized.
|
PointList(WktShapeParser.State) | Reads a list of Points (AKA CoordinateSequence) from the current position.
|
Shape(WktShapeParser.State) | Reads a shape from the current position, starting with the name of the shape. It calls ParseShapeByType(WktShapeParser.State, String) and throws an exception if the shape wasn't supported. |