GEOS  3.7.2
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 
27 #include <geos/geom/Coordinate.h>
28 
29 #ifdef _MSC_VER
30 #pragma warning(push)
31 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32 #endif
33 
34 // Forward declarations
35 namespace geos {
36  namespace geom {
37  class Coordinate;
38  class Envelope;
39  class Polygon;
40  class GeometryFactory;
41  class PrecisionModel;
42  class LineString;
43  }
44 }
45 
46 namespace geos {
47 namespace util { // geos::util
48 
49 
66 class GEOS_DLL GeometricShapeFactory {
67 protected:
68  class Dimensions {
69  public:
70  Dimensions();
71  geom::Coordinate base;
72  geom::Coordinate centre;
73  double width;
74  double height;
75  void setBase(const geom::Coordinate& newBase);
76  void setCentre(const geom::Coordinate& newCentre);
77  void setSize(double size);
78  void setWidth(double nWidth);
79  void setHeight(double nHeight);
80 
81  // Return newly-allocated object, ownership transferred
82  geom::Envelope* getEnvelope() const;
83  };
84  const geom::GeometryFactory* geomFact; // externally owned
85  const geom::PrecisionModel* precModel; // externally owned
86  Dimensions dim;
87  int nPts;
88 
89  geom::Coordinate coord(double x, double y) const;
90 
91 public:
92 
104 
105  virtual ~GeometricShapeFactory() {}
106 
116  geom::LineString* createArc(double startAng, double angExtent);
117 
129  geom::Polygon* createArcPolygon(double startAng, double angExt);
130 
137 
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
geos::util::GeometricShapeFactory::GeometricShapeFactory
GeometricShapeFactory(const geom::GeometryFactory *factory)
Create a shape factory which will create shapes using the given GeometryFactory.
geos::util::GeometricShapeFactory::setHeight
void setHeight(double height)
Sets the height of the shape.
geos::util::GeometricShapeFactory
Definition: GeometricShapeFactory.h:66
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
geos::util::GeometricShapeFactory::createCircle
geom::Polygon * createCircle()
Creates a circular Polygon.
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::util::GeometricShapeFactory::createArc
geom::LineString * createArc(double startAng, double angExtent)
Creates an elliptical arc, as a LineString.
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition: Polygon.h:67
geos::util::GeometricShapeFactory::setNumPoints
void setNumPoints(int nNPts)
Sets the total number of points in the created Geometry.
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::util::GeometricShapeFactory::setBase
void setBase(const geom::Coordinate &base)
Sets the location of the shape by specifying the base coordinate (which in most cases is the * lower ...
geos::util::GeometricShapeFactory::setWidth
void setWidth(double width)
Sets the width of the shape.
geos::util::GeometricShapeFactory::setSize
void setSize(double size)
Sets the size of the extent of the shape in both x and y directions.
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:59
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
geos::util::GeometricShapeFactory::setCentre
void setCentre(const geom::Coordinate &centre)
Sets the location of the shape by specifying the centre of the shape's bounding box.
geos::geom::LineString
Definition: LineString.h:70
geos::util::GeometricShapeFactory::createRectangle
geom::Polygon * createRectangle()
Creates a rectangular Polygon.
geos::util::GeometricShapeFactory::createArcPolygon
geom::Polygon * createArcPolygon(double startAng, double angExt)
Creates an elliptical arc polygon.