GEOS 3.11.1
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;
37class CoordinateArraySequence;
38}
39}
40
41namespace geos {
42namespace 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
50class GEOS_DLL MultiLineString: public GeometryCollection {
51
52public:
53
54 friend class GeometryFactory;
55
56 ~MultiLineString() override = default;
57
60
62 return d == Dimension::L;
63 }
64
70 int getBoundaryDimension() const override;
71
73 std::unique_ptr<Geometry> getBoundary() const override;
74
75 const LineString* getGeometryN(std::size_t n) const override;
76
77 std::string getGeometryType() const override;
78
80
81 bool isClosed() const;
82
83 std::unique_ptr<MultiLineString> clone() const
84 {
85 return std::unique_ptr<MultiLineString>(cloneImpl());
86 };
87
97 std::unique_ptr<MultiLineString> reverse() const { return std::unique_ptr<MultiLineString>(reverseImpl()); }
98
99protected:
100
118 MultiLineString(std::vector<Geometry*>* newLines,
119 const GeometryFactory* newFactory);
120
121 MultiLineString(std::vector<std::unique_ptr<LineString>> && newLines,
122 const GeometryFactory& newFactory);
123
124 MultiLineString(std::vector<std::unique_ptr<Geometry>> && newLines,
125 const GeometryFactory& newFactory);
126
129 {};
130
131 MultiLineString* cloneImpl() const override { return new MultiLineString(*this); }
132
133 MultiLineString* reverseImpl() const override;
134
135 int
136 getSortIndex() const override
137 {
138 return SORTINDEX_MULTILINESTRING;
139 };
140
141};
142
143
144} // namespace geos::geom
145} // namespace geos
146
147
148#ifdef _MSC_VER
149#pragma warning(pop)
150#endif
151
152
153
154
155
DimensionType
Definition: Dimension.h:29
@ L
Dimension value of a curve (1).
Definition: Dimension.h:43
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: LineString.h:66
Models a collection of LineStrings.
Definition: MultiLineString.h:50
bool isDimensionStrict(Dimension::DimensionType d) const override
Checks whether this Geometry consists only of components having dimension d.
Definition: MultiLineString.h:61
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:131
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:97
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.
MultiLineString(std::vector< Geometry * > *newLines, const GeometryFactory *newFactory)
Constructs a MultiLineString.
GeometryTypeId
Geometry types.
Definition: Geometry.h:73
Basic namespace for all GEOS functionalities.
Definition: geos.h:39