GEOS: GeometryFactory.h Source File

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

- File List

# GeometryFactory.h

    00001 /**********************************************************************
    00002  * $Id: GeometryFactory.h 2556 2009-06-06 22:22:28Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************
    00015  *
    00016  * Last port: geom/GeometryFactory.java rev. 1.48
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_GEOM_GEOMETRYFACTORY_H
    00021 #define GEOS_GEOM_GEOMETRYFACTORY_H
    00022
    00023 //#include <geos/geom/CoordinateSequence.h>
    00024 //#include <geos/geom/Geometry.h>
    00025 #include <geos/export.h>
    00026 #include <geos/inline.h>
    00027
    00028 #include <vector>
    00029 #include <memory>
    00030
    00031 namespace geos {
    00032         namespace geom {
    00033                 class CoordinateSequenceFactory;
    00034                 class Coordinate;
    00035                 class CoordinateSequence;
    00036                 class Envelope;
    00037                 class Geometry;
    00038                 class GeometryCollection;
    00039                 class LineString;
    00040                 class LinearRing;
    00041                 class MultiLineString;
    00042                 class MultiPoint;
    00043                 class MultiPolygon;
    00044                 class Point;
    00045                 class Polygon;
    00046                 class PrecisionModel;
    00047         }
    00048 }
    00049
    00050 namespace geos {
    00051 namespace geom { // geos::geom
    00052
    00063 class GEOS_DLL GeometryFactory {
    00064 public:
    00070         GeometryFactory();
    00071
    00084         GeometryFactory(const PrecisionModel *pm, int newSRID,
    00085                 CoordinateSequenceFactory *nCoordinateSequenceFactory);
    00086
    00093         GeometryFactory(CoordinateSequenceFactory *nCoordinateSequenceFactory);
    00094
    00103         GeometryFactory(const PrecisionModel *pm);
    00104
    00114         GeometryFactory(const PrecisionModel* pm, int newSRID);
    00115
    00121         GeometryFactory(const GeometryFactory &gf);
    00122
    00129         static const GeometryFactory*
    00130         getDefaultInstance();
    00131
    00133         virtual ~GeometryFactory();
    00134
    00135 //Skipped a lot of list to array convertors
    00136
    00137         Point* createPointFromInternalCoord(const Coordinate* coord,
    00138                         const Geometry *exemplar) const;
    00139
    00141         //
    00144         Geometry* toGeometry(const Envelope* envelope) const;
    00145
    00149         const PrecisionModel* getPrecisionModel() const;
    00150
    00152         Point* createPoint() const;
    00153
    00155         Point* createPoint(const Coordinate& coordinate) const;
    00156
    00158         Point* createPoint(CoordinateSequence *coordinates) const;
    00159
    00161         Point* createPoint(const CoordinateSequence &coordinates) const;
    00162
    00164         GeometryCollection* createGeometryCollection() const;
    00165
    00167         Geometry* createEmptyGeometry() const;
    00168
    00170         GeometryCollection* createGeometryCollection(
    00171                         std::vector<Geometry *> *newGeoms) const;
    00172
    00174         GeometryCollection* createGeometryCollection(
    00175                         const std::vector<Geometry *> &newGeoms) const;
    00176
    00178         MultiLineString* createMultiLineString() const;
    00179
    00181         MultiLineString* createMultiLineString(
    00182                         std::vector<Geometry *> *newLines) const;
    00183
    00185         MultiLineString* createMultiLineString(
    00186                         const std::vector<Geometry *> &fromLines) const;
    00187
    00189         MultiPolygon* createMultiPolygon() const;
    00190
    00192         MultiPolygon* createMultiPolygon(std::vector<Geometry *> *newPolys) const;
    00193
    00195         MultiPolygon* createMultiPolygon(
    00196                         const std::vector<Geometry *> &fromPolys) const;
    00197
    00199         LinearRing* createLinearRing() const;
    00200
    00202         LinearRing* createLinearRing(CoordinateSequence* newCoords) const;
    00203
    00204         std::auto_ptr<Geometry> createLinearRing(
    00205                         std::auto_ptr<CoordinateSequence> newCoords) const;
    00206
    00208         LinearRing* createLinearRing(
    00209                         const CoordinateSequence& coordinates) const;
    00210
    00212         MultiPoint* createMultiPoint() const;
    00213
    00215         MultiPoint* createMultiPoint(std::vector<Geometry *> *newPoints) const;
    00216
    00218         MultiPoint* createMultiPoint(
    00219                         const std::vector<Geometry *> &fromPoints) const;
    00220
    00224         MultiPoint* createMultiPoint(
    00225                         const CoordinateSequence &fromCoords) const;
    00226
    00228         Polygon* createPolygon() const;
    00229
    00231         Polygon* createPolygon(LinearRing *shell,
    00232                         std::vector<Geometry *> *holes) const;
    00233
    00235         Polygon* createPolygon(const LinearRing &shell,
    00236                         const std::vector<Geometry *> &holes) const;
    00237
    00239         LineString* createLineString() const;
    00240
    00242         std::auto_ptr<LineString> createLineString(const LineString& ls) const;
    00243
    00245         LineString* createLineString(CoordinateSequence* coordinates) const;
    00246
    00247         std::auto_ptr<Geometry> createLineString(
    00248                         std::auto_ptr<CoordinateSequence> coordinates) const;
    00249
    00251         LineString* createLineString(
    00252                         const CoordinateSequence& coordinates) const;
    00253
    00285         Geometry* buildGeometry(std::vector<Geometry *> *geoms) const;
    00286
    00294         Geometry* buildGeometry(const std::vector<Geometry *> &geoms) const;
    00295
    00296         int getSRID() const;
    00297
    00301         const CoordinateSequenceFactory* getCoordinateSequenceFactory() const;
    00302
    00304         Geometry* createGeometry(const Geometry *g) const;
    00305
    00307         void destroyGeometry(Geometry *g) const;
    00308
    00309 private:
    00310         const PrecisionModel* precisionModel;
    00311         int SRID;
    00312         const CoordinateSequenceFactory *coordinateListFactory;
    00313 };
    00314
    00315 } // namespace geos::geom
    00316 } // namespace geos
    00317
    00318 #ifdef GEOS_INLINE
    00319 # include "geos/geom/GeometryFactory.inl"
    00320 #endif
    00321
    00322 #endif // ndef GEOS_GEOM_GEOMETRYFACTORY_H
    00323
    00324 /**********************************************************************
    00325  * $Log$
    00326  * Revision 1.11  2006/07/08 00:33:55  strk
    00327  *         * configure.in: incremented CAPI minor version, to avoid                        falling behind any future version from the 2.2. branch.
    00328  *         * source/geom/Geometry.cpp, source/geom/GeometryFactory.cpp,
    00329  *         source/geomgraph/EdgeRing.cpp,
    00330  *         source/headers/geos/geom/Geometry.h,
    00331  *         source/headers/geos/geom/GeometryFactory.h,
    00332  *         source/headers/geos/geom/GeometryFactory.inl,
    00333  *         source/headers/geos/geomgraph/EdgeRing.h:
    00334  *         updated doxygen comments (sync with JTS head).
    00335  *         * source/headers/geos/platform.h.in: include <inttypes.h>
    00336  *         rather then <stdint.h>
    00337  *
    00338  * Revision 1.10  2006/06/19 21:17:24  strk
    00339  * port info and doxygen dox.
    00340  *
    00341  * Revision 1.9  2006/04/28 11:56:52  strk
    00342  * * source/geom/GeometryFactory.cpp, source/headers/geos/geom/GeometryFactory.h: added LineString copy constructor.
    00343  * * source/geom/Polygon.cpp: fixed getBoundary method to always return a geometry composed by LineStrings (not LinearRings)
    00344  *
    00345  * Revision 1.8  2006/04/12 11:39:34  strk
    00346  * Removed Geometry.h and CoordinateSequence.h includes.
    00347  * The former created a circular dependency.
    00348  *
    00349  * Revision 1.7  2006/04/11 11:16:25  strk
    00350  * Added LineString and LinearRing constructors by auto_ptr
    00351  *
    00352  * Revision 1.6  2006/04/10 13:09:49  strk
    00353  * Added GeometryFactory::defaultInstance()
    00354  * Made Geometry::INTERNAL_GEOMETRY_FACTORY an alias for it
    00355  * removed last deletion from Unload::Release class
    00356  *
    00357  * Revision 1.5  2006/03/31 17:51:26  strk
    00358  * A few assertion checking, comments cleanup, use of initialization lists
    00359  * in constructors, handled NULL parameters.
    00360  *
    00361  * Revision 1.4  2006/03/28 16:33:14  strk
    00362  * Added note about args responsibility in GeometryFactory constructor
    00363  *
    00364  * Revision 1.3  2006/03/24 09:52:41  strk
    00365  * USE_INLINE => GEOS_INLINE
    00366  *
    00367  * Revision 1.2  2006/03/20 17:27:03  strk
    00368  * Bug #72 - Missing <vector> header
    00369  *
    00370  * Revision 1.1  2006/03/09 16:46:49  strk
    00371  * geos::geom namespace definition, first pass at headers split
    00372  *
    00373  **********************************************************************/
    00374