GEOS 3.11.1
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#include <geos/geom/MultiPolygon.h>
30#include <geos/geom/GeometryCollection.h>
31
32
33// Forward declarations
34namespace geos {
35namespace geom { // geos::geom
36class Coordinate;
37class CoordinateArraySequence;
38class MultiPoint;
39}
40}
41
42
43namespace geos {
44namespace geom { // geos::geom
45
46#ifdef _MSC_VER
47#pragma warning(push)
48#pragma warning(disable:4250) // T1 inherits T2 via dominance
49#endif
50
59class GEOS_DLL MultiPolygon: public GeometryCollection {
60public:
61
62 friend class GeometryFactory;
63
64 ~MultiPolygon() override;
65
68
70 return d == Dimension::A;
71 }
72
74 int getBoundaryDimension() const override;
75
82 std::unique_ptr<Geometry> getBoundary() const override;
83
84 const Polygon* getGeometryN(std::size_t n) const override;
85
86 std::string getGeometryType() const override;
87
89
90 std::unique_ptr<MultiPolygon> clone() const
91 {
92 return std::unique_ptr<MultiPolygon>(cloneImpl());
93 };
94
95 std::unique_ptr<MultiPolygon> reverse() const { return std::unique_ptr<MultiPolygon>(reverseImpl()); }
96
97protected:
98
120 MultiPolygon(std::vector<Geometry*>* newPolys, const GeometryFactory* newFactory);
121
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)
130 {};
131
132 MultiPolygon* cloneImpl() const override { return new MultiPolygon(*this); }
133
134 MultiPolygon* reverseImpl() const override;
135
136 int
137 getSortIndex() const override
138 {
139 return SORTINDEX_MULTIPOLYGON;
140 };
141
142};
143
144#ifdef _MSC_VER
145#pragma warning(pop)
146#endif
147
148} // namespace geos::geom
149} // namespace geos
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:52
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Definition: MultiPolygon.h:59
std::unique_ptr< Geometry > getBoundary() const override
Computes the boundary of this geometry.
int getBoundaryDimension() const override
Returns 1 (MultiPolygon boundary is MultiLineString)
MultiPolygon(std::vector< Geometry * > *newPolys, const GeometryFactory *newFactory)
Construct a MultiPolygon.
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.
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:69
MultiPolygon * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition: MultiPolygon.h:132
Represents a linear polygon, which may include holes.
Definition: Polygon.h:61
GeometryTypeId
Geometry types.
Definition: Geometry.h:73
Basic namespace for all GEOS functionalities.
Definition: geos.h:39