Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

GeometricShapeFactory.h

00001 /**********************************************************************
00002  * $Id: GeometricShapeFactory.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) 2001-2002 Vivid Solutions Inc.
00008  * Copyright (C) 2006 Refractions Research 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: util/GeometricShapeFactory.java rev 1.14 (JTS-1.10+)
00018  * (2009-03-19)
00019  *
00020  **********************************************************************/
00021 
00022 #ifndef GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
00023 #define GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
00024 
00025 #include <geos/export.h>
00026 #include <cassert>
00027 
00028 #include <geos/geom/Coordinate.h>
00029 
00030 // Forward declarations
00031 namespace geos {
00032         namespace geom { 
00033                 class Coordinate;
00034                 class Envelope;
00035                 class Polygon;
00036                 class GeometryFactory;
00037                 class PrecisionModel;
00038                 class LineString;
00039         }
00040 }
00041 
00042 namespace geos {
00043 namespace util { // geos::util
00044 
00045 
00062 class GEOS_DLL GeometricShapeFactory {
00063 protected:
00064         class Dimensions {
00065         public:
00066                 Dimensions();
00067                 geom::Coordinate base;
00068                 geom::Coordinate centre;
00069                 double width;
00070                 double height;
00071                 void setBase(const geom::Coordinate& newBase);
00072                 void setCentre(const geom::Coordinate& newCentre);
00073                 void setSize(double size);
00074                 void setWidth(double nWidth);
00075                 void setHeight(double nHeight);
00076 
00077                 // Return newly-allocated object, ownership transferred
00078                 geom::Envelope* getEnvelope();
00079         };
00080         const geom::GeometryFactory* geomFact; // externally owned
00081         const geom::PrecisionModel* precModel; // externally owned
00082         Dimensions dim;
00083         int nPts;
00084 
00085         geom::Coordinate createCoord(double x, double y) const;
00086 
00087 public:
00088 
00099         GeometricShapeFactory(const geom::GeometryFactory *factory);
00100 
00101         ~GeometricShapeFactory();
00102 
00112         geom::LineString* createArc(double startAng, double angExtent);
00113 
00125         geom::Polygon* createArcPolygon(double startAng, double angExt);
00126 
00132         geom::Polygon* createCircle();
00133 
00139         geom::Polygon* createRectangle();
00140 
00149         void setBase(const geom::Coordinate& base);
00150 
00158         void setCentre(const geom::Coordinate& centre);
00159 
00165         void setHeight(double height);
00166 
00170         void setNumPoints(int nNPts);
00171 
00178         void setSize(double size);
00179 
00185         void setWidth(double width);
00186 
00187 };
00188 
00189 } // namespace geos::util
00190 } // namespace geos
00191 
00192 #endif // GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
00193 
00194 /**********************************************************************
00195  * $Log$
00196  * Revision 1.1  2006/03/09 16:46:49  strk
00197  * geos::geom namespace definition, first pass at headers split
00198  *
00199  **********************************************************************/

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4