GEOS: WKBReader.h Source File

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

# WKBReader.h

    00001 /**********************************************************************
    00002  * $Id: WKBReader.h 1820 2006-09-06 16:54:23Z 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 #ifndef GEOS_IO_WKBREADER_H
    00018 #define GEOS_IO_WKBREADER_H
    00019
    00020 #include <geos/geom/GeometryFactory.h>
    00021 #include <geos/io/ByteOrderDataInStream.h> // for composition
    00022
    00023 #include <iosfwd> // ostream, istream
    00024 #include <vector>
    00025
    00026 // Forward declarations
    00027 namespace geos {
    00028         namespace geom {
    00029
    00030                 //class GeometryFactory;
    00031                 class Coordinate;
    00032                 class Geometry;
    00033                 class GeometryCollection;
    00034                 class Point;
    00035                 class LineString;
    00036                 class LinearRing;
    00037                 class Polygon;
    00038                 class MultiPoint;
    00039                 class MultiLineString;
    00040                 class MultiPolygon;
    00041                 class PrecisionModel;
    00042
    00043         } // namespace geom
    00044 } // namespace geos
    00045
    00046
    00047 namespace geos {
    00048 namespace io {
    00049
    00066 class WKBReader {
    00067
    00068 public:
    00069
    00070         WKBReader(geom::GeometryFactory const& f): factory(f) {};
    00071
    00073         WKBReader();
    00074
    00083         geom::Geometry* read(std::istream &is);
    00084                 // throws IOException, ParseException
    00085
    00094         geom::Geometry *readHEX(std::istream &is);
    00095                 // throws IOException, ParseException
    00096
    00103         static std::ostream &printHEX(std::istream &is, std::ostream &os);
    00104
    00105 private:
    00106
    00107         static std::string BAD_GEOM_TYPE_MSG;
    00108
    00109         const geom::GeometryFactory &factory;
    00110
    00111         // for now support the WKB standard only - may be generalized later
    00112         unsigned int inputDimension;
    00113
    00114         ByteOrderDataInStream dis;
    00115
    00116         std::vector<double> ordValues;
    00117
    00118         geom::Geometry *readGeometry();
    00119                 // throws IOException, ParseException
    00120
    00121         geom::Point *readPoint();
    00122                 // throws IOException
    00123
    00124         geom::LineString *readLineString();
    00125                 // throws IOException
    00126
    00127         geom::LinearRing *readLinearRing();
    00128                 // throws IOException
    00129
    00130         geom::Polygon *readPolygon();
    00131                 // throws IOException
    00132
    00133         geom::MultiPoint *readMultiPoint();
    00134                 // throws IOException, ParseException
    00135
    00136         geom::MultiLineString *readMultiLineString();
    00137                 // throws IOException, ParseException
    00138
    00139         geom::MultiPolygon *readMultiPolygon();
    00140                 // throws IOException, ParseException
    00141
    00142         geom::GeometryCollection *readGeometryCollection();
    00143                 // throws IOException, ParseException
    00144
    00145         geom::CoordinateSequence *readCoordinateSequence(int); // throws IOException
    00146
    00147         void readCoordinate(); // throws IOException
    00148
    00149
    00150 };
    00151
    00152 } // namespace io
    00153 } // namespace geos
    00154
    00155
    00156 #endif // #ifndef GEOS_IO_WKBREADER_H
    00157
    00158 /**********************************************************************
    00159  * $Log$
    00160  * Revision 1.3  2006/06/01 11:49:36  strk
    00161  * Reduced installed headers form geomgraph namespace
    00162  *
    00163  * Revision 1.2  2006/04/12 10:57:19  strk
    00164  * Added WKBReader default ctor using default GeometryFactory instance
    00165  *
    00166  * Revision 1.1  2006/03/20 18:18:14  strk
    00167  * io.h header split
    00168  *
    00169  **********************************************************************/