22#include <geos/export.h>
23#include <geos/geom/Geometry.h>
24#include <geos/geom/GeometryTypeName.h>
25#include <geos/io/ByteOrderDataInStream.h>
34#pragma warning(disable: 4251)
85class GEOS_DLL WKBReader {
94 void setFixStructure(
bool doFixStructure);
104 std::unique_ptr<geom::Geometry>
read(std::istream& is);
115 std::unique_ptr<geom::Geometry>
read(
const unsigned char* buf,
size_t size);
125 std::unique_ptr<geom::Geometry>
readHEX(std::istream& is);
133 static std::ostream&
printHEX(std::istream& is, std::ostream& os);
140 unsigned int inputDimension;
147 std::array<double, 4> ordValues;
149 std::unique_ptr<geom::Geometry> readGeometry();
151 std::unique_ptr<geom::Point> readPoint();
153 std::unique_ptr<geom::LineString> readLineString();
155 std::unique_ptr<geom::LinearRing> readLinearRing();
157 std::unique_ptr<geom::CircularString> readCircularString();
159 std::unique_ptr<geom::CompoundCurve> readCompoundCurve();
161 std::unique_ptr<geom::Polygon> readPolygon();
163 std::unique_ptr<geom::CurvePolygon> readCurvePolygon();
165 std::unique_ptr<geom::MultiPoint> readMultiPoint();
167 std::unique_ptr<geom::MultiLineString> readMultiLineString();
169 std::unique_ptr<geom::MultiCurve> readMultiCurve();
171 std::unique_ptr<geom::MultiPolygon> readMultiPolygon();
173 std::unique_ptr<geom::MultiSurface> readMultiSurface();
175 std::unique_ptr<geom::GeometryCollection> readGeometryCollection();
177 std::unique_ptr<geom::CoordinateSequence> readCoordinateSequence(
unsigned int);
181 void readCoordinate();
184 std::unique_ptr<T> readChild()
186 auto g = readGeometry();
187 if (
dynamic_cast<const T*
>(g.get())) {
188 return std::unique_ptr<T>(
static_cast<T*
>(g.release()));
190 throw io::ParseException(std::string(
"Expected ") + geom::GeometryTypeName<T>::name +
" but got " + g->getGeometryType());
194 WKBReader(
const WKBReader& other) =
delete;
195 WKBReader& operator=(
const WKBReader& rhs) =
delete;
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:51
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Definition LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
Models a collection of LineStrings.
Definition MultiLineString.h:49
Definition MultiPoint.h:50
Definition MultiPolygon.h:58
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:88
Allows reading an stream of primitive datatypes from an underlying istream, with the representation b...
Definition ByteOrderDataInStream.h:40
Notifies a parsing error.
Definition ParseException.h:33
static std::ostream & printHEX(std::istream &is, std::ostream &os)
Print WKB in HEX form to out stream.
WKBReader()
Initialize parser with default GeometryFactory.
std::unique_ptr< geom::Geometry > read(const unsigned char *buf, size_t size)
Reads a Geometry from a buffer.
std::unique_ptr< geom::Geometry > readHEX(std::istream &is)
Reads a Geometry from an istream in hex format.
std::unique_ptr< geom::Geometry > read(std::istream &is)
Reads a Geometry from an istream.
GeometryTypeId
Geometry types.
Definition Geometry.h:74
Contains the interfaces for converting JTS objects to and from other formats.
Definition Geometry.h:65
Basic namespace for all GEOS functionalities.
Definition geos.h:39