GEOS  3.11.0rc0
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 class CoordinateArraySequence;
35 }
36 }
37 
38 namespace geos {
39 namespace geom { // geos::geom
40 
41 #ifdef _MSC_VER
42 #pragma warning(push)
43 #pragma warning(disable:4250) // T1 inherits T2 via dominance
44 #endif
45 
51 class GEOS_DLL MultiPoint: public GeometryCollection {
52 
53 public:
54 
55  friend class GeometryFactory;
56 
57  ~MultiPoint() override = default;
58 
61 
63  return d == Dimension::P;
64  }
65 
67  int getBoundaryDimension() const override;
68 
78  std::unique_ptr<Geometry> getBoundary() const override;
79 
80  const Point* getGeometryN(std::size_t n) const override;
81 
82  std::string getGeometryType() const override;
83 
85 
86  std::unique_ptr<MultiPoint> clone() const
87  {
88  return std::unique_ptr<MultiPoint>(cloneImpl());
89  }
90 
91  std::unique_ptr<MultiPoint> reverse() const
92  {
93  return std::unique_ptr<MultiPoint>(reverseImpl());
94  }
95 
96 protected:
97 
116  MultiPoint(std::vector<Geometry*>* newPoints, const GeometryFactory* newFactory);
117 
118  MultiPoint(std::vector<std::unique_ptr<Point>> && newPoints, const GeometryFactory& newFactory);
119 
120  MultiPoint(std::vector<std::unique_ptr<Geometry>> && newPoints, const GeometryFactory& newFactory);
121 
122  MultiPoint(const MultiPoint& mp): GeometryCollection(mp) {}
123 
124  MultiPoint* cloneImpl() const override { return new MultiPoint(*this); }
125 
126  MultiPoint* reverseImpl() const override { return new MultiPoint(*this); }
127 
128  const Coordinate* getCoordinateN(std::size_t n) const;
129 
130  int
131  getSortIndex() const override
132  {
133  return SORTINDEX_MULTIPOINT;
134  };
135 
136 };
137 
138 #ifdef _MSC_VER
139 #pragma warning(pop)
140 #endif
141 
142 } // namespace geos::geom
143 } // namespace geos
144 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
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:52
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Definition: MultiPoint.h:51
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:124
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:62
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:126
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:63
GeometryTypeId
Geometry types.
Definition: Geometry.h:73
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25