GEOS
3.3.6
|
00001 /********************************************************************** 00002 * $Id: GeometricShapeFactory.h 3313 2011-04-28 10:04:27Z 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 #ifdef _MSC_VER 00031 #pragma warning(push) 00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00033 #endif 00034 00035 // Forward declarations 00036 namespace geos { 00037 namespace geom { 00038 class Coordinate; 00039 class Envelope; 00040 class Polygon; 00041 class GeometryFactory; 00042 class PrecisionModel; 00043 class LineString; 00044 } 00045 } 00046 00047 namespace geos { 00048 namespace util { // geos::util 00049 00050 00067 class GEOS_DLL GeometricShapeFactory { 00068 protected: 00069 class Dimensions { 00070 public: 00071 Dimensions(); 00072 geom::Coordinate base; 00073 geom::Coordinate centre; 00074 double width; 00075 double height; 00076 void setBase(const geom::Coordinate& newBase); 00077 void setCentre(const geom::Coordinate& newCentre); 00078 void setSize(double size); 00079 void setWidth(double nWidth); 00080 void setHeight(double nHeight); 00081 00082 // Return newly-allocated object, ownership transferred 00083 geom::Envelope* getEnvelope() const; 00084 }; 00085 const geom::GeometryFactory* geomFact; // externally owned 00086 const geom::PrecisionModel* precModel; // externally owned 00087 Dimensions dim; 00088 int nPts; 00089 00090 geom::Coordinate coord(double x, double y) const; 00091 00092 public: 00093 00104 GeometricShapeFactory(const geom::GeometryFactory *factory); 00105 00106 virtual ~GeometricShapeFactory() {} 00107 00117 geom::LineString* createArc(double startAng, double angExtent); 00118 00130 geom::Polygon* createArcPolygon(double startAng, double angExt); 00131 00137 geom::Polygon* createCircle(); 00138 00144 geom::Polygon* createRectangle(); 00145 00154 void setBase(const geom::Coordinate& base); 00155 00163 void setCentre(const geom::Coordinate& centre); 00164 00170 void setHeight(double height); 00171 00175 void setNumPoints(int nNPts); 00176 00183 void setSize(double size); 00184 00190 void setWidth(double width); 00191 00192 }; 00193 00194 } // namespace geos::util 00195 } // namespace geos 00196 00197 #ifdef _MSC_VER 00198 #pragma warning(pop) 00199 #endif 00200 00201 #endif // GEOS_UTIL_GEOMETRICSHAPEFACTORY_H 00202 00203 /********************************************************************** 00204 * $Log$ 00205 * Revision 1.1 2006/03/09 16:46:49 strk 00206 * geos::geom namespace definition, first pass at headers split 00207 * 00208 **********************************************************************/