GEOS: WKBReader.h Source File

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

- File List

# WKBReader.h

    00001 /**********************************************************************
    00002  * $Id: WKBReader.h 2958 2010-03-29 11:29:40Z 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 #ifdef _MSC_VER
    00036 #pragma warning(push)
    00037 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00038 #endif
    00039
    00040 // Forward declarations
    00041 namespace geos {
    00042         namespace geom {
    00043
    00044                 //class GeometryFactory;
    00045                 class Coordinate;
    00046                 class Geometry;
    00047                 class GeometryCollection;
    00048                 class Point;
    00049                 class LineString;
    00050                 class LinearRing;
    00051                 class Polygon;
    00052                 class MultiPoint;
    00053                 class MultiLineString;
    00054                 class MultiPolygon;
    00055                 class PrecisionModel;
    00056
    00057         } // namespace geom
    00058 } // namespace geos
    00059
    00060
    00061 namespace geos {
    00062 namespace io {
    00063
    00080 class GEOS_DLL WKBReader {
    00081
    00082 public:
    00083
    00084         WKBReader(geom::GeometryFactory const& f): factory(f) {};
    00085
    00087         WKBReader();
    00088
    00097         geom::Geometry* read(std::istream &is);
    00098                 // throws IOException, ParseException
    00099
    00108         geom::Geometry *readHEX(std::istream &is);
    00109                 // throws IOException, ParseException
    00110
    00117         static std::ostream &printHEX(std::istream &is, std::ostream &os);
    00118
    00119 private:
    00120
    00121         const geom::GeometryFactory &factory;
    00122
    00123         // for now support the WKB standard only - may be generalized later
    00124         unsigned int inputDimension;
    00125
    00126         ByteOrderDataInStream dis;
    00127
    00128         std::vector<double> ordValues;
    00129
    00130         geom::Geometry *readGeometry();
    00131                 // throws IOException, ParseException
    00132
    00133         geom::Point *readPoint();
    00134                 // throws IOException
    00135
    00136         geom::LineString *readLineString();
    00137                 // throws IOException
    00138
    00139         geom::LinearRing *readLinearRing();
    00140                 // throws IOException
    00141
    00142         geom::Polygon *readPolygon();
    00143                 // throws IOException
    00144
    00145         geom::MultiPoint *readMultiPoint();
    00146                 // throws IOException, ParseException
    00147
    00148         geom::MultiLineString *readMultiLineString();
    00149                 // throws IOException, ParseException
    00150
    00151         geom::MultiPolygon *readMultiPolygon();
    00152                 // throws IOException, ParseException
    00153
    00154         geom::GeometryCollection *readGeometryCollection();
    00155                 // throws IOException, ParseException
    00156
    00157         geom::CoordinateSequence *readCoordinateSequence(int); // throws IOException
    00158
    00159         void readCoordinate(); // throws IOException
    00160
    00161     // Declare type as noncopyable
    00162     WKBReader(const WKBReader& other);
    00163     WKBReader& operator=(const WKBReader& rhs);
    00164 };
    00165
    00166 } // namespace io
    00167 } // namespace geos
    00168
    00169 #ifdef _MSC_VER
    00170 #pragma warning(pop)
    00171 #endif
    00172
    00173 #endif // #ifndef GEOS_IO_WKBREADER_H
    00174
    00175 /**********************************************************************
    00176  * $Log$
    00177  * Revision 1.3  2006/06/01 11:49:36  strk
    00178  * Reduced installed headers form geomgraph namespace
    00179  *
    00180  * Revision 1.2  2006/04/12 10:57:19  strk
    00181  * Added WKBReader default ctor using default GeometryFactory instance
    00182  *
    00183  * Revision 1.1  2006/03/20 18:18:14  strk
    00184  * io.h header split
    00185  *
    00186  **********************************************************************/