GEOS  3.10.3
MultiPoint.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/MultiPoint.java r320 (JTS-1.12)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_GEOS_MULTIPOINT_H
22 #define GEOS_GEOS_MULTIPOINT_H
23 
24 #include <geos/export.h>
25 #include <geos/geom/GeometryCollection.h> // for inheritance
26 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
27 #include <geos/geom/Point.h> // for covariant return type
28 
29 #include <geos/inline.h>
30 
31 #include <string>
32 #include <vector>
33 
34 namespace geos {
35 namespace geom { // geos::geom
36 class Coordinate;
37 class CoordinateArraySequence;
38 }
39 }
40 
41 namespace geos {
42 namespace 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 
54 class GEOS_DLL MultiPoint: public GeometryCollection {
55 
56 public:
57 
58  friend class GeometryFactory;
59 
60  ~MultiPoint() override = default;
61 
64 
66  return d == Dimension::P;
67  }
68 
70  int getBoundaryDimension() const override;
71 
81  std::unique_ptr<Geometry> getBoundary() const override;
82 
83  const Point* getGeometryN(std::size_t n) const override;
84 
85  std::string getGeometryType() const override;
86 
88 
89  std::unique_ptr<MultiPoint> clone() const
90  {
91  return std::unique_ptr<MultiPoint>(cloneImpl());
92  }
93 
94  std::unique_ptr<MultiPoint> reverse() const
95  {
96  return std::unique_ptr<MultiPoint>(reverseImpl());
97  }
98 
99 protected:
100 
119  MultiPoint(std::vector<Geometry*>* newPoints, const GeometryFactory* newFactory);
120 
121  MultiPoint(std::vector<std::unique_ptr<Point>> && newPoints, const GeometryFactory& newFactory);
122 
123  MultiPoint(std::vector<std::unique_ptr<Geometry>> && newPoints, const GeometryFactory& newFactory);
124 
125  MultiPoint(const MultiPoint& mp): GeometryCollection(mp) {}
126 
127  MultiPoint* cloneImpl() const override { return new MultiPoint(*this); }
128 
129  MultiPoint* reverseImpl() const override { return new MultiPoint(*this); }
130 
131  const Coordinate* getCoordinateN(std::size_t n) const;
132 
133  int
134  getSortIndex() const override
135  {
136  return SORTINDEX_MULTIPOINT;
137  };
138 
139 };
140 
141 #ifdef _MSC_VER
142 #pragma warning(pop)
143 #endif
144 
145 } // namespace geos::geom
146 } // namespace geos
147 
148 #endif // ndef GEOS_GEOS_MULTIPOINT_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
DimensionType
Definition: Dimension.h:31
@ P
Dimension value of a point (0).
Definition: Dimension.h:42
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: MultiPoint.h:54
MultiPoint(std::vector< Geometry * > *newPoints, const GeometryFactory *newFactory)
Constructs a MultiPoint.
MultiPoint * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition: MultiPoint.h:127
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
std::unique_ptr< Geometry > getBoundary() const override
Gets the boundary of this geometry.
bool isDimensionStrict(Dimension::DimensionType d) const override
Checks whether this Geometry consists only of components having dimension d.
Definition: MultiPoint.h:65
std::string getGeometryType() const override
Return a string representation of this Geometry type.
MultiPoint * reverseImpl() const override
Make a geometry with coordinates in reverse order.
Definition: MultiPoint.h:129
Dimension::DimensionType getDimension() const override
Returns point dimension (0)
int getBoundaryDimension() const override
Returns Dimension::False (Point has no boundary)
const Point * getGeometryN(std::size_t n) const override
Returns a pointer to the nth Geometry in this collection.
Definition: Point.h:66
GeometryTypeId
Geometry types.
Definition: Geometry.h:75
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26