GEOS 3.15.0dev
GeometricShapeBuilder.h
1/**********************************************************************
2*
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2016 Martin Davis
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: shape/GeometricShapeBuilder.java c2e8e1d069
16 *
17 **********************************************************************/
18
19#pragma once
20
21#include <geos/export.h>
22
23#include <geos/geom/Coordinate.h>
24#include <geos/geom/Envelope.h>
25#include <geos/geom/GeometryFactory.h>
26#include <geos/geom/LineSegment.h>
27
28#include <cstddef>
29#include <memory>
30
31namespace geos {
32namespace shape {
33
34class GEOS_DLL GeometricShapeBuilder {
35public:
36 GeometricShapeBuilder();
37 explicit GeometricShapeBuilder(const geom::GeometryFactory* gf);
38
39 virtual ~GeometricShapeBuilder() = default;
40
46 void setExtent(const geom::Envelope& env);
47
53 const geom::Envelope& getExtent() const;
54
55 geom::CoordinateXY getCentre() const;
56
57 double getDiameter() const;
58
59 double getRadius() const;
60
61 geom::LineSegment getSquareBaseLine() const;
62
63 geom::Envelope getSquareExtent() const;
64
70 void setNumPoints(std::size_t n);
71
72 virtual std::unique_ptr<geom::Geometry> getGeometry() = 0;
73
74protected:
75 geom::CoordinateXY createCoord(double x, double y) const;
76
77 const geom::GeometryFactory* geometryFactory;
78 geom::Envelope extent;
79 std::size_t numPts;
80};
81
82} // namespace shape
83} // namespace geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38