22 #include <geos/export.h>
24 #include <geos/geom/GeometryFactory.h>
25 #include <geos/geom/Geometry.h>
26 #include <geos/io/ParseException.h>
27 #include <geos/io/OrdinateSet.h>
34 class StringTokenizer;
38 class CoordinateSequence;
39 class GeometryCollection;
48 class MultiLineString;
76 : geometryFactory(&gf)
77 , precisionModel(gf.getPrecisionModel())
84 , precisionModel(gf->getPrecisionModel())
93 : geometryFactory(geom::GeometryFactory::getDefaultInstance())
94 , precisionModel(geometryFactory->getPrecisionModel())
101 setFixStructure(
bool doFixStructure) {
102 fixStructure = doFixStructure;
107 std::unique_ptr<T>
read(
const std::string& wkt)
const {
109 auto gt =
dynamic_cast<const T*
>(g.get());
114 return std::unique_ptr<T>(
static_cast<T*
>(g.release()));
117 std::unique_ptr<geom::Geometry> read(
const std::string& wellKnownText)
const;
120 std::unique_ptr<geom::CoordinateSequence> getCoordinates(io::StringTokenizer* tokenizer,
OrdinateSet& ordinates)
const;
121 static double getNextNumber(io::StringTokenizer* tokenizer);
122 static std::string getNextEmptyOrOpener(io::StringTokenizer* tokenizer,
OrdinateSet& dim);
123 static std::string getNextCloserOrComma(io::StringTokenizer* tokenizer);
124 static std::string getNextCloser(io::StringTokenizer* tokenizer);
125 static std::string getNextWord(io::StringTokenizer* tokenizer);
126 std::unique_ptr<geom::Geometry> readGeometryTaggedText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags,
const geom::GeometryTypeId* emptyType =
nullptr)
const;
128 std::unique_ptr<geom::Point> readPointText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
129 std::unique_ptr<geom::LineString> readLineStringText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
130 std::unique_ptr<geom::LinearRing> readLinearRingText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
131 std::unique_ptr<geom::MultiPoint> readMultiPointText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
132 std::unique_ptr<geom::Polygon> readPolygonText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
133 std::unique_ptr<geom::MultiLineString> readMultiLineStringText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
134 std::unique_ptr<geom::MultiPolygon> readMultiPolygonText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
135 std::unique_ptr<geom::GeometryCollection> readGeometryCollectionText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
136 std::unique_ptr<geom::CircularString> readCircularStringText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
137 std::unique_ptr<geom::CompoundCurve> readCompoundCurveText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
138 std::unique_ptr<geom::CurvePolygon> readCurvePolygonText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
139 std::unique_ptr<geom::MultiCurve> readMultiCurveText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
140 std::unique_ptr<geom::MultiSurface> readMultiSurfaceText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
152 void getPreciseCoordinate(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags, geom::CoordinateXYZM&)
const;
154 static bool isNumberNext(io::StringTokenizer* tokenizer);
155 static bool isOpenerNext(io::StringTokenizer* tokenizer);
157 static void readOrdinateFlags(
const std::string & s,
OrdinateSet& ordinateFlags);
158 static bool isTypeName(
const std::string & type,
const std::string & typeName);
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:88
Utility class to manipulate a set of flags indicating whether X, Y, Z, or M dimensions are present....
Definition: OrdinateSet.h:29
Notifies a parsing error.
Definition: ParseException.h:33
WKT parser class; see also WKTWriter.
Definition: WKTReader.h:64
std::unique_ptr< T > read(const std::string &wkt) const
Parse a WKT string returning a Geometry.
Definition: WKTReader.h:107
std::unique_ptr< geom::Curve > readCurveText(io::StringTokenizer *tokenizer, OrdinateSet &ordinateFlags) const
Read the contents of a LINEARRING, LINESTRING, CIRCULARSTRING, or COMPOUNDCURVE.
WKTReader(const geom::GeometryFactory *gf)
Definition: WKTReader.h:82
WKTReader()
Initialize parser with default GeometryFactory.
Definition: WKTReader.h:92
WKTReader(const geom::GeometryFactory &gf)
Initialize parser with given GeometryFactory.
Definition: WKTReader.h:75
std::unique_ptr< geom::Geometry > readSurfaceText(io::StringTokenizer *tokenizer, OrdinateSet &ordinateFlags) const
Read the contents of a POLYGON or a CURVEPOLYGON.
GeometryTypeId
Geometry types.
Definition: Geometry.h:74
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25