GEOS  3.9.0dev
GeometricShapeFactory.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2001-2002 Vivid Solutions Inc.
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
13  *
14  **********************************************************************
15  *
16  * Last port: util/GeometricShapeFactory.java rev 1.14 (JTS-1.10+)
17  * (2009-03-19)
18  *
19  **********************************************************************/
20
21 #ifndef GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
22 #define GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
23
24 #include <geos/export.h>
25 #include <cassert>
26 #include <memory>
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  std::unique_ptr<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
103
104  virtual
106
116  std::unique_ptr<geom::LineString> createArc(double startAng, double angExtent);
117
129  std::unique_ptr<geom::Polygon> createArcPolygon(double startAng, double angExt);
130
136  std::unique_ptr<geom::Polygon> createCircle();
137
143  std::unique_ptr<geom::Polygon> createRectangle();
144
153  void setBase(const geom::Coordinate& base);
154
162  void setCentre(const geom::Coordinate& centre);
163
169  void setHeight(double height);
170
174  void setNumPoints(int nNPts);
175
182  void setSize(double size);
183
189  void setWidth(double width);
190
191 };
192
193 } // namespace geos::util
194 } // namespace geos
195
196 #ifdef _MSC_VER
197 #pragma warning(pop)
198 #endif
199
200 #endif // GEOS_UTIL_GEOMETRICSHAPEFACTORY_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Computes various kinds of common geometric shapes.
Definition: GeometricShapeFactory.h:67
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26