GEOS  3.14.0dev
GeometryMapper.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.ca>
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  * Last port: geom/util/GeometryMapper.java
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <memory>
22 #include <vector>
23 #include <functional>
24 
25 #include <geos/export.h>
26 
27 // Forward declarations
28 namespace geos {
29 namespace geom {
30 class Geometry;
31 class GeometryCollection;
32 class GeometryFactory;
33 }
34 }
35 
36 namespace geos {
37 namespace geom { // geos.geom
38 namespace util { // geos.geom.util
39 
40 
49 class GEOS_DLL GeometryMapper {
50 
51 public:
52 
58  typedef std::function<std::unique_ptr<Geometry>(const Geometry&)> mapOp;
59 
72  static std::unique_ptr<Geometry> map(
73  const Geometry& geom,
74  mapOp op);
75 
90  static std::unique_ptr<Geometry> flatMap(
91  const Geometry& geom,
92  int emptyDim,
93  mapOp op);
94 
95 
96 
97 private:
98 
99  static void flatMap(
100  const Geometry& geom,
101  mapOp op,
102  std::vector<std::unique_ptr<Geometry>>& mapped);
103 
104  static void addFlat(
105  std::unique_ptr<Geometry>& geom,
106  std::vector<std::unique_ptr<Geometry>>& geomList);
107 
108 
109 
110 };
111 
112 } // namespace geos.geom.util
113 } // namespace geos.geom
114 } // namespace geos
115 
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:197
Definition: GeometryMapper.h:49
std::function< std::unique_ptr< Geometry >const Geometry &)> mapOp
Definition: GeometryMapper.h:58
static std::unique_ptr< Geometry > flatMap(const Geometry &geom, int emptyDim, mapOp op)
static std::unique_ptr< Geometry > map(const Geometry &geom, mapOp op)
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25