GEOS: WKTReader.h Source File

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

WKTReader.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: io/WKTReader.java rev. 1.1 (JTS-1.7)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_IO_WKTREADER_H
21 #define GEOS_IO_WKTREADER_H
22
23 #include <geos/export.h>
24
25 #include <geos/geom/GeometryFactory.h>
26 #include <geos/geom/CoordinateSequence.h>
27 #include <string>
28
29 // Forward declarations
30 namespace geos {
31 namespace io {
32 class StringTokenizer;
33 }
34 namespace geom {
35
36 class Coordinate;
37 class Geometry;
38 class GeometryCollection;
39 class Point;
40 class LineString;
41 class LinearRing;
42 class Polygon;
43 class MultiPoint;
44 class MultiLineString;
45 class MultiPolygon;
46 class PrecisionModel;
47 }
48 }
49
50
51 namespace geos {
52 namespace io {
53
58 class GEOS_DLL WKTReader {
59 public:
60 //WKTReader();
61
70 WKTReader(const geom::GeometryFactory &gf);
71
73 WKTReader(const geom::GeometryFactory *gf);
74
79 WKTReader();
80
81 ~WKTReader();
82
84 geom::Geometry* read(const std::string &wellKnownText);
85
86 // Geometry* read(Reader& reader); //Not implemented yet
87
88 protected:
89 geom::CoordinateSequence* getCoordinates(io::StringTokenizer *tokenizer);
90 double getNextNumber(io::StringTokenizer *tokenizer);
91 std::string getNextEmptyOrOpener(io::StringTokenizer *tokenizer);
92 std::string getNextCloserOrComma(io::StringTokenizer *tokenizer);
93 std::string getNextCloser(io::StringTokenizer *tokenizer);
94 std::string getNextWord(io::StringTokenizer *tokenizer);
95 geom::Geometry* readGeometryTaggedText(io::StringTokenizer *tokenizer);
96 geom::Point* readPointText(io::StringTokenizer *tokenizer);
97 geom::LineString* readLineStringText(io::StringTokenizer *tokenizer);
98 geom::LinearRing* readLinearRingText(io::StringTokenizer *tokenizer);
99 geom::MultiPoint* readMultiPointText(io::StringTokenizer *tokenizer);
100 geom::Polygon* readPolygonText(io::StringTokenizer *tokenizer);
101 geom::MultiLineString* readMultiLineStringText(io::StringTokenizer *tokenizer);
102 geom::MultiPolygon* readMultiPolygonText(io::StringTokenizer *tokenizer);
103 geom::GeometryCollection* readGeometryCollectionText(io::StringTokenizer *tokenizer);
104 private:
105 const geom::GeometryFactory *geometryFactory;
106 const geom::PrecisionModel *precisionModel;
107
108 void getPreciseCoordinate(io::StringTokenizer *tokenizer, geom::Coordinate&, std::size_t &dim );
109
110 bool isNumberNext(io::StringTokenizer *tokenizer);
111 };
112
113 } // namespace io
114 } // namespace geos
115
116 #ifdef GEOS_INLINE
117 # include <geos/io/WKTReader.inl>
118 #endif
119
120 #endif // #ifndef GEOS_IO_WKTREADER_H
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::geom::MultiPolygon
Models a collection of Polygons.
Definition: MultiPolygon.h:60
geos::io::WKTReader
WKT parser class; see also WKTWriter.
Definition: WKTReader.h:58
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
geos::geom::LineString
Definition: LineString.h:70
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition: Polygon.h:66
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
geos::geom::GeometryCollection
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:56
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::MultiPoint
Definition: MultiPoint.h:55
geos::geom::LinearRing
Models an OGC SFS LinearRing.
Definition: LinearRing.h:57
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::geom::Point
Definition: Point.h:67
geos::geom::MultiLineString
Models a collection of (}s.
Definition: MultiLineString.h:51