GEOS: WKBReader.h Source File

GEOS 3.5.0

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

- File List

WKBReader.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/WKBReader.java rev. 1.1 (JTS-1.7)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_IO_WKBREADER_H
21 #define GEOS_IO_WKBREADER_H
22
23 #include <geos/export.h>
24
25 #include <geos/geom/GeometryFactory.h>
26 #include <geos/io/ByteOrderDataInStream.h> // for composition
27
28 #include <iosfwd> // ostream, istream
29 #include <vector>
30 #include <string>
31
32 #define BAD_GEOM_TYPE_MSG "Bad geometry type encountered in"
33
34 #ifdef _MSC_VER
35 #pragma warning(push)
36 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
37 #endif
38
39 // Forward declarations
40 namespace geos {
41 namespace geom {
42
43 //class GeometryFactory;
44 class Coordinate;
45 class Geometry;
46 class GeometryCollection;
47 class Point;
48 class LineString;
49 class LinearRing;
50 class Polygon;
51 class MultiPoint;
52 class MultiLineString;
53 class MultiPolygon;
54 class PrecisionModel;
55
56 } // namespace geom
57 } // namespace geos
58
59
60 namespace geos {
61 namespace io {
62
79 class GEOS_DLL WKBReader {
80
81 public:
82
83 WKBReader(geom::GeometryFactory const& f): factory(f) {}
84
86 WKBReader();
87
96 geom::Geometry* read(std::istream &is);
97 // throws IOException, ParseException
98
107 geom::Geometry *readHEX(std::istream &is);
108 // throws IOException, ParseException
109
116 static std::ostream &printHEX(std::istream &is, std::ostream &os);
117
118 private:
119
120 const geom::GeometryFactory &factory;
121
122 // for now support the WKB standard only - may be generalized later
123 unsigned int inputDimension;
124
125 ByteOrderDataInStream dis;
126
127 std::vector<double> ordValues;
128
129 geom::Geometry *readGeometry();
130 // throws IOException, ParseException
131
132 geom::Point *readPoint();
133 // throws IOException
134
135 geom::LineString *readLineString();
136 // throws IOException
137
138 geom::LinearRing *readLinearRing();
139 // throws IOException
140
141 geom::Polygon *readPolygon();
142 // throws IOException
143
144 geom::MultiPoint *readMultiPoint();
145 // throws IOException, ParseException
146
147 geom::MultiLineString *readMultiLineString();
148 // throws IOException, ParseException
149
150 geom::MultiPolygon *readMultiPolygon();
151 // throws IOException, ParseException
152
153 geom::GeometryCollection *readGeometryCollection();
154 // throws IOException, ParseException
155
156 geom::CoordinateSequence *readCoordinateSequence(int); // throws IOException
157
158 void readCoordinate(); // throws IOException
159
160 // Declare type as noncopyable
161 WKBReader(const WKBReader& other);
162 WKBReader& operator=(const WKBReader& rhs);
163 };
164
165 } // namespace io
166 } // namespace geos
167
168 #ifdef _MSC_VER
169 #pragma warning(pop)
170 #endif
171
172 #endif // #ifndef GEOS_IO_WKBREADER_H
geos::io::WKBReader
Reads a Geometry from Well-Known Binary format.
Definition: WKBReader.h:79
geos::geom::MultiPolygon
Models a collection of Polygons.
Definition: MultiPolygon.h:60
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