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;
45 class MultiLineString;
71 : geometryFactory(&gf)
72 , precisionModel(gf.getPrecisionModel())
79 , precisionModel(gf->getPrecisionModel())
88 : geometryFactory(geom::GeometryFactory::getDefaultInstance())
89 , precisionModel(geometryFactory->getPrecisionModel())
96 setFixStructure(
bool doFixStructure) {
97 fixStructure = doFixStructure;
102 std::unique_ptr<T>
read(
const std::string& wkt)
const {
104 auto gt =
dynamic_cast<const T*
>(g.get());
109 return std::unique_ptr<T>(
static_cast<T*
>(g.release()));
112 std::unique_ptr<geom::Geometry> read(
const std::string& wellKnownText)
const;
115 std::unique_ptr<geom::CoordinateSequence> getCoordinates(io::StringTokenizer* tokenizer,
OrdinateSet& ordinates)
const;
116 static double getNextNumber(io::StringTokenizer* tokenizer);
117 static std::string getNextEmptyOrOpener(io::StringTokenizer* tokenizer,
OrdinateSet& dim);
118 static std::string getNextCloserOrComma(io::StringTokenizer* tokenizer);
119 static std::string getNextCloser(io::StringTokenizer* tokenizer);
120 static std::string getNextWord(io::StringTokenizer* tokenizer);
121 std::unique_ptr<geom::Geometry> readGeometryTaggedText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
122 std::unique_ptr<geom::Point> readPointText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
123 std::unique_ptr<geom::LineString> readLineStringText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
124 std::unique_ptr<geom::LinearRing> readLinearRingText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
125 std::unique_ptr<geom::MultiPoint> readMultiPointText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
126 std::unique_ptr<geom::Polygon> readPolygonText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
127 std::unique_ptr<geom::MultiLineString> readMultiLineStringText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
128 std::unique_ptr<geom::MultiPolygon> readMultiPolygonText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
129 std::unique_ptr<geom::GeometryCollection> readGeometryCollectionText(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags)
const;
135 void getPreciseCoordinate(io::StringTokenizer* tokenizer,
OrdinateSet& ordinateFlags, geom::CoordinateXYZM&)
const;
137 static bool isNumberNext(io::StringTokenizer* tokenizer);
138 static bool isOpenerNext(io::StringTokenizer* tokenizer);
140 static void readOrdinateFlags(
const std::string & s,
OrdinateSet& ordinateFlags);
141 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:65
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:59
std::unique_ptr< T > read(const std::string &wkt) const
Parse a WKT string returning a Geometry.
Definition: WKTReader.h:102
WKTReader(const geom::GeometryFactory *gf)
Definition: WKTReader.h:77
WKTReader()
Initialize parser with default GeometryFactory.
Definition: WKTReader.h:87
WKTReader(const geom::GeometryFactory &gf)
Initialize parser with given GeometryFactory.
Definition: WKTReader.h:70
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25