GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2001-2002 Vivid Solutions Inc. 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: util/GeometricShapeFactory.java rev 1.14 (JTS-1.10+) 00017 * (2009-03-19) 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_UTIL_GEOMETRICSHAPEFACTORY_H 00022 #define GEOS_UTIL_GEOMETRICSHAPEFACTORY_H 00023 00024 #include <geos/export.h> 00025 #include <cassert> 00026 00027 #include <geos/geom/Coordinate.h> 00028 00029 #ifdef _MSC_VER 00030 #pragma warning(push) 00031 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00032 #endif 00033 00034 // Forward declarations 00035 namespace geos { 00036 namespace geom { 00037 class Coordinate; 00038 class Envelope; 00039 class Polygon; 00040 class GeometryFactory; 00041 class PrecisionModel; 00042 class LineString; 00043 } 00044 } 00045 00046 namespace geos { 00047 namespace util { // geos::util 00048 00049 00066 class GEOS_DLL GeometricShapeFactory { 00067 protected: 00068 class Dimensions { 00069 public: 00070 Dimensions(); 00071 geom::Coordinate base; 00072 geom::Coordinate centre; 00073 double width; 00074 double height; 00075 void setBase(const geom::Coordinate& newBase); 00076 void setCentre(const geom::Coordinate& newCentre); 00077 void setSize(double size); 00078 void setWidth(double nWidth); 00079 void setHeight(double nHeight); 00080 00081 // Return newly-allocated object, ownership transferred 00082 geom::Envelope* getEnvelope() const; 00083 }; 00084 const geom::GeometryFactory* geomFact; // externally owned 00085 const geom::PrecisionModel* precModel; // externally owned 00086 Dimensions dim; 00087 int nPts; 00088 00089 geom::Coordinate coord(double x, double y) const; 00090 00091 public: 00092 00103 GeometricShapeFactory(const geom::GeometryFactory *factory); 00104 00105 virtual ~GeometricShapeFactory() {} 00106 00116 geom::LineString* createArc(double startAng, double angExtent); 00117 00129 geom::Polygon* createArcPolygon(double startAng, double angExt); 00130 00136 geom::Polygon* createCircle(); 00137 00143 geom::Polygon* createRectangle(); 00144 00153 void setBase(const geom::Coordinate& base); 00154 00162 void setCentre(const geom::Coordinate& centre); 00163 00169 void setHeight(double height); 00170 00174 void setNumPoints(int nNPts); 00175 00182 void setSize(double size); 00183 00189 void setWidth(double width); 00190 00191 }; 00192 00193 } // namespace geos::util 00194 } // namespace geos 00195 00196 #ifdef _MSC_VER 00197 #pragma warning(pop) 00198 #endif 00199 00200 #endif // GEOS_UTIL_GEOMETRICSHAPEFACTORY_H