GEOS  3.9.1dev
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
geos::util::GeometricShapeFactory Class Reference

Computes various kinds of common geometric shapes. More...

#include <GeometricShapeFactory.h>

Inheritance diagram for geos::util::GeometricShapeFactory:
[legend]
Collaboration diagram for geos::util::GeometricShapeFactory:
[legend]

Classes

class  Dimensions
 

Public Member Functions

 GeometricShapeFactory (const geom::GeometryFactory *factory)
 Create a shape factory which will create shapes using the given GeometryFactory. More...
 
virtual ~GeometricShapeFactory ()
 
std::unique_ptr< geom::LineStringcreateArc (double startAng, double angExtent)
 Creates an elliptical arc, as a LineString. More...
 
std::unique_ptr< geom::PolygoncreateArcPolygon (double startAng, double angExt)
 Creates an elliptical arc polygon. More...
 
std::unique_ptr< geom::PolygoncreateCircle ()
 Creates a circular Polygon. More...
 
std::unique_ptr< geom::PolygoncreateRectangle ()
 Creates a rectangular Polygon. More...
 
void setBase (const geom::Coordinate &base)
 Sets the location of the shape by specifying the base coordinate (which in most cases is the * lower left point of the envelope containing the shape). More...
 
void setCentre (const geom::Coordinate &centre)
 Sets the location of the shape by specifying the centre of the shape's bounding box. More...
 
void setHeight (double height)
 Sets the height of the shape. More...
 
void setNumPoints (uint32_t nNPts)
 Sets the total number of points in the created Geometry. More...
 
void setSize (double size)
 Sets the size of the extent of the shape in both x and y directions. More...
 
void setWidth (double width)
 Sets the width of the shape. More...
 

Protected Member Functions

geom::Coordinate coord (double x, double y) const
 

Protected Attributes

const geom::GeometryFactorygeomFact
 
const geom::PrecisionModelprecModel
 
Dimensions dim
 
uint32_t nPts
 

Detailed Description

Computes various kinds of common geometric shapes.

Allows various ways of specifying the location and extent of the shapes, as well as number of line segments used to form them.

Example:

 GeometricShapeFactory gsf(factory);
 gsf.setSize(100);
 gsf.setNumPoints(100);
 gsf.setBase(Coordinate(0, 0));
 std::unique_ptr<Polygon> rect ( gsf.createRectangle() );

Definition at line 67 of file GeometricShapeFactory.h.

Constructor & Destructor Documentation

geos::util::GeometricShapeFactory::GeometricShapeFactory ( const geom::GeometryFactory factory)

Create a shape factory which will create shapes using the given GeometryFactory.

Parameters
factorythe factory to use. You need to keep the factory alive for the whole GeometricShapeFactory life time.
virtual geos::util::GeometricShapeFactory::~GeometricShapeFactory ( )
inlinevirtual

Definition at line 105 of file GeometricShapeFactory.h.

Member Function Documentation

geom::Coordinate geos::util::GeometricShapeFactory::coord ( double  x,
double  y 
) const
protected
std::unique_ptr<geom::LineString> geos::util::GeometricShapeFactory::createArc ( double  startAng,
double  angExtent 
)

Creates an elliptical arc, as a LineString.

The arc is always created in a counter-clockwise direction.

Parameters
startAngstart angle in radians
angExtentsize of angle in radians
Returns
an elliptical arc
std::unique_ptr<geom::Polygon> geos::util::GeometricShapeFactory::createArcPolygon ( double  startAng,
double  angExt 
)

Creates an elliptical arc polygon.

The polygon is formed from the specified arc of an ellipse and the two radii connecting the endpoints to the centre of the ellipse.

Parameters
startAngstart angle in radians
angExtsize of angle in radians
Returns
an elliptical arc polygon
std::unique_ptr<geom::Polygon> geos::util::GeometricShapeFactory::createCircle ( )

Creates a circular Polygon.

Returns
a circle
std::unique_ptr<geom::Polygon> geos::util::GeometricShapeFactory::createRectangle ( )

Creates a rectangular Polygon.

Returns
a rectangular Polygon
void geos::util::GeometricShapeFactory::setBase ( const geom::Coordinate base)

Sets the location of the shape by specifying the base coordinate (which in most cases is the * lower left point of the envelope containing the shape).

Parameters
basethe base coordinate of the shape
void geos::util::GeometricShapeFactory::setCentre ( const geom::Coordinate centre)

Sets the location of the shape by specifying the centre of the shape's bounding box.

Parameters
centrethe centre coordinate of the shape
void geos::util::GeometricShapeFactory::setHeight ( double  height)

Sets the height of the shape.

Parameters
heightthe height of the shape
void geos::util::GeometricShapeFactory::setNumPoints ( uint32_t  nNPts)

Sets the total number of points in the created Geometry.

void geos::util::GeometricShapeFactory::setSize ( double  size)

Sets the size of the extent of the shape in both x and y directions.

Parameters
sizethe size of the shape's extent
void geos::util::GeometricShapeFactory::setWidth ( double  width)

Sets the width of the shape.

Parameters
widththe width of the shape

Member Data Documentation

Dimensions geos::util::GeometricShapeFactory::dim
protected

Definition at line 87 of file GeometricShapeFactory.h.

const geom::GeometryFactory* geos::util::GeometricShapeFactory::geomFact
protected

Definition at line 85 of file GeometricShapeFactory.h.

uint32_t geos::util::GeometricShapeFactory::nPts
protected

Definition at line 88 of file GeometricShapeFactory.h.

const geom::PrecisionModel* geos::util::GeometricShapeFactory::precModel
protected

Definition at line 86 of file GeometricShapeFactory.h.


The documentation for this class was generated from the following file: