Coverage Report

Created: 2026-09-01 06:35

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/geos/include/geos/geom/MultiLineString.h
Line
Count
Source
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
34
namespace geos {
35
namespace geom { // geos::geom
36
class Coordinate;
37
}
38
}
39
40
namespace geos {
41
namespace 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
48
/// Models a collection of [LineStrings](@ref geom::LineString).
49
class GEOS_DLL MultiLineString: public GeometryCollection {
50
51
public:
52
53
    friend class GeometryFactory;
54
55
    ~MultiLineString() override = default;
56
57
    /// Returns line dimension (1)
58
    Dimension::DimensionType getDimension() const override;
59
60
0
    bool hasDimension(Dimension::DimensionType d) const override {
61
0
        return d == Dimension::L;
62
0
    }
63
64
0
    bool isDimensionStrict(Dimension::DimensionType d) const override {
65
0
        return d == Dimension::L;
66
0
    }
67
68
    /**
69
     * \brief
70
     * Returns Dimension::False if all [LineStrings](@ref geom::LineString) in the collection
71
     * are closed, 0 otherwise.
72
     */
73
    int getBoundaryDimension() const override;
74
75
    /// Returns a (possibly empty) [MultiPoint](@ref geom::MultiPoint)
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
82
    GeometryTypeId getGeometryTypeId() const override;
83
84
0
    std::unique_ptr<MultiLineString> getLinearized(const algorithm::CurveToLineParams&) const {
85
0
        return clone();
86
0
    }
87
88
    bool isClosed() const;
89
90
    std::unique_ptr<MultiLineString> clone() const
91
0
    {
92
0
        return std::unique_ptr<MultiLineString>(cloneImpl());
93
0
    };
94
95
    /**
96
     * Creates a MultiLineString in the reverse
97
     * order to this object.
98
     * Both the order of the component LineStrings
99
     * and the order of their coordinate sequences
100
     * are reversed.
101
     *
102
     * @return a MultiLineString in the reverse order
103
     */
104
0
    std::unique_ptr<MultiLineString> reverse() const { return std::unique_ptr<MultiLineString>(reverseImpl()); }
105
106
protected:
107
108
    /**
109
     * \brief Constructs a MultiLineString.
110
     *
111
     * @param  newLines The [LineStrings](@ref geom::LineString) for this
112
     *                  MultiLineString, or `null`
113
     *                  or an empty array to create the empty geometry.
114
     *                  Elements may be empty LineString,
115
     *                  but not `null`s.
116
     *
117
     * @param newFactory The GeometryFactory used to create this geometry.
118
     *                   Caller must keep the factory alive for the life-time
119
     *                   of the constructed MultiLineString.
120
     *
121
     * @note Constructed object will take ownership of
122
     *       the vector and its elements.
123
     *
124
     */
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
134
    MultiLineString(const MultiLineString& mp)
135
0
        : GeometryCollection(mp)
136
0
        {};
137
138
0
    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
0
    {
149
0
        return SORTINDEX_MULTILINESTRING;
150
0
    };
151
152
    bool hasCurvedComponents() const override
153
0
    {
154
0
        return false;
155
0
    }
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