GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2005-2006 Refractions Research Inc. 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 ********************************************************************** 00015 * 00016 * Last port: io/WKBReader.java rev. 1.1 (JTS-1.7) 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_IO_WKBREADER_H 00021 #define GEOS_IO_WKBREADER_H 00022 00023 #include <geos/export.h> 00024 00025 #include <geos/geom/GeometryFactory.h> 00026 #include <geos/io/ByteOrderDataInStream.h> // for composition 00027 00028 #include <iosfwd> // ostream, istream 00029 #include <vector> 00030 #include <string> 00031 00032 #define BAD_GEOM_TYPE_MSG "Bad geometry type encountered in" 00033 00034 #ifdef _MSC_VER 00035 #pragma warning(push) 00036 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00037 #endif 00038 00039 // Forward declarations 00040 namespace geos { 00041 namespace geom { 00042 00043 //class GeometryFactory; 00044 class Coordinate; 00045 class Geometry; 00046 class GeometryCollection; 00047 class Point; 00048 class LineString; 00049 class LinearRing; 00050 class Polygon; 00051 class MultiPoint; 00052 class MultiLineString; 00053 class MultiPolygon; 00054 class PrecisionModel; 00055 00056 } // namespace geom 00057 } // namespace geos 00058 00059 00060 namespace geos { 00061 namespace io { 00062 00079 class GEOS_DLL WKBReader { 00080 00081 public: 00082 00083 WKBReader(geom::GeometryFactory const& f): factory(f) {} 00084 00086 WKBReader(); 00087 00096 geom::Geometry* read(std::istream &is); 00097 // throws IOException, ParseException 00098 00107 geom::Geometry *readHEX(std::istream &is); 00108 // throws IOException, ParseException 00109 00116 static std::ostream &printHEX(std::istream &is, std::ostream &os); 00117 00118 private: 00119 00120 const geom::GeometryFactory &factory; 00121 00122 // for now support the WKB standard only - may be generalized later 00123 unsigned int inputDimension; 00124 00125 ByteOrderDataInStream dis; 00126 00127 std::vector<double> ordValues; 00128 00129 geom::Geometry *readGeometry(); 00130 // throws IOException, ParseException 00131 00132 geom::Point *readPoint(); 00133 // throws IOException 00134 00135 geom::LineString *readLineString(); 00136 // throws IOException 00137 00138 geom::LinearRing *readLinearRing(); 00139 // throws IOException 00140 00141 geom::Polygon *readPolygon(); 00142 // throws IOException 00143 00144 geom::MultiPoint *readMultiPoint(); 00145 // throws IOException, ParseException 00146 00147 geom::MultiLineString *readMultiLineString(); 00148 // throws IOException, ParseException 00149 00150 geom::MultiPolygon *readMultiPolygon(); 00151 // throws IOException, ParseException 00152 00153 geom::GeometryCollection *readGeometryCollection(); 00154 // throws IOException, ParseException 00155 00156 geom::CoordinateSequence *readCoordinateSequence(int); // throws IOException 00157 00158 void readCoordinate(); // throws IOException 00159 00160 // Declare type as noncopyable 00161 WKBReader(const WKBReader& other); 00162 WKBReader& operator=(const WKBReader& rhs); 00163 }; 00164 00165 } // namespace io 00166 } // namespace geos 00167 00168 #ifdef _MSC_VER 00169 #pragma warning(pop) 00170 #endif 00171 00172 #endif // #ifndef GEOS_IO_WKBREADER_H