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

WKTReader.h

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

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1