GEOS 3.14.0dev
CoordinateArrayFilter.h
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#pragma once
17
18#include <geos/export.h>
19#include <cassert>
20#include <set>
21#include <vector>
22
23#include <geos/geom/CoordinateFilter.h>
24#include <geos/geom/CoordinateSequence.h>
25#include <geos/geom/Coordinate.h>
26
27#ifdef _MSC_VER
28#pragma warning(push)
29#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
30#endif
31
32namespace geos {
33namespace util { // geos::util
34
35/*
36 * A CoordinateFilter that fills a vector of Coordinate const pointers.
37 */
38class GEOS_DLL CoordinateArrayFilter : public geom::CoordinateInspector<CoordinateArrayFilter> {
39public:
40
41 CoordinateArrayFilter(std::vector<const geom::Coordinate*>& target)
42 : pts(target)
43 {}
44
51 ~CoordinateArrayFilter() override {}
52
53 template<typename CoordType>
54 void filter(const CoordType* coord)
55 {
56 pts.push_back(coord);
57 }
58
59 void filter(const geom::CoordinateXY*) {
60 assert(0); // not supported
61 }
62
63 void filter(const geom::CoordinateXYM*) {
64 assert(0); // not supported
65 }
66
67private:
68 std::vector<const geom::Coordinate*>& pts; // target set reference
69
70 // Declare type as noncopyable
71 CoordinateArrayFilter(const CoordinateArrayFilter& other) = delete;
72 CoordinateArrayFilter& operator=(const CoordinateArrayFilter& rhs) = delete;
73};
74
75
76
77
78
79} // namespace geos::util
80} // namespace geos
81
82#ifdef _MSC_VER
83#pragma warning(pop)
84#endif
85
Basic namespace for all GEOS functionalities.
Definition geos.h:39