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

# GeometryFactory.h

    00001 /**********************************************************************
    00002  * $Id: GeometryFactory.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) 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/inline.h>
    00026
    00027 #include <vector>
    00028 #include <memory>
    00029
    00030 namespace geos {
    00031         namespace geom {
    00032                 class CoordinateSequenceFactory;
    00033                 class Coordinate;
    00034                 class CoordinateSequence;
    00035                 class Envelope;
    00036                 class Geometry;
    00037                 class GeometryCollection;
    00038                 class LineString;
    00039                 class LinearRing;
    00040                 class MultiLineString;
    00041                 class MultiPoint;
    00042                 class MultiPolygon;
    00043                 class Point;
    00044                 class Polygon;
    00045                 class PrecisionModel;
    00046         }
    00047 }
    00048
    00049 namespace geos {
    00050 namespace geom { // geos::geom
    00051
    00062 class GeometryFactory {
    00063 public:
    00069         GeometryFactory();
    00070
    00083         GeometryFactory(const PrecisionModel *pm, int newSRID,
    00084                 CoordinateSequenceFactory *nCoordinateSequenceFactory);
    00085
    00092         GeometryFactory(CoordinateSequenceFactory *nCoordinateSequenceFactory);
    00093
    00102         GeometryFactory(const PrecisionModel *pm);
    00103
    00113         GeometryFactory(const PrecisionModel* pm, int newSRID);
    00114
    00120         GeometryFactory(const GeometryFactory &gf);
    00121
    00128         static const GeometryFactory*
    00129         getDefaultInstance();
    00130
    00132         virtual ~GeometryFactory();
    00133
    00134 //Skipped a lot of list to array convertors
    00135
    00136         Point* createPointFromInternalCoord(const Coordinate* coord,
    00137                         const Geometry *exemplar) const;
    00138
    00140         //
    00143         Geometry* toGeometry(const Envelope* envelope) const;
    00144
    00148         const PrecisionModel* getPrecisionModel() const;
    00149
    00151         Point* createPoint() const;
    00152
    00154         Point* createPoint(const Coordinate& coordinate) const;
    00155
    00157         Point* createPoint(CoordinateSequence *coordinates) const;
    00158
    00160         Point* createPoint(const CoordinateSequence &coordinates) const;
    00161
    00163         GeometryCollection* createGeometryCollection() const;
    00164
    00166         Geometry* createEmptyGeometry() const;
    00167
    00169         GeometryCollection* createGeometryCollection(
    00170                         std::vector<Geometry *> *newGeoms) const;
    00171
    00173         GeometryCollection* createGeometryCollection(
    00174                         const std::vector<Geometry *> &newGeoms) const;
    00175
    00177         MultiLineString* createMultiLineString() const;
    00178
    00180         MultiLineString* createMultiLineString(
    00181                         std::vector<Geometry *> *newLines) const;
    00182
    00184         MultiLineString* createMultiLineString(
    00185                         const std::vector<Geometry *> &fromLines) const;
    00186
    00188         MultiPolygon* createMultiPolygon() const;
    00189
    00191         MultiPolygon* createMultiPolygon(std::vector<Geometry *> *newPolys) const;
    00192
    00194         MultiPolygon* createMultiPolygon(
    00195                         const std::vector<Geometry *> &fromPolys) const;
    00196
    00198         LinearRing* createLinearRing() const;
    00199
    00201         LinearRing* createLinearRing(CoordinateSequence* newCoords) const;
    00202
    00203         std::auto_ptr<Geometry> createLinearRing(
    00204                         std::auto_ptr<CoordinateSequence> newCoords) const;
    00205
    00207         LinearRing* createLinearRing(
    00208                         const CoordinateSequence& coordinates) const;
    00209
    00211         MultiPoint* createMultiPoint() const;
    00212
    00214         MultiPoint* createMultiPoint(std::vector<Geometry *> *newPoints) const;
    00215
    00217         MultiPoint* createMultiPoint(
    00218                         const std::vector<Geometry *> &fromPoints) const;
    00219
    00223         MultiPoint* createMultiPoint(
    00224                         const CoordinateSequence &fromCoords) const;
    00225
    00227         Polygon* createPolygon() const;
    00228
    00230         Polygon* createPolygon(LinearRing *shell,
    00231                         std::vector<Geometry *> *holes) const;
    00232
    00234         Polygon* createPolygon(const LinearRing &shell,
    00235                         const std::vector<Geometry *> &holes) const;
    00236
    00238         LineString* createLineString() const;
    00239
    00241         std::auto_ptr<LineString> createLineString(const LineString& ls) const;
    00242
    00244         LineString* createLineString(CoordinateSequence* coordinates) const;
    00245
    00246         std::auto_ptr<Geometry> createLineString(
    00247                         std::auto_ptr<CoordinateSequence> coordinates) const;
    00248
    00250         LineString* createLineString(
    00251                         const CoordinateSequence& coordinates) const;
    00252
    00284         Geometry* buildGeometry(std::vector<Geometry *> *geoms) const;
    00285
    00293         Geometry* buildGeometry(const std::vector<Geometry *> &geoms) const;
    00294
    00295         int getSRID() const;
    00296
    00300         const CoordinateSequenceFactory* getCoordinateSequenceFactory() const;
    00301
    00303         Geometry* createGeometry(const Geometry *g) const;
    00304
    00306         void destroyGeometry(Geometry *g) const;
    00307
    00308 private:
    00309         const PrecisionModel* precisionModel;
    00310         int SRID;
    00311         const CoordinateSequenceFactory *coordinateListFactory;
    00312 };
    00313
    00314 } // namespace geos::geom
    00315 } // namespace geos
    00316
    00317 #ifdef GEOS_INLINE
    00318 # include "geos/geom/GeometryFactory.inl"
    00319 #endif
    00320
    00321 #endif // ndef GEOS_GEOM_GEOMETRYFACTORY_H
    00322
    00323 /**********************************************************************
    00324  * $Log$
    00325  * Revision 1.11  2006/07/08 00:33:55  strk
    00326  *         * configure.in: incremented CAPI minor version, to avoid                        falling behind any future version from the 2.2. branch.
    00327  *         * source/geom/Geometry.cpp, source/geom/GeometryFactory.cpp,
    00328  *         source/geomgraph/EdgeRing.cpp,
    00329  *         source/headers/geos/geom/Geometry.h,
    00330  *         source/headers/geos/geom/GeometryFactory.h,
    00331  *         source/headers/geos/geom/GeometryFactory.inl,
    00332  *         source/headers/geos/geomgraph/EdgeRing.h:
    00333  *         updated doxygen comments (sync with JTS head).
    00334  *         * source/headers/geos/platform.h.in: include <inttypes.h>
    00335  *         rather then <stdint.h>
    00336  *
    00337  * Revision 1.10  2006/06/19 21:17:24  strk
    00338  * port info and doxygen dox.
    00339  *
    00340  * Revision 1.9  2006/04/28 11:56:52  strk
    00341  * * source/geom/GeometryFactory.cpp, source/headers/geos/geom/GeometryFactory.h: added LineString copy constructor.
    00342  * * source/geom/Polygon.cpp: fixed getBoundary method to always return a geometry composed by LineStrings (not LinearRings)
    00343  *
    00344  * Revision 1.8  2006/04/12 11:39:34  strk
    00345  * Removed Geometry.h and CoordinateSequence.h includes.
    00346  * The former created a circular dependency.
    00347  *
    00348  * Revision 1.7  2006/04/11 11:16:25  strk
    00349  * Added LineString and LinearRing constructors by auto_ptr
    00350  *
    00351  * Revision 1.6  2006/04/10 13:09:49  strk
    00352  * Added GeometryFactory::defaultInstance()
    00353  * Made Geometry::INTERNAL_GEOMETRY_FACTORY an alias for it
    00354  * removed last deletion from Unload::Release class
    00355  *
    00356  * Revision 1.5  2006/03/31 17:51:26  strk
    00357  * A few assertion checking, comments cleanup, use of initialization lists
    00358  * in constructors, handled NULL parameters.
    00359  *
    00360  * Revision 1.4  2006/03/28 16:33:14  strk
    00361  * Added note about args responsibility in GeometryFactory constructor
    00362  *
    00363  * Revision 1.3  2006/03/24 09:52:41  strk
    00364  * USE_INLINE => GEOS_INLINE
    00365  *
    00366  * Revision 1.2  2006/03/20 17:27:03  strk
    00367  * Bug #72 - Missing <vector> header
    00368  *
    00369  * Revision 1.1  2006/03/09 16:46:49  strk
    00370  * geos::geom namespace definition, first pass at headers split
    00371  *
    00372  **********************************************************************/
    00373