• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

WKBReader.h

00001 /**********************************************************************
00002  * $Id: WKBReader.h 2775 2009-12-03 19:38:12Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2005-2006 Refractions Research Inc.
00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: io/WKBReader.java rev. 1.1 (JTS-1.7)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_IO_WKBREADER_H
00022 #define GEOS_IO_WKBREADER_H
00023 
00024 #include <geos/export.h>
00025 
00026 #include <geos/geom/GeometryFactory.h>
00027 #include <geos/io/ByteOrderDataInStream.h> // for composition
00028 
00029 #include <iosfwd> // ostream, istream
00030 #include <vector>
00031 #include <string>
00032 
00033 #define BAD_GEOM_TYPE_MSG "Bad geometry type encountered in"
00034 
00035 
00036 // Forward declarations
00037 namespace geos {
00038         namespace geom {
00039 
00040                 //class GeometryFactory;
00041                 class Coordinate;
00042                 class Geometry;
00043                 class GeometryCollection;
00044                 class Point;
00045                 class LineString;
00046                 class LinearRing;
00047                 class Polygon;
00048                 class MultiPoint;
00049                 class MultiLineString;
00050                 class MultiPolygon;
00051                 class PrecisionModel;
00052 
00053         } // namespace geom
00054 } // namespace geos
00055 
00056 
00057 namespace geos {
00058 namespace io {
00059 
00076 class GEOS_DLL WKBReader {
00077 
00078 public:
00079 
00080         WKBReader(geom::GeometryFactory const& f): factory(f) {};
00081 
00083         WKBReader();
00084 
00093         geom::Geometry* read(std::istream &is);
00094                 // throws IOException, ParseException
00095 
00104         geom::Geometry *readHEX(std::istream &is);
00105                 // throws IOException, ParseException
00106 
00113         static std::ostream &printHEX(std::istream &is, std::ostream &os);
00114  
00115 private:
00116 
00117         const geom::GeometryFactory &factory;
00118 
00119         // for now support the WKB standard only - may be generalized later
00120         unsigned int inputDimension;
00121 
00122         ByteOrderDataInStream dis;
00123 
00124         std::vector<double> ordValues;
00125 
00126         geom::Geometry *readGeometry();
00127                 // throws IOException, ParseException
00128 
00129         geom::Point *readPoint();
00130                 // throws IOException
00131 
00132         geom::LineString *readLineString();
00133                 // throws IOException
00134 
00135         geom::LinearRing *readLinearRing();
00136                 // throws IOException
00137 
00138         geom::Polygon *readPolygon();
00139                 // throws IOException
00140 
00141         geom::MultiPoint *readMultiPoint();
00142                 // throws IOException, ParseException
00143 
00144         geom::MultiLineString *readMultiLineString();
00145                 // throws IOException, ParseException
00146 
00147         geom::MultiPolygon *readMultiPolygon();
00148                 // throws IOException, ParseException
00149 
00150         geom::GeometryCollection *readGeometryCollection();
00151                 // throws IOException, ParseException
00152 
00153         geom::CoordinateSequence *readCoordinateSequence(int); // throws IOException
00154 
00155         void readCoordinate(); // throws IOException
00156 
00157     // Declare type as noncopyable
00158     WKBReader(const WKBReader& other);
00159     WKBReader& operator=(const WKBReader& rhs);
00160 };
00161 
00162 } // namespace io
00163 } // namespace geos
00164 
00165 
00166 #endif // #ifndef GEOS_IO_WKBREADER_H
00167 
00168 /**********************************************************************
00169  * $Log$
00170  * Revision 1.3  2006/06/01 11:49:36  strk
00171  * Reduced installed headers form geomgraph namespace
00172  *
00173  * Revision 1.2  2006/04/12 10:57:19  strk
00174  * Added WKBReader default ctor using default GeometryFactory instance
00175  *
00176  * Revision 1.1  2006/03/20 18:18:14  strk
00177  * io.h header split
00178  *
00179  **********************************************************************/

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1