GEOS 3.9.1
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.
12 * See the COPYING file for more information.
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
36namespace geos {
37namespace geom {
38class Coordinate;
39class Envelope;
40class Polygon;
41class GeometryFactory;
42class PrecisionModel;
43class LineString;
44}
45}
46
47namespace geos {
48namespace util { // geos::util
49
50
67class GEOS_DLL GeometricShapeFactory {
68protected:
69 class Dimensions {
70 public:
71 Dimensions();
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 uint32_t nPts;
89
90 geom::Coordinate coord(double x, double y) const;
91
92public:
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(uint32_t 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
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:68
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
Computes various kinds of common geometric shapes.
Definition GeometricShapeFactory.h:67
std::unique_ptr< geom::Polygon > createRectangle()
Creates a rectangular Polygon.
void setHeight(double height)
Sets the height of the shape.
void setNumPoints(uint32_t nNPts)
Sets the total number of points in the created Geometry.
GeometricShapeFactory(const geom::GeometryFactory *factory)
Create a shape factory which will create shapes using the given GeometryFactory.
std::unique_ptr< geom::Polygon > createCircle()
Creates a circular Polygon.
void setBase(const geom::Coordinate &base)
Sets the location of the shape by specifying the base coordinate (which in most cases is the * lower ...
std::unique_ptr< geom::Polygon > createArcPolygon(double startAng, double angExt)
Creates an elliptical arc polygon.
void setWidth(double width)
Sets the width of the shape.
void setCentre(const geom::Coordinate &centre)
Sets the location of the shape by specifying the centre of the shape's bounding box.
std::unique_ptr< geom::LineString > createArc(double startAng, double angExtent)
Creates an elliptical arc, as a LineString.
void setSize(double size)
Sets the size of the extent of the shape in both x and y directions.
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26