GEOS 3.15.0beta1
MultiPolygon.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * Copyright (C) 2005 2006 Refractions Research Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: geom/MultiPolygon.java r320 (JTS-1.12)
18 *
19 **********************************************************************/
20
21#pragma once
22
23#include <geos/export.h>
24#include <string>
25#include <vector>
26#include <geos/geom/GeometryCollection.h> // for inheritance
27#include <geos/geom/Polygon.h> // for inheritance
28#include <geos/geom/Dimension.h> // for Dimension::DimensionType
29
30
31// Forward declarations
32namespace geos {
33namespace geom { // geos::geom
34class Coordinate;
35class MultiPoint;
36class Polygon;
37}
38}
39
40
41namespace geos {
42namespace geom { // geos::geom
43
44#ifdef _MSC_VER
45#pragma warning(push)
46#pragma warning(disable:4250) // T1 inherits T2 via dominance
47#endif
48
57class GEOS_DLL MultiPolygon: public GeometryCollection {
58public:
59
60 friend class GeometryFactory;
61
62 ~MultiPolygon() override;
63
66
67 bool hasDimension(Dimension::DimensionType d) const override {
68 return d == Dimension::A;
69 }
70
72 return d == Dimension::A;
73 }
74
76 int getBoundaryDimension() const override;
77
84 std::unique_ptr<Geometry> getBoundary() const override;
85
86 const Polygon* getGeometryN(std::size_t n) const override;
87
88 std::string getGeometryType() const override;
89
91
92 std::unique_ptr<MultiPolygon> clone() const
93 {
94 return std::unique_ptr<MultiPolygon>(cloneImpl());
95 };
96
97 std::unique_ptr<MultiPolygon> reverse() const { return std::unique_ptr<MultiPolygon>(reverseImpl()); }
98
99protected:
100
122 MultiPolygon(std::vector<std::unique_ptr<Polygon>> && newPolys,
123 const GeometryFactory& newFactory);
124
125 MultiPolygon(std::vector<std::unique_ptr<Geometry>> && newPolys,
126 const GeometryFactory& newFactory);
127
128 MultiPolygon(const MultiPolygon& mp)
129 : GeometryCollection(mp)
130 {};
131
132 MultiPolygon* cloneImpl() const override { return new MultiPolygon(*this); }
133
134 GeometryCollection* getCurvedImpl(const algorithm::LineToCurveParams&) const override;
135
136 MultiPolygon* getLinearizedImpl(const algorithm::CurveToLineParams&) const override { return cloneImpl(); }
137
138 MultiPolygon* reverseImpl() const override;
139
140 int
141 getSortIndex() const override
142 {
143 return SORTINDEX_MULTIPOLYGON;
144 };
145
146 bool hasCurvedComponents() const override
147 {
148 return false;
149 }
150
151};
152
153#ifdef _MSC_VER
154#pragma warning(pop)
155#endif
156
157} // namespace geos::geom
158} // namespace geos
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:220
DimensionType
Definition Dimension.h:29
@ A
Dimension value of a surface (2).
Definition Dimension.h:46
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:51
Definition MultiPoint.h:50
Definition MultiPolygon.h:57
MultiPolygon(std::vector< std::unique_ptr< Polygon > > &&newPolys, const GeometryFactory &newFactory)
Construct a MultiPolygon.
std::unique_ptr< Geometry > getBoundary() const override
Computes the boundary of this geometry.
int getBoundaryDimension() const override
Returns 1 (MultiPolygon boundary is MultiLineString).
Dimension::DimensionType getDimension() const override
Returns surface dimension (2).
std::string getGeometryType() const override
Return a string representation of this Geometry type.
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
const Polygon * getGeometryN(std::size_t n) const override
Returns a pointer to the nth Geometry in this collection.
bool hasCurvedComponents() const override
Returns whether the Geometry contains curved components.
Definition MultiPolygon.h:146
MultiPolygon * reverseImpl() const override
Make a geometry with coordinates in reverse order.
bool isDimensionStrict(Dimension::DimensionType d) const override
Checks whether this Geometry consists only of components having dimension d.
Definition MultiPolygon.h:71
MultiPolygon * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition MultiPolygon.h:132
bool hasDimension(Dimension::DimensionType d) const override
Checks whether any component of this geometry has dimension d.
Definition MultiPolygon.h:67
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
Definition Angle.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:78
Basic namespace for all GEOS functionalities.
Definition geos.h:38