/src/geos/src/geom/util/PointExtracter.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/PointExtracter.h> |
22 | | |
23 | | namespace geos { |
24 | | namespace geom { // geos.geom |
25 | | namespace util { // geos.geom.util |
26 | | |
27 | | |
28 | | void |
29 | | PointExtracter::getPoints(const Geometry& geom, Point::ConstVect& ret) |
30 | 0 | { |
31 | 0 | if (!geom.hasDimension(Dimension::P)) { |
32 | 0 | return; |
33 | 0 | } |
34 | | |
35 | 0 | PointExtracter pe(ret); |
36 | 0 | geom.apply_ro(&pe); |
37 | 0 | } |
38 | | |
39 | | /** |
40 | | * Constructs a PointExtracterFilter with a list in which |
41 | | * to store Points found. |
42 | | */ |
43 | | PointExtracter::PointExtracter(Point::ConstVect& newComps) |
44 | | : |
45 | 0 | comps(newComps) |
46 | 0 | {} |
47 | | |
48 | | void |
49 | | PointExtracter::filter_rw(Geometry* geom) |
50 | 0 | { |
51 | 0 | if (geom->getGeometryTypeId() == GEOS_POINT) { |
52 | 0 | comps.push_back(static_cast<const Point*>(geom)); |
53 | 0 | } |
54 | 0 | } |
55 | | |
56 | | void |
57 | | PointExtracter::filter_ro(const Geometry* geom) |
58 | 0 | { |
59 | 0 | if (geom->getGeometryTypeId() == GEOS_POINT) { |
60 | 0 | comps.push_back(static_cast<const Point*>(geom)); |
61 | 0 | } |
62 | 0 | } |
63 | | } |
64 | | } |
65 | | } |