GEOS  3.14.0dev
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 #pragma once
22 
23 #include <geos/export.h>
24 #include <geos/geom/GeometryCollection.h> // for inheritance
25 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
26 #include <geos/geom/Point.h> // for covariant return type
27 
28 #include <string>
29 #include <vector>
30 
31 namespace geos {
32 namespace geom { // geos::geom
33 class Coordinate;
34 }
35 }
36 
37 namespace geos {
38 namespace geom { // geos::geom
39 
40 #ifdef _MSC_VER
41 #pragma warning(push)
42 #pragma warning(disable:4250) // T1 inherits T2 via dominance
43 #endif
44 
50 class GEOS_DLL MultiPoint: public GeometryCollection {
51 
52 public:
53 
54  friend class GeometryFactory;
55 
56  ~MultiPoint() override = default;
57 
60 
62  return d == Dimension::P;
63  }
64 
65  bool hasDimension(Dimension::DimensionType d) const override {
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<std::unique_ptr<Point>> && newPoints, const GeometryFactory& newFactory);
120 
121  MultiPoint(std::vector<std::unique_ptr<Geometry>> && newPoints, const GeometryFactory& newFactory);
122 
123  MultiPoint(const MultiPoint& mp): GeometryCollection(mp) {}
124 
125  MultiPoint* cloneImpl() const override { return new MultiPoint(*this); }
126 
127  MultiPoint* reverseImpl() const override { return new MultiPoint(*this); }
128 
129  const CoordinateXY* getCoordinateN(std::size_t n) const;
130 
131  int
132  getSortIndex() const override
133  {
134  return SORTINDEX_MULTIPOINT;
135  };
136 
137  bool hasCurvedComponents() const override
138  {
139  return false;
140  }
141 
142 };
143 
144 #ifdef _MSC_VER
145 #pragma warning(pop)
146 #endif
147 
148 } // namespace geos::geom
149 } // namespace geos
150 
DimensionType
Definition: Dimension.h:29
@ P
Dimension value of a point (0).
Definition: Dimension.h:40
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:51
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Definition: MultiPoint.h:50
bool hasCurvedComponents() const override
Returns whether the Geometry contains curved components.
Definition: MultiPoint.h:137
MultiPoint * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition: MultiPoint.h:125
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:61
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:127
bool hasDimension(Dimension::DimensionType d) const override
Checks whether any component of this geometry has dimension d.
Definition: MultiPoint.h:65
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.
MultiPoint(std::vector< std::unique_ptr< Point >> &&newPoints, const GeometryFactory &newFactory)
Constructs a MultiPoint.
Definition: Point.h:61
GeometryTypeId
Geometry types.
Definition: Geometry.h:74
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25