/src/geos/src/geom/util/LinealExtracter.cpp
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2026 ISciences LLC |
7 | | * |
8 | | * This is free software; you can redistribute and/or modify it under |
9 | | * the terms of the GNU Lesser General Public Licence as published |
10 | | * by the Free Software Foundation. |
11 | | * See the COPYING file for more information. |
12 | | * |
13 | | **********************************************************************/ |
14 | | |
15 | | #include <geos/geom/util/LinealExtracter.h> |
16 | | |
17 | | #include <geos/geom/LineString.h> |
18 | | #include <geos/geom/MultiCurve.h> |
19 | | #include <geos/geom/MultiLineString.h> |
20 | | |
21 | | #include <vector> |
22 | | |
23 | | |
24 | | namespace geos { |
25 | | namespace geom { // geos.geom |
26 | | namespace util { // geos.geom.util |
27 | | |
28 | | void |
29 | | LinealExtracter::getLineals(const Geometry& geom, std::vector<const Geometry*>& lineals) |
30 | 0 | { |
31 | 0 | getLineals(&geom, lineals); |
32 | 0 | } |
33 | | |
34 | | void |
35 | | LinealExtracter::getLineals(const Geometry* geom, std::vector<const Geometry*>& lineals) |
36 | 0 | { |
37 | 0 | if (dynamic_cast<const Curve*>(geom) != nullptr |
38 | 0 | || dynamic_cast<const MultiLineString*>(geom) != nullptr |
39 | 0 | || dynamic_cast<const MultiCurve*>(geom) != nullptr) { |
40 | 0 | lineals.push_back(geom); |
41 | 0 | } |
42 | 0 | else if (dynamic_cast<const GeometryCollection*>(geom) != nullptr) { |
43 | 0 | for (std::size_t i = 0; i < geom->getNumGeometries(); i++) { |
44 | 0 | getLineals(geom->getGeometryN(i), lineals); |
45 | 0 | } |
46 | 0 | } |
47 | 0 | } |
48 | | |
49 | | } |
50 | | } |
51 | | } |