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

# WKTReader.h

    00001 /**********************************************************************
    00002  * $Id: WKTReader.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_WKTREADER_H
    00018 #define GEOS_IO_WKTREADER_H
    00019
    00020 #include <geos/geom/GeometryFactory.h>
    00021 #include <geos/geom/CoordinateSequence.h>
    00022 #include <string>
    00023
    00024 // Forward declarations
    00025 namespace geos {
    00026         namespace io {
    00027                 class StringTokenizer;
    00028         }
    00029         namespace geom {
    00030
    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 }
    00044
    00045
    00046 namespace geos {
    00047 namespace io {
    00048
    00053 class WKTReader {
    00054 public:
    00055         //WKTReader();
    00056
    00065         WKTReader(const geom::GeometryFactory *gf);
    00066
    00071         WKTReader();
    00072
    00073         ~WKTReader();
    00074
    00076         geom::Geometry* read(const std::string &wellKnownText);
    00077
    00078 //      Geometry* read(Reader& reader); //Not implemented yet
    00079
    00080 protected:
    00081         geom::CoordinateSequence* getCoordinates(io::StringTokenizer *tokenizer);
    00082         double getNextNumber(io::StringTokenizer *tokenizer);
    00083         std::string getNextEmptyOrOpener(io::StringTokenizer *tokenizer);
    00084         std::string getNextCloserOrComma(io::StringTokenizer *tokenizer);
    00085         std::string getNextCloser(io::StringTokenizer *tokenizer);
    00086         std::string getNextWord(io::StringTokenizer *tokenizer);
    00087         geom::Geometry* readGeometryTaggedText(io::StringTokenizer *tokenizer);
    00088         geom::Point* readPointText(io::StringTokenizer *tokenizer);
    00089         geom::LineString* readLineStringText(io::StringTokenizer *tokenizer);
    00090         geom::LinearRing* readLinearRingText(io::StringTokenizer *tokenizer);
    00091         geom::MultiPoint* readMultiPointText(io::StringTokenizer *tokenizer);
    00092         geom::Polygon* readPolygonText(io::StringTokenizer *tokenizer);
    00093         geom::MultiLineString* readMultiLineStringText(io::StringTokenizer *tokenizer);
    00094         geom::MultiPolygon* readMultiPolygonText(io::StringTokenizer *tokenizer);
    00095         geom::GeometryCollection* readGeometryCollectionText(io::StringTokenizer *tokenizer);
    00096 private:
    00097         const geom::GeometryFactory *geometryFactory;
    00098         const geom::PrecisionModel *precisionModel;
    00099
    00100         void getPreciseCoordinate(io::StringTokenizer *tokenizer, geom::Coordinate&);
    00101
    00102         bool isNumberNext(io::StringTokenizer *tokenizer);
    00103 };
    00104
    00105 } // namespace io
    00106 } // namespace geos
    00107
    00108 #ifdef GEOS_INLINE
    00109 # include <geos/io/WKTReader.inl>
    00110 #endif
    00111
    00112 #endif // #ifndef GEOS_IO_WKTREADER_H
    00113
    00114 /**********************************************************************
    00115  * $Log$
    00116  * Revision 1.6  2006/04/10 13:40:14  strk
    00117  * Added default ctor for WKTReader (using GeometryFactory's default instance)
    00118  *
    00119  * Revision 1.5  2006/04/10 12:05:35  strk
    00120  * Added inline-replicator implementation files to make sure
    00121  * functions in .inl files are still available out-of-line.
    00122  * A side effect is this should fix MingW build.
    00123  *
    00124  * Revision 1.4  2006/03/30 09:26:36  strk
    00125  * minor cleanup
    00126  *
    00127  * Revision 1.3  2006/03/24 09:52:41  strk
    00128  * USE_INLINE => GEOS_INLINE
    00129  *
    00130  * Revision 1.2  2006/03/22 16:58:35  strk
    00131  * Removed (almost) all inclusions of geom.h.
    00132  * Removed obsoleted .cpp files.
    00133  * Fixed a bug in WKTReader not using the provided CoordinateSequence
    00134  * implementation, optimized out some memory allocations.
    00135  *
    00136  * Revision 1.1  2006/03/20 18:18:15  strk
    00137  * io.h header split
    00138  *
    00139  **********************************************************************/