/src/geos/src/geom/util/PolygonExtracter.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2001-2002 Vivid Solutions Inc. |
7 | | * Copyright (C) 2006 Refractions Research Inc. |
8 | | * |
9 | | * This is free software; you can redistribute and/or modify it under |
10 | | * the terms of the GNU Lesser General Public Licence as published |
11 | | * by the Free Software Foundation. |
12 | | * See the COPYING file for more information. |
13 | | * |
14 | | **********************************************************************/ |
15 | | |
16 | | |
17 | | #include <geos/export.h> |
18 | | #include <vector> |
19 | | |
20 | | #include <geos/geom/GeometryComponentFilter.h> |
21 | | #include <geos/geom/util/PolygonExtracter.h> |
22 | | |
23 | | namespace geos { |
24 | | namespace geom { // geos.geom |
25 | | namespace util { // geos.geom.util |
26 | | |
27 | | void |
28 | | PolygonExtracter::getPolygons(const Geometry& geom, std::vector<const Polygon*>& ret) |
29 | 0 | { |
30 | 0 | if (!geom.hasDimension(Dimension::A)) { |
31 | 0 | return; |
32 | 0 | } |
33 | | |
34 | 0 | PolygonExtracter pe(ret); |
35 | 0 | geom.apply_ro(&pe); |
36 | 0 | } |
37 | | |
38 | | PolygonExtracter::PolygonExtracter(std::vector<const Polygon*>& newComps) |
39 | | : |
40 | | comps(newComps) |
41 | 0 | {} |
42 | | |
43 | | void |
44 | | PolygonExtracter::filter_rw(Geometry* geom) |
45 | 0 | { |
46 | 0 | if(const Polygon* p = dynamic_cast<const Polygon*>(geom)) { |
47 | 0 | comps.push_back(p); |
48 | 0 | } |
49 | 0 | } |
50 | | |
51 | | void |
52 | | PolygonExtracter::filter_ro(const Geometry* geom) |
53 | 0 | { |
54 | 0 | if(const Polygon* p = dynamic_cast<const Polygon*>(geom)) { |
55 | 0 | comps.push_back(p); |
56 | 0 | } |
57 | 0 | } |
58 | | } |
59 | | } |
60 | | } |