GEOS 3.10.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#ifndef GEOS_GEOS_MULTIPOLYGON_H
22#define GEOS_GEOS_MULTIPOLYGON_H
23
24#include <geos/export.h>
25#include <string>
26#include <vector>
27#include <geos/geom/GeometryCollection.h> // for inheritance
28#include <geos/geom/Polygon.h> // for inheritance
29#include <geos/geom/Dimension.h> // for Dimension::DimensionType
30
31#include <geos/inline.h>
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 std::unique_ptr<MultiPolygon> reverse() const { return std::unique_ptr<MultiPolygon>(reverseImpl()); }
93
94protected:
95
117 MultiPolygon(std::vector<Geometry*>* newPolys, const GeometryFactory* newFactory);
118
119 MultiPolygon(std::vector<std::unique_ptr<Polygon>> && newPolys,
120 const GeometryFactory& newFactory);
121
122 MultiPolygon(std::vector<std::unique_ptr<Geometry>> && newPolys,
123 const GeometryFactory& newFactory);
124
125 MultiPolygon(const MultiPolygon& mp);
126
127 MultiPolygon* cloneImpl() const override { return new MultiPolygon(*this); }
128
129 MultiPolygon* reverseImpl() const override;
130
131 int
132 getSortIndex() const override
133 {
134 return SORTINDEX_MULTIPOLYGON;
135 };
136
137};
138
139#ifdef _MSC_VER
140#pragma warning(pop)
141#endif
142
143} // namespace geos::geom
144} // namespace geos
145
146#ifdef GEOS_INLINE
147# include "geos/geom/MultiPolygon.inl"
148#endif
149
150#endif // ndef GEOS_GEOS_MULTIPOLYGON_H
DimensionType
Definition: Dimension.h:31
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
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:127
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
GeometryTypeId
Geometry types.
Definition: Geometry.h:75
Basic namespace for all GEOS functionalities.
Definition: geos.h:40