GEOS 3.3.8

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

- File List

GeometricShapeFactory.h
1 /**********************************************************************
2 * $Id: GeometricShapeFactory.h 3313 2011-04-28 10:04:27Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * Copyright (C) 2006 Refractions Research Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: util/GeometricShapeFactory.java rev 1.14 (JTS-1.10+)
18 * (2009-03-19)
19 *
20 **********************************************************************/
21
22 #ifndef GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
23 #define GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
24
25 #include <geos/export.h>
26 #include <cassert>
27
28 #include <geos/geom/Coordinate.h>
29
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33 #endif
34
35 // Forward declarations
36 namespace geos {
37 namespace geom {
38 class Coordinate;
39 class Envelope;
40 class Polygon;
41 class GeometryFactory;
42 class PrecisionModel;
43 class LineString;
44 }
45 }
46
47 namespace geos {
48 namespace util { // geos::util
49
50
67 class GEOS_DLL GeometricShapeFactory {
68 protected:
69 class Dimensions {
70 public:
71 Dimensions();
72 geom::Coordinate base;
73 geom::Coordinate centre;
74 double width;
75 double height;
76 void setBase(const geom::Coordinate& newBase);
77 void setCentre(const geom::Coordinate& newCentre);
78 void setSize(double size);
79 void setWidth(double nWidth);
80 void setHeight(double nHeight);
81
82 // Return newly-allocated object, ownership transferred
83 geom::Envelope* getEnvelope() const;
84 };
85 const geom::GeometryFactory* geomFact; // externally owned
86 const geom::PrecisionModel* precModel; // externally owned
87 Dimensions dim;
88 int nPts;
89
90 geom::Coordinate coord(double x, double y) const;
91
92 public:
93
104 GeometricShapeFactory(const geom::GeometryFactory *factory);
105
106 virtual ~GeometricShapeFactory() {}
107
117 geom::LineString* createArc(double startAng, double angExtent);
118
130 geom::Polygon* createArcPolygon(double startAng, double angExt);
131
137 geom::Polygon* createCircle();
138
144 geom::Polygon* createRectangle();
145
154 void setBase(const geom::Coordinate& base);
155
163 void setCentre(const geom::Coordinate& centre);
164
170 void setHeight(double height);
171
175 void setNumPoints(int nNPts);
176
183 void setSize(double size);
184
190 void setWidth(double width);
191
192 };
193
194 } // namespace geos::util
195 } // namespace geos
196
197 #ifdef _MSC_VER
198 #pragma warning(pop)
199 #endif
200
201 #endif // GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
202
203 /**********************************************************************
204 * $Log$
205 * Revision 1.1 2006/03/09 16:46:49 strk
206 * geos::geom namespace definition, first pass at headers split
207 *
208 **********************************************************************/