GEOS 3.15.0beta1
MultiLineString.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/MultiLineString.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>
26#include <geos/geom/LineString.h>
27#include <geos/geom/MultiPoint.h>
28
29#include <string>
30#include <vector>
31
32
33// Forward declarations
34namespace geos {
35namespace geom { // geos::geom
36class Coordinate;
37}
38}
39
40namespace geos {
41namespace geom { // geos::geom
42
43#ifdef _MSC_VER
44#pragma warning(push)
45#pragma warning(disable:4250) // T1 inherits T2 via dominance
46#endif
47
49class GEOS_DLL MultiLineString: public GeometryCollection {
50
51public:
52
53 friend class GeometryFactory;
54
55 ~MultiLineString() override = default;
56
59
60 bool hasDimension(Dimension::DimensionType d) const override {
61 return d == Dimension::L;
62 }
63
65 return d == Dimension::L;
66 }
67
73 int getBoundaryDimension() const override;
74
76 std::unique_ptr<Geometry> getBoundary() const override;
77
78 const LineString* getGeometryN(std::size_t n) const override;
79
80 std::string getGeometryType() const override;
81
83
84 std::unique_ptr<MultiLineString> getLinearized(const algorithm::CurveToLineParams&) const {
85 return clone();
86 }
87
88 bool isClosed() const;
89
90 std::unique_ptr<MultiLineString> clone() const
91 {
92 return std::unique_ptr<MultiLineString>(cloneImpl());
93 };
94
104 std::unique_ptr<MultiLineString> reverse() const { return std::unique_ptr<MultiLineString>(reverseImpl()); }
105
106protected:
107
125 MultiLineString(std::vector<std::unique_ptr<LineString>> && newLines,
126 const GeometryFactory& newFactory);
127
128 MultiLineString(std::vector<std::unique_ptr<Geometry>> && newLines,
129 const GeometryFactory& newFactory);
130
131 MultiLineString(std::vector<std::unique_ptr<Curve>> && newLines,
132 const GeometryFactory& newFactory);
133
135 : GeometryCollection(mp)
136 {};
137
138 MultiLineString* cloneImpl() const override { return new MultiLineString(*this); }
139
140 MultiLineString* reverseImpl() const override;
141
142 GeometryCollection* getCurvedImpl(const algorithm::LineToCurveParams&) const override;
143
144 MultiLineString* getLinearizedImpl(const algorithm::CurveToLineParams&) const override;
145
146 int
147 getSortIndex() const override
148 {
149 return SORTINDEX_MULTILINESTRING;
150 };
151
152 bool hasCurvedComponents() const override
153 {
154 return false;
155 }
156
157};
158
159
160} // namespace geos::geom
161} // namespace geos
162
163
164#ifdef _MSC_VER
165#pragma warning(pop)
166#endif
167
168
169
170
171
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:220
DimensionType
Definition Dimension.h:29
@ L
Dimension value of a curve (1).
Definition Dimension.h:43
Definition LineString.h:66
MultiLineString(std::vector< std::unique_ptr< LineString > > &&newLines, const GeometryFactory &newFactory)
Constructs a MultiLineString.
bool hasDimension(Dimension::DimensionType d) const override
Checks whether any component of this geometry has dimension d.
Definition MultiLineString.h:60
bool isDimensionStrict(Dimension::DimensionType d) const override
Checks whether this Geometry consists only of components having dimension d.
Definition MultiLineString.h:64
Dimension::DimensionType getDimension() const override
Returns line dimension (1).
MultiLineString * reverseImpl() const override
Make a geometry with coordinates in reverse order.
const LineString * getGeometryN(std::size_t n) const override
Returns a pointer to the nth Geometry in this collection.
MultiLineString * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition MultiLineString.h:138
bool hasCurvedComponents() const override
Returns whether the Geometry contains curved components.
Definition MultiLineString.h:152
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
std::string getGeometryType() const override
Return a string representation of this Geometry type.
std::unique_ptr< MultiLineString > reverse() const
Definition MultiLineString.h:104
int getBoundaryDimension() const override
Returns Dimension::False if all LineStrings in the collection are closed, 0 otherwise.
std::unique_ptr< Geometry > getBoundary() const override
Returns a (possibly empty) MultiPoint.
Definition Angle.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:78
Basic namespace for all GEOS functionalities.
Definition geos.h:38