geos::util::GeometricShapeFactory Class Reference

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

`#include <GeometricShapeFactory.h>`

Inheritance diagram for geos::util::GeometricShapeFactory:

## Public Member Functions

| GeometricShapeFactory (const geom::GeometryFactory *factory)
| Create a shape factory which will create shapes using the given GeometryFactory.
std::unique_ptr< geom::LineString > | createArc (double startAng, double angExtent)
| Creates an elliptical arc, as a LineString.
std::unique_ptr< geom::Polygon > | createArcPolygon (double startAng, double angExt)
| Creates an elliptical arc polygon.
std::unique_ptr< geom::Polygon > | createCircle ()
| Creates a circular Polygon.
std::unique_ptr< geom::Polygon > | createRectangle ()
| Creates a rectangular Polygon.
void | setBase (const geom::CoordinateXY &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).
void | setCentre (const geom::CoordinateXY &centre)
| Sets the location of the shape by specifying the centre of the shape's bounding box.
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.
void | setSize (double size)
| Sets the size of the extent of the shape in both x and y directions.
void | setWidth (double width)
| Sets the width of the shape.

## Protected Member Functions

geom::CoordinateXY | coord (double x, double y) const

## Protected Attributes

const geom::GeometryFactory * | geomFact
const geom::PrecisionModel * | precModel
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() );

## Constructor & Destructor Documentation

## GeometricShapeFactory()

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

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

Parameters

  factory | the factory to use. You need to keep the factory alive for the whole GeometricShapeFactory life time.

References GeometricShapeFactory().

Referenced by GeometricShapeFactory(), and geos::geom::util::SineStarFactory::SineStarFactory().

## Member Function Documentation

## createArc()

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

  startAng | start angle in radians
  angExtent | size of angle in radians

Returns
  an elliptical arc

## createArcPolygon()

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

  startAng | start angle in radians
  angExt | size of angle in radians

Returns
  an elliptical arc polygon

## createCircle()

std::unique_ptr< geom::Polygon > geos::util::GeometricShapeFactory::createCircle | ( |  | ) |

Creates a circular Polygon.

Returns
  a circle

## createRectangle()

std::unique_ptr< geom::Polygon > geos::util::GeometricShapeFactory::createRectangle | ( |  | ) |

Creates a rectangular Polygon.

Returns
  a rectangular Polygon

## setBase()

void geos::util::GeometricShapeFactory::setBase | ( | const geom::CoordinateXY & | 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

  base | the base coordinate of the shape

## setCentre()

void geos::util::GeometricShapeFactory::setCentre | ( | const geom::CoordinateXY & | centre | ) |

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

Parameters

  centre | the centre coordinate of the shape

## setHeight()

void geos::util::GeometricShapeFactory::setHeight | ( | double | height | ) |

Sets the height of the shape.

Parameters

  height | the height of the shape

## setSize()

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

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

Parameters

  size | the size of the shape's extent

## setWidth()

void geos::util::GeometricShapeFactory::setWidth | ( | double | width | ) |

Sets the width of the shape.

Parameters

  width | the width of the shape

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

- GeometricShapeFactory.h