/src/geos/capi/geos_ts_c.cpp
Line | Count | Source |
1 | | /************************************************************************ |
2 | | * |
3 | | * |
4 | | * C-Wrapper for GEOS library |
5 | | * |
6 | | * Copyright (C) 2005-2006 Refractions Research Inc. |
7 | | * Copyright (C) 2010-2012 Sandro Santilli <strk@kbt.io> |
8 | | * Copyright (C) 2016-2021 Daniel Baston <dbaston@gmail.com> |
9 | | * |
10 | | * This is free software; you can redistribute and/or modify it under |
11 | | * the terms of the GNU Lesser General Public Licence as published |
12 | | * by the Free Software Foundation. |
13 | | * See the COPYING file for more information. |
14 | | * |
15 | | * Author: Sandro Santilli <strk@kbt.io> |
16 | | * Thread Safety modifications: Chuck Thibert <charles.thibert@ingres.com> |
17 | | * |
18 | | ***********************************************************************/ |
19 | | |
20 | | #include <geos/algorithm/BoundaryNodeRule.h> |
21 | | #include <geos/algorithm/MinimumBoundingCircle.h> |
22 | | #include <geos/algorithm/MinimumDiameter.h> |
23 | | #include <geos/algorithm/MinimumAreaRectangle.h> |
24 | | #include <geos/algorithm/Orientation.h> |
25 | | #include <geos/algorithm/construct/MaximumInscribedCircle.h> |
26 | | #include <geos/algorithm/construct/LargestEmptyCircle.h> |
27 | | #include <geos/algorithm/distance/DiscreteHausdorffDistance.h> |
28 | | #include <geos/algorithm/distance/DiscreteFrechetDistance.h> |
29 | | #include <geos/algorithm/hull/ConcaveHull.h> |
30 | | #include <geos/algorithm/hull/ConcaveHullOfPolygons.h> |
31 | | #include <geos/coverage/CoverageCleaner.h> |
32 | | #include <geos/coverage/CoverageSimplifier.h> |
33 | | #include <geos/coverage/CoverageUnion.h> |
34 | | #include <geos/coverage/CoverageValidator.h> |
35 | | #include <geos/geom/CircularString.h> |
36 | | #include <geos/geom/CompoundCurve.h> |
37 | | #include <geos/geom/Coordinate.h> |
38 | | #include <geos/geom/CoordinateSequence.h> |
39 | | #include <geos/geom/Curve.h> |
40 | | #include <geos/geom/CurvePolygon.h> |
41 | | #include <geos/geom/Envelope.h> |
42 | | #include <geos/geom/Geometry.h> |
43 | | #include <geos/geom/GeometryCollection.h> |
44 | | #include <geos/geom/GeometryFactory.h> |
45 | | #include <geos/geom/IntersectionMatrix.h> |
46 | | #include <geos/geom/LinearRing.h> |
47 | | #include <geos/geom/LineSegment.h> |
48 | | #include <geos/geom/LineString.h> |
49 | | #include <geos/geom/MultiCurve.h> |
50 | | #include <geos/geom/MultiLineString.h> |
51 | | #include <geos/geom/MultiPoint.h> |
52 | | #include <geos/geom/MultiPolygon.h> |
53 | | #include <geos/geom/MultiSurface.h> |
54 | | #include <geos/geom/Point.h> |
55 | | #include <geos/geom/Polygon.h> |
56 | | #include <geos/geom/PrecisionModel.h> |
57 | | #include <geos/geom/SimpleCurve.h> |
58 | | #include <geos/geom/prep/PreparedGeometry.h> |
59 | | #include <geos/geom/prep/PreparedGeometryFactory.h> |
60 | | #include <geos/geom/util/Densifier.h> |
61 | | #include <geos/geom/util/GeometryFixer.h> |
62 | | #include <geos/index/ItemVisitor.h> |
63 | | #include <geos/index/strtree/TemplateSTRtree.h> |
64 | | #include <geos/io/WKBReader.h> |
65 | | #include <geos/io/WKBWriter.h> |
66 | | #include <geos/io/WKTReader.h> |
67 | | #include <geos/io/WKTWriter.h> |
68 | | #include <geos/io/GeoJSONReader.h> |
69 | | #include <geos/io/GeoJSONWriter.h> |
70 | | #include <geos/linearref/LengthIndexedLine.h> |
71 | | #include <geos/noding/GeometryNoder.h> |
72 | | #include <geos/noding/Noder.h> |
73 | | #include <geos/operation/buffer/BufferBuilder.h> |
74 | | #include <geos/operation/buffer/BufferOp.h> |
75 | | #include <geos/operation/buffer/BufferParameters.h> |
76 | | #include <geos/operation/buffer/OffsetCurve.h> |
77 | | #include <geos/operation/cluster/DBSCANClusterFinder.h> |
78 | | #include <geos/operation/cluster/EnvelopeDistanceClusterFinder.h> |
79 | | #include <geos/operation/cluster/EnvelopeIntersectsClusterFinder.h> |
80 | | #include <geos/operation/cluster/GeometryDistanceClusterFinder.h> |
81 | | #include <geos/operation/cluster/GeometryIntersectsClusterFinder.h> |
82 | | #include <geos/operation/distance/DistanceOp.h> |
83 | | #include <geos/operation/distance/IndexedFacetDistance.h> |
84 | | #include <geos/operation/grid/Grid.h> |
85 | | #include <geos/operation/grid/GridIntersection.h> |
86 | | #include <geos/operation/linemerge/LineMerger.h> |
87 | | #include <geos/operation/intersection/Rectangle.h> |
88 | | #include <geos/operation/intersection/RectangleIntersection.h> |
89 | | #include <geos/operation/overlay/snap/GeometrySnapper.h> |
90 | | #include <geos/operation/overlayng/PrecisionReducer.h> |
91 | | #include <geos/operation/overlayng/OverlayNG.h> |
92 | | #include <geos/operation/overlayng/OverlayNGRobust.h> |
93 | | #include <geos/operation/overlayng/UnaryUnionNG.h> |
94 | | #include <geos/operation/polygonize/Polygonizer.h> |
95 | | #include <geos/operation/polygonize/BuildArea.h> |
96 | | #include <geos/operation/relate/RelateOp.h> |
97 | | #include <geos/operation/sharedpaths/SharedPathsOp.h> |
98 | | #include <geos/operation/union/CascadedPolygonUnion.h> |
99 | | #include <geos/operation/union/DisjointSubsetUnion.h> |
100 | | #include <geos/operation/valid/IsSimpleOp.h> |
101 | | #include <geos/operation/valid/IsValidOp.h> |
102 | | #include <geos/operation/valid/MakeValid.h> |
103 | | #include <geos/operation/valid/RepeatedPointRemover.h> |
104 | | |
105 | | #include <geos/operation/relateng/RelateNG.h> |
106 | | |
107 | | #include <geos/precision/GeometryPrecisionReducer.h> |
108 | | #include <geos/shape/fractal/HilbertEncoder.h> |
109 | | #include <geos/simplify/DouglasPeuckerSimplifier.h> |
110 | | #include <geos/simplify/PolygonHullSimplifier.h> |
111 | | #include <geos/simplify/TopologyPreservingSimplifier.h> |
112 | | #include <geos/triangulate/DelaunayTriangulationBuilder.h> |
113 | | #include <geos/triangulate/VoronoiDiagramBuilder.h> |
114 | | #include <geos/triangulate/polygon/ConstrainedDelaunayTriangulator.h> |
115 | | #include <geos/util.h> |
116 | | #include <geos/util/IllegalArgumentException.h> |
117 | | #include <geos/util/Interrupt.h> |
118 | | #include <geos/util/UniqueCoordinateArrayFilter.h> |
119 | | #include <geos/util/Machine.h> |
120 | | #include <geos/version.h> |
121 | | |
122 | | // This should go away |
123 | | #include <cmath> // finite |
124 | | #include <cstdarg> |
125 | | #include <cstddef> |
126 | | #include <cstdio> |
127 | | #include <cstdlib> |
128 | | #include <cstring> |
129 | | #include <fstream> |
130 | | #include <iostream> |
131 | | #include <sstream> |
132 | | #include <string> |
133 | | #include <memory> |
134 | | |
135 | | #ifdef _MSC_VER |
136 | | #pragma warning(disable : 4099) |
137 | | #endif |
138 | | |
139 | | // Some extra magic to make type declarations in geos_c.h work - |
140 | | // for cross-checking of types in header. |
141 | | // NOTE: the below defines or struct definition must be kept in exact |
142 | | // sync between geos_c.cpp and geos_ts_c.cpp to avoid C++ One Definition Rule |
143 | | // violations. |
144 | | #define GEOSGeometry geos::geom::Geometry |
145 | | #define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry |
146 | | #define GEOSClusterInfo geos::operation::cluster::Clusters |
147 | | #define GEOSCoordSequence geos::geom::CoordinateSequence |
148 | | #define GEOSBufferParams geos::operation::buffer::BufferParameters |
149 | 0 | #define GEOSSTRtree geos::index::strtree::TemplateSTRtree<void*> |
150 | | #define GEOSWKTReader geos::io::WKTReader |
151 | | #define GEOSWKTWriter geos::io::WKTWriter |
152 | | #define GEOSWKBReader geos::io::WKBReader |
153 | | #define GEOSWKBWriter geos::io::WKBWriter |
154 | | #define GEOSGeoJSONReader geos::io::GeoJSONReader |
155 | | #define GEOSGeoJSONWriter geos::io::GeoJSONWriter |
156 | | |
157 | | // Implementation struct for the GEOSCoverageCleanParams object |
158 | | typedef struct { |
159 | | double snappingDistance; |
160 | | int overlapMergeStrategy; |
161 | | double gapMaximumWidth; |
162 | | } GEOSCoverageCleanParams; |
163 | | |
164 | | // Implementation struct for the GEOSMakeValidParams object |
165 | | typedef struct { |
166 | | int method; |
167 | | int keepCollapsed; |
168 | | } GEOSMakeValidParams; |
169 | | |
170 | | #include "geos_c.h" |
171 | | |
172 | | // Intentional, to allow non-standard C elements like C99 functions to be |
173 | | // imported through C++ headers of C library, like <cmath>. |
174 | | using namespace std; |
175 | | |
176 | | /// Define this if you want operations triggering Exceptions to |
177 | | /// be printed. |
178 | | /// (will use the NOTIFY channel - only implemented for GEOSUnion so far) |
179 | | /// |
180 | | #undef VERBOSE_EXCEPTIONS |
181 | | |
182 | | #include <geos/export.h> |
183 | | #include <geos/precision/MinimumClearance.h> |
184 | | |
185 | | |
186 | | // import the most frequently used definitions globally |
187 | | using geos::geom::Coordinate; |
188 | | using geos::geom::CoordinateXY; |
189 | | using geos::geom::CoordinateXYM; |
190 | | using geos::geom::CoordinateXYZM; |
191 | | using geos::geom::CoordinateSequence; |
192 | | using geos::geom::Curve; |
193 | | using geos::geom::Envelope; |
194 | | using geos::geom::Geometry; |
195 | | using geos::geom::GeometryCollection; |
196 | | using geos::geom::GeometryFactory; |
197 | | using geos::geom::LineString; |
198 | | using geos::geom::LinearRing; |
199 | | using geos::geom::MultiCurve; |
200 | | using geos::geom::MultiLineString; |
201 | | using geos::geom::MultiPolygon; |
202 | | using geos::geom::Point; |
203 | | using geos::geom::Polygon; |
204 | | using geos::geom::PrecisionModel; |
205 | | using geos::geom::SimpleCurve; |
206 | | using geos::geom::Surface; |
207 | | |
208 | | using geos::geom::prep::PreparedGeometry; |
209 | | |
210 | | using geos::io::WKTReader; |
211 | | using geos::io::WKTWriter; |
212 | | using geos::io::WKBReader; |
213 | | using geos::io::WKBWriter; |
214 | | using geos::io::GeoJSONReader; |
215 | | using geos::io::GeoJSONWriter; |
216 | | |
217 | | using geos::algorithm::distance::DiscreteFrechetDistance; |
218 | | using geos::algorithm::distance::DiscreteHausdorffDistance; |
219 | | using geos::algorithm::hull::ConcaveHull; |
220 | | using geos::algorithm::hull::ConcaveHullOfPolygons; |
221 | | |
222 | | using geos::operation::buffer::BufferBuilder; |
223 | | using geos::operation::buffer::BufferParameters; |
224 | | using geos::operation::buffer::OffsetCurve; |
225 | | using geos::operation::cluster::Clusters; |
226 | | using geos::operation::distance::IndexedFacetDistance; |
227 | | using geos::operation::geounion::CascadedPolygonUnion; |
228 | | using geos::operation::overlayng::OverlayNG; |
229 | | using geos::operation::overlayng::UnaryUnionNG; |
230 | | using geos::operation::overlayng::OverlayNGRobust; |
231 | | using geos::operation::relateng::RelateNG; |
232 | | using geos::operation::valid::TopologyValidationError; |
233 | | |
234 | | using geos::precision::GeometryPrecisionReducer; |
235 | | |
236 | | using geos::simplify::PolygonHullSimplifier; |
237 | | |
238 | | using geos::util::IllegalArgumentException; |
239 | | |
240 | | typedef struct GEOSContextHandle_HS { |
241 | | const GeometryFactory* geomFactory; |
242 | | char msgBuffer[1024]; |
243 | | GEOSMessageHandler noticeMessageOld; |
244 | | GEOSMessageHandler_r noticeMessageNew; |
245 | | void* noticeData; |
246 | | GEOSMessageHandler errorMessageOld; |
247 | | GEOSMessageHandler_r errorMessageNew; |
248 | | GEOSContextInterruptCallback* interrupt_cb; |
249 | | void* interrupt_cb_data; |
250 | | void* errorData; |
251 | | uint8_t WKBOutputDims; |
252 | | int WKBByteOrder; |
253 | | int initialized; |
254 | | std::unique_ptr<Point> point2d; |
255 | | |
256 | | GEOSContextHandle_HS() |
257 | | : |
258 | 1 | geomFactory(nullptr), |
259 | 1 | noticeMessageOld(nullptr), |
260 | 1 | noticeMessageNew(nullptr), |
261 | 1 | noticeData(nullptr), |
262 | 1 | errorMessageOld(nullptr), |
263 | 1 | errorMessageNew(nullptr), |
264 | 1 | interrupt_cb(nullptr), |
265 | 1 | interrupt_cb_data(nullptr), |
266 | 1 | errorData(nullptr), |
267 | 1 | point2d(nullptr) |
268 | 1 | { |
269 | 1 | memset(msgBuffer, 0, sizeof(msgBuffer)); |
270 | 1 | geomFactory = GeometryFactory::getDefaultInstance(); |
271 | 1 | point2d = geomFactory->createPoint(CoordinateXY{0, 0}); |
272 | 1 | WKBOutputDims = 2; |
273 | 1 | WKBByteOrder = getMachineByteOrder(); |
274 | 1 | setNoticeHandler(nullptr); |
275 | 1 | setErrorHandler(nullptr); |
276 | 1 | initialized = 1; |
277 | 1 | } |
278 | | |
279 | | GEOSMessageHandler |
280 | | setNoticeHandler(GEOSMessageHandler nf) |
281 | 2 | { |
282 | 2 | GEOSMessageHandler f = noticeMessageOld; |
283 | 2 | noticeMessageOld = nf; |
284 | 2 | noticeMessageNew = nullptr; |
285 | 2 | noticeData = nullptr; |
286 | | |
287 | 2 | return f; |
288 | 2 | } |
289 | | |
290 | | GEOSMessageHandler |
291 | | setErrorHandler(GEOSMessageHandler nf) |
292 | 2 | { |
293 | 2 | GEOSMessageHandler f = errorMessageOld; |
294 | 2 | errorMessageOld = nf; |
295 | 2 | errorMessageNew = nullptr; |
296 | 2 | errorData = nullptr; |
297 | | |
298 | 2 | return f; |
299 | 2 | } |
300 | | |
301 | | GEOSMessageHandler_r |
302 | | setNoticeHandler(GEOSMessageHandler_r nf, void* userData) |
303 | 0 | { |
304 | 0 | GEOSMessageHandler_r f = noticeMessageNew; |
305 | 0 | noticeMessageOld = nullptr; |
306 | 0 | noticeMessageNew = nf; |
307 | 0 | noticeData = userData; |
308 | |
|
309 | 0 | return f; |
310 | 0 | } |
311 | | |
312 | | GEOSMessageHandler_r |
313 | | setErrorHandler(GEOSMessageHandler_r ef, void* userData) |
314 | 0 | { |
315 | 0 | GEOSMessageHandler_r f = errorMessageNew; |
316 | 0 | errorMessageOld = nullptr; |
317 | 0 | errorMessageNew = ef; |
318 | 0 | errorData = userData; |
319 | |
|
320 | 0 | return f; |
321 | 0 | } |
322 | | |
323 | | GEOSContextInterruptCallback* |
324 | | setInterruptHandler(GEOSContextInterruptCallback* cb, void* userData) |
325 | 0 | { |
326 | 0 | auto old = interrupt_cb; |
327 | 0 | interrupt_cb = cb; |
328 | 0 | interrupt_cb_data = userData; |
329 | 0 | return old; |
330 | 0 | } |
331 | | |
332 | | void |
333 | | NOTICE_MESSAGE(GEOS_PRINTF_FORMAT const char *fmt, ...) GEOS_PRINTF_FORMAT_ATTR(2, 3) |
334 | 0 | { |
335 | 0 | if(nullptr == noticeMessageOld && nullptr == noticeMessageNew) { |
336 | 0 | return; |
337 | 0 | } |
338 | | |
339 | 0 | va_list args; |
340 | 0 | va_start(args, fmt); |
341 | | #ifdef __MINGW32__ |
342 | | #pragma GCC diagnostic push |
343 | | #pragma GCC diagnostic ignored "-Wsuggest-attribute=format" |
344 | | #endif |
345 | 0 | int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt, args); |
346 | | #ifdef __MINGW32__ |
347 | | #pragma GCC diagnostic pop |
348 | | #endif |
349 | 0 | va_end(args); |
350 | |
|
351 | 0 | if(result > 0) { |
352 | 0 | if(noticeMessageOld) { |
353 | 0 | noticeMessageOld("%s", msgBuffer); |
354 | 0 | } |
355 | 0 | else { |
356 | 0 | noticeMessageNew(msgBuffer, noticeData); |
357 | 0 | } |
358 | 0 | } |
359 | 0 | } |
360 | | |
361 | | void |
362 | | ERROR_MESSAGE(GEOS_PRINTF_FORMAT const char *fmt, ...) GEOS_PRINTF_FORMAT_ATTR(2, 3) |
363 | 8.72k | { |
364 | 8.72k | if(nullptr == errorMessageOld && nullptr == errorMessageNew) { |
365 | 0 | return; |
366 | 0 | } |
367 | | |
368 | 8.72k | va_list args; |
369 | 8.72k | va_start(args, fmt); |
370 | | #ifdef __MINGW32__ |
371 | | #pragma GCC diagnostic push |
372 | | #pragma GCC diagnostic ignored "-Wsuggest-attribute=format" |
373 | | #endif |
374 | 8.72k | int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt, args); |
375 | | #ifdef __MINGW32__ |
376 | | #pragma GCC diagnostic pop |
377 | | #endif |
378 | 8.72k | va_end(args); |
379 | | |
380 | 8.72k | if(result > 0) { |
381 | 8.72k | if(errorMessageOld) { |
382 | 8.72k | errorMessageOld("%s", msgBuffer); |
383 | 8.72k | } |
384 | 0 | else { |
385 | 0 | errorMessageNew(msgBuffer, errorData); |
386 | 0 | } |
387 | 8.72k | } |
388 | 8.72k | } |
389 | | } GEOSContextHandleInternal_t; |
390 | | |
391 | | // CAPI_ItemVisitor is used internally by the CAPI STRtree |
392 | | // wrappers. It's defined here just to keep it out of the |
393 | | // extern "C" block. |
394 | | class CAPI_ItemVisitor : public geos::index::ItemVisitor { |
395 | | GEOSQueryCallback callback; |
396 | | void* userdata; |
397 | | public: |
398 | | CAPI_ItemVisitor(GEOSQueryCallback cb, void* ud) |
399 | 0 | : ItemVisitor(), callback(cb), userdata(ud) {} |
400 | | |
401 | 0 | void operator()(void* item) { |
402 | 0 | callback(item, userdata); |
403 | 0 | } |
404 | | |
405 | | void |
406 | | visitItem(void* item) override |
407 | 0 | { |
408 | 0 | callback(item, userdata); |
409 | 0 | } |
410 | | }; |
411 | | |
412 | | |
413 | | //## PROTOTYPES ############################################# |
414 | | |
415 | | extern "C" const char GEOS_DLL* GEOSjtsport(); |
416 | | extern "C" char GEOS_DLL* GEOSasText(Geometry* g1); |
417 | | |
418 | | |
419 | | namespace { // anonymous |
420 | | |
421 | | char* |
422 | | gstrdup_s(const char* str, const std::size_t size) |
423 | 7.82k | { |
424 | 7.82k | char* out = static_cast<char*>(malloc(size + 1)); |
425 | 7.82k | if(nullptr != out) { |
426 | | // as no strlen call necessary, memcpy may be faster than strcpy |
427 | 7.82k | std::memcpy(out, str, size + 1); |
428 | 7.82k | } |
429 | | |
430 | 7.82k | assert(nullptr != out); |
431 | | |
432 | | // we haven't been checking allocation before ticket #371 |
433 | 7.82k | if(nullptr == out) { |
434 | 0 | throw(std::runtime_error("Failed to allocate memory for duplicate string")); |
435 | 0 | } |
436 | | |
437 | 7.82k | return out; |
438 | 7.82k | } |
439 | | |
440 | | char* |
441 | | gstrdup(std::string const& str) |
442 | 7.82k | { |
443 | 7.82k | return gstrdup_s(str.c_str(), str.size()); |
444 | 7.82k | } |
445 | | |
446 | | struct InterruptManager { |
447 | | InterruptManager(GEOSContextHandle_t handle) : |
448 | 89.3k | cb(handle->interrupt_cb), |
449 | 89.3k | cb_data(handle->interrupt_cb_data) { |
450 | 89.3k | if (cb) { |
451 | 0 | geos::util::CurrentThreadInterrupt::registerCallback(cb, cb_data); |
452 | 0 | } |
453 | 89.3k | } |
454 | | |
455 | 89.3k | ~InterruptManager() { |
456 | 89.3k | if (cb != nullptr) { |
457 | 0 | geos::util::CurrentThreadInterrupt::registerCallback(nullptr, nullptr); |
458 | 0 | } |
459 | 89.3k | } |
460 | | |
461 | | GEOSContextInterruptCallback* cb; |
462 | | void* cb_data; |
463 | | }; |
464 | | |
465 | | struct NotInterruptible { |
466 | 0 | NotInterruptible(GEOSContextHandle_t handle) { |
467 | 0 | (void) handle; |
468 | 0 | } |
469 | | }; |
470 | | |
471 | | } // namespace anonymous |
472 | | |
473 | | // Execute a lambda, using the given context handle to process errors. |
474 | | // Return errval on error. |
475 | | // Errval should be of the type returned by f, unless f returns a bool in which case we promote to char. |
476 | | template<typename InterruptManagerType=InterruptManager, typename F> |
477 | | inline auto execute( |
478 | | GEOSContextHandle_t extHandle, |
479 | | typename std::conditional<std::is_same<decltype(std::declval<F>()()),bool>::value, |
480 | | char, |
481 | | decltype(std::declval<F>()())>::type errval, |
482 | 0 | F&& f) -> decltype(errval) { |
483 | 0 | if (extHandle == nullptr) { |
484 | 0 | throw std::runtime_error("GEOS context handle is uninitialized, call initGEOS"); |
485 | 0 | } |
486 | | |
487 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
488 | 0 | if (!handle->initialized) { |
489 | 0 | return errval; |
490 | 0 | } |
491 | | |
492 | 0 | InterruptManagerType ic(handle); |
493 | |
|
494 | 0 | try { |
495 | 0 | return f(); |
496 | 0 | } catch (const std::exception& e) { |
497 | 0 | handle->ERROR_MESSAGE("%s", e.what()); |
498 | 0 | } catch (...) { |
499 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); |
500 | 0 | } |
501 | | |
502 | 0 | return errval; |
503 | 0 | } Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSDisjoint_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSTouches_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSIntersects_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSCrosses_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ12GEOSWithin_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSContains_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSOverlaps_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ12GEOSCovers_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ15GEOSCoveredBy_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ12GEOSEquals_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSRelatePattern_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSRelatePatternMatch_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSisValid_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSisValidDetail_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSEqualsExact_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSEqualsIdentical_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSDistance_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSDistanceWithin_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSDistanceIndexed_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSHausdorffDistance_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ33GEOSHausdorffDistanceWithPoints_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSHausdorffDistanceDensify_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ40GEOSHausdorffDistanceDensifyWithPoints_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSFrechetDistance_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSFrechetDistanceDensify_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ10GEOSArea_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ12GEOSLength_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSClusterInfo_getNumClusters_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSClusterInfo_getClusterSize_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSisEmpty_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSisSimple_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSisSimpleDetail_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ12GEOSisRing_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSGeomTypeId_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSMinimumClearance_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSGridIntersectionFractions_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSGetNumCoordinates_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ15GEOSNormalize_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSOrientPolygons_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ25GEOSGetNumInteriorRings_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ22GEOSGetNumGeometries_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSisClosed_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSGeomGetLength_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSGeomGetNumPoints_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSGeomGetX_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSGeomGetY_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSGeomGetZ_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSGeomGetM_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSHilbertCode_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSMakeValidParams_setKeepCollapsed_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSMakeValidParams_setMethod_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSGetSRID_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ10GEOSHasZ_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ10GEOSHasM_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOS_getWKBOutputDims_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOS_setWKBOutputDims_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOS_getWKBByteOrder_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOS_setWKBByteOrder_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSCoordSeq_copyToArrays_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSCoordSeq_copyToBuffer_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSCoordSeq_hasZ_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSCoordSeq_hasM_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ26GEOSCoordSeq_setOrdinate_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ20GEOSCoordSeq_setXY_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ21GEOSCoordSeq_setXYZ_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ26GEOSCoordSeq_getOrdinate_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ20GEOSCoordSeq_getXY_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ21GEOSCoordSeq_getXYZ_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ22GEOSCoordSeq_getSize_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ28GEOSCoordSeq_getDimensions_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSCoordSeq_isCCW_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSGeom_getPrecision_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSGeom_getDimensions_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ33GEOSGeom_getCoordinateDimension_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSGeom_getXMin_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSGeom_getXMax_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSGeom_getYMin_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSGeom_getYMax_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSGeom_getExtent_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ34GEOSWKTWriter_getOutputDimension_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ34GEOSWKBWriter_getOutputDimension_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSWKBWriter_getByteOrder_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSWKBWriter_getIncludeSRID_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSWKBWriter_getFlavor_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSGeoJSONWriter_getOutputDimension_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSPreparedContains_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSPreparedContainsProperly_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSPreparedCoveredBy_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSPreparedCovers_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSPreparedCrosses_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSPreparedDisjoint_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSPreparedIntersects_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSPreparedOverlaps_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSPreparedTouches_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSPreparedWithin_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSPreparedRelatePattern_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSPreparedDistance_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSPreparedDistanceWithin_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSSTRtree_build_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSSTRtree_remove_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSProject_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSOrientationIndex_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ33GEOSBufferParams_setEndCapStyle_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSBufferParams_setJoinStyle_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSBufferParams_setMitreLimit_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSBufferParams_setQuadrantSegments_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ33GEOSBufferParams_setSingleSided_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSSegmentIntersection_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSCoverageIsValid_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ45GEOSCoverageCleanParams_setSnappingDistance_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ44GEOSCoverageCleanParams_setGapMaximumWidth_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ49GEOSCoverageCleanParams_setOverlapMergeStrategy_rE3$_0EDtfp0_EP20GEOSContextHandle_HSNSt3__111conditionalIXsr3std7is_sameIDTclclsr3stdE7declvalIT0_EEEEbEE5valueEcS9_E4typeEOS8_ |
504 | | |
505 | | // Execute a lambda, using the given context handle to process errors. |
506 | | // Return nullptr on error. |
507 | | template<typename InterruptManagerType=InterruptManager, typename F, typename std::enable_if<!std::is_void<decltype(std::declval<F>()())>::value, std::nullptr_t>::type = nullptr> |
508 | 52.9k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { |
509 | 52.9k | if (extHandle == nullptr) { |
510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); |
511 | 0 | } |
512 | | |
513 | 52.9k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
514 | 52.9k | if (!handle->initialized) { |
515 | 0 | return nullptr; |
516 | 0 | } |
517 | | |
518 | 52.9k | InterruptManagerType ic(handle); |
519 | | |
520 | 52.9k | try { |
521 | 52.9k | return f(); |
522 | 52.9k | } catch (const std::exception& e) { |
523 | 8.72k | handle->ERROR_MESSAGE("%s", e.what()); |
524 | 8.72k | } catch (...) { |
525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); |
526 | 0 | } |
527 | | |
528 | 8.72k | return nullptr; |
529 | 52.9k | } Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ12GEOSRelate_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSRelateBoundaryNodeRule_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSisValidReason_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSNearestPoints_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSClusterDBSCAN_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSClusterGeometryIntersects_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSClusterEnvelopeIntersects_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSClusterEnvelopeDistance_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSClusterGeometryDistance_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSClusterInfo_getInputsForClusterN_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSClusterInfo_getClustersForInputs_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSGeomFromWKT_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 8.74k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 8.74k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 8.74k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 8.74k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 8.74k | InterruptManagerType ic(handle); | 519 | | | 520 | 8.74k | try { | 521 | 8.74k | return f(); | 522 | 8.74k | } catch (const std::exception& e) { | 523 | 925 | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 925 | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 925 | return nullptr; | 529 | 8.74k | } |
geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ15GEOSGeomToWKT_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 7.82k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 7.82k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 7.82k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 7.82k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 7.82k | InterruptManagerType ic(handle); | 519 | | | 520 | 7.82k | try { | 521 | 7.82k | return f(); | 522 | 7.82k | } catch (const std::exception& e) { | 523 | 0 | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 0 | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 0 | return nullptr; | 529 | 7.82k | } |
geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSGeomToWKB_buf_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 7.14k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 7.14k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 7.14k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 7.14k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 7.14k | InterruptManagerType ic(handle); | 519 | | | 520 | 7.14k | try { | 521 | 7.14k | return f(); | 522 | 7.14k | } catch (const std::exception& e) { | 523 | 0 | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 0 | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 0 | return nullptr; | 529 | 7.14k | } |
geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSGeomFromWKB_buf_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 7.82k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 7.82k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 7.82k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 7.82k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 7.82k | InterruptManagerType ic(handle); | 519 | | | 520 | 7.82k | try { | 521 | 7.82k | return f(); | 522 | 7.82k | } catch (const std::exception& e) { | 523 | 674 | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 674 | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 674 | return nullptr; | 529 | 7.82k | } |
Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSGeomToHEX_buf_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSGeomFromHEX_buf_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSGeomType_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSEnvelope_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSIntersection_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 7.14k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 7.14k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 7.14k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 7.14k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 7.14k | InterruptManagerType ic(handle); | 519 | | | 520 | 7.14k | try { | 521 | 7.14k | return f(); | 522 | 7.14k | } catch (const std::exception& e) { | 523 | 1.87k | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 1.87k | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 1.87k | return nullptr; | 529 | 7.14k | } |
Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSIntersectionPrec_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ12GEOSBuffer_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSBufferWithStyle_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSDensify_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSOffsetCurve_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSSingleSidedBuffer_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSConvexHull_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSConcaveHull_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSConcaveHullByLength_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSPolygonHullSimplify_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSPolygonHullSimplifyMode_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSConcaveHullOfPolygons_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSMinimumRotatedRectangle_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSMaximumInscribedCircle_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSLargestEmptyCircle_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSMinimumWidth_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ26GEOSMinimumClearanceLine_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSDifference_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 7.14k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 7.14k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 7.14k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 7.14k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 7.14k | InterruptManagerType ic(handle); | 519 | | | 520 | 7.14k | try { | 521 | 7.14k | return f(); | 522 | 7.14k | } catch (const std::exception& e) { | 523 | 2.63k | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 2.63k | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 2.63k | return nullptr; | 529 | 7.14k | } |
Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSDifferencePrec_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSBoundary_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSSymDifference_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSSymDifferencePrec_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ11GEOSUnion_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Line | Count | Source | 508 | 7.14k | inline auto execute(GEOSContextHandle_t extHandle, F&& f) -> decltype(f()) { | 509 | 7.14k | if (extHandle == nullptr) { | 510 | 0 | throw std::runtime_error("context handle is uninitialized, call initGEOS"); | 511 | 0 | } | 512 | | | 513 | 7.14k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 514 | 7.14k | if (!handle->initialized) { | 515 | 0 | return nullptr; | 516 | 0 | } | 517 | | | 518 | 7.14k | InterruptManagerType ic(handle); | 519 | | | 520 | 7.14k | try { | 521 | 7.14k | return f(); | 522 | 7.14k | } catch (const std::exception& e) { | 523 | 2.62k | handle->ERROR_MESSAGE("%s", e.what()); | 524 | 2.62k | } catch (...) { | 525 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 526 | 0 | } | 527 | | | 528 | 2.62k | return nullptr; | 529 | 7.14k | } |
Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ15GEOSUnionPrec_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSCoverageUnion_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSDisjointSubsetUnion_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSUnaryUnion_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSUnaryUnionPrec_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ10GEOSNode_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSUnionCascaded_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSPointOnSurface_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSClipByRect_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSSubdivideByGrid_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSGeom_transformXY_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSGeom_transformXYZ_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ18GEOSGetGeometryN_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSGeomGetPointN_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSGeomGetStartPoint_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSGeomGetEndPoint_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ21GEOSGetExteriorRing_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116NotInterruptibleEZ22GEOSGetInteriorRingN_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSGetCentroid_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSMinimumBoundingCircle_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSGeom_createEmptyCollection_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSGeom_createCollection_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSGeom_releaseCollection_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSPolygonize_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSPolygonize_valid_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ15GEOSBuildArea_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSMakeValidParams_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSMakeValidWithParams_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSMakeValidWithParams_rE3$_1TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ26GEOSRemoveRepeatedPoints_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSPolygonizer_getCutEdges_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSPolygonize_full_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ15GEOSLineMerge_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSLineMergeDirected_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSLineSubstring_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSReverse_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSGeom_getUserData_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSCoordSeq_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ35GEOSCoordSeq_createWithDimensions_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSCoordSeq_copyFromBuffer_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSCoordSeq_copyFromArrays_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSCoordSeq_clone_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSGeom_getCoordSeq_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSGeom_createEmptyPoint_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSGeom_createPoint_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSGeom_createPointFromXY_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSGeom_createLinearRing_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSGeom_createEmptyLineString_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSGeom_createLineString_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSGeom_createEmptyPolygon_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSGeom_createPolygon_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ26GEOSGeom_createRectangle_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSGeom_createCircularString_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ36GEOSGeom_createEmptyCircularString_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSGeom_createCompoundCurve_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ35GEOSGeom_createEmptyCompoundCurve_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSGeom_createCurvePolygon_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ34GEOSGeom_createEmptyCurvePolygon_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ16GEOSGeom_clone_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSGeom_setPrecision_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ14GEOSSimplify_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSTopologyPreserveSimplify_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSWKTReader_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSWKTReader_read_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSWKTWriter_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSWKTWriter_write_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSWKBReader_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSWKBReader_read_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSWKBReader_readHEX_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSWKBWriter_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSWKBWriter_write_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSWKBWriter_writeHEX_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ26GEOSGeoJSONReader_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSGeoJSONReader_readGeometry_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ26GEOSGeoJSONWriter_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ33GEOSGeoJSONWriter_writeGeometry_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSPrepare_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSPreparedRelate_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSPreparedNearestPoints_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSSTRtree_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSSTRtree_nearest_generic_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ17GEOSInterpolate_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSGeom_extractUniquePoints_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ10GEOSSnap_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSBufferParams_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSBufferWithParams_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSDelaunayTriangulation_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSConstrainedDelaunayTriangulation_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSVoronoiDiagram_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSCoverageSimplifyVW_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ32GEOSCoverageCleanParams_create_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ29GEOSCoverageCleanWithParams_rE3$_0TnNSt3__19enable_ifIXntsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEDTclfp0_EEP20GEOSContextHandle_HSOS5_ |
530 | | |
531 | | // Execute a lambda, using the given context handle to process errors. |
532 | | // No return value. |
533 | | template<typename InterruptManagerType=InterruptManager, typename F, typename std::enable_if<std::is_void<decltype(std::declval<F>()())>::value, std::nullptr_t>::type = nullptr> |
534 | 36.4k | inline void execute(GEOSContextHandle_t extHandle, F&& f) { |
535 | 36.4k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
536 | | |
537 | 36.4k | if (handle != nullptr) { |
538 | 36.4k | InterruptManagerType ic(handle); |
539 | 36.4k | } |
540 | | |
541 | 36.4k | try { |
542 | 36.4k | f(); |
543 | 36.4k | } catch (const std::exception& e) { |
544 | 0 | handle->ERROR_MESSAGE("%s", e.what()); |
545 | 0 | } catch (...) { |
546 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); |
547 | 0 | } |
548 | 36.4k | } geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ18GEOSGeom_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Line | Count | Source | 534 | 36.4k | inline void execute(GEOSContextHandle_t extHandle, F&& f) { | 535 | 36.4k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); | 536 | | | 537 | 36.4k | if (handle != nullptr) { | 538 | 36.4k | InterruptManagerType ic(handle); | 539 | 36.4k | } | 540 | | | 541 | 36.4k | try { | 542 | 36.4k | f(); | 543 | 36.4k | } catch (const std::exception& e) { | 544 | 0 | handle->ERROR_MESSAGE("%s", e.what()); | 545 | 0 | } catch (...) { | 546 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); | 547 | 0 | } | 548 | 36.4k | } |
Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSGeom_setUserData_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ13GEOSSetSRID_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ22GEOSCoordSeq_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSWKTReader_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSWKTReader_setFixStructure_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSWKTWriter_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSWKTWriter_setTrim_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ36GEOSWKTWriter_setRoundingPrecision_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ34GEOSWKTWriter_setOutputDimension_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ24GEOSWKTWriter_setOld3D_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSWKBReader_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ31GEOSWKBReader_setFixStructure_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ23GEOSWKBWriter_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ34GEOSWKBWriter_setOutputDimension_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ28GEOSWKBWriter_setByteOrder_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ30GEOSWKBWriter_setIncludeSRID_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ25GEOSWKBWriter_setFlavor_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSGeoJSONReader_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ27GEOSGeoJSONWriter_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ38GEOSGeoJSONWriter_setOutputDimension_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ26GEOSPreparedGeom_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ20GEOSSTRtree_insert_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ19GEOSSTRtree_query_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSSTRtree_iterate_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ Unexecuted instantiation: geos_ts_c.cpp:_Z7executeIN12_GLOBAL__N_116InterruptManagerEZ21GEOSSTRtree_destroy_rE3$_0TnNSt3__19enable_ifIXsr3std7is_voidIDTclclsr3stdE7declvalIT0_EEEEEE5valueEDnE4typeELDn0EEvP20GEOSContextHandle_HSOS5_ |
549 | | |
550 | | extern "C" { |
551 | | |
552 | | GEOSContextHandle_t |
553 | | initGEOS_r(GEOSMessageHandler nf, GEOSMessageHandler ef) |
554 | 1 | { |
555 | 1 | GEOSContextHandle_t handle = GEOS_init_r(); |
556 | | |
557 | 1 | if(nullptr != handle) { |
558 | 1 | GEOSContext_setNoticeHandler_r(handle, nf); |
559 | 1 | GEOSContext_setErrorHandler_r(handle, ef); |
560 | 1 | } |
561 | | |
562 | 1 | return handle; |
563 | 1 | } |
564 | | |
565 | | GEOSContextHandle_t |
566 | | GEOS_init_r() |
567 | 1 | { |
568 | 1 | GEOSContextHandleInternal_t* handle = new GEOSContextHandleInternal_t(); |
569 | | |
570 | 1 | geos::util::Interrupt::cancel(); |
571 | | |
572 | 1 | return static_cast<GEOSContextHandle_t>(handle); |
573 | 1 | } |
574 | | |
575 | | GEOSMessageHandler |
576 | | GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf) |
577 | 1 | { |
578 | 1 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
579 | 1 | if(0 == handle->initialized) { |
580 | 0 | return nullptr; |
581 | 0 | } |
582 | | |
583 | 1 | return handle->setNoticeHandler(nf); |
584 | 1 | } |
585 | | |
586 | | GEOSMessageHandler |
587 | | GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf) |
588 | 1 | { |
589 | 1 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
590 | 1 | if(0 == handle->initialized) { |
591 | 0 | return nullptr; |
592 | 0 | } |
593 | | |
594 | 1 | return handle->setErrorHandler(nf); |
595 | 1 | } |
596 | | |
597 | | GEOSMessageHandler_r |
598 | | GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler_r nf, void* userData) |
599 | 0 | { |
600 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
601 | 0 | if(0 == handle->initialized) { |
602 | 0 | return nullptr; |
603 | 0 | } |
604 | | |
605 | 0 | return handle->setNoticeHandler(nf, userData); |
606 | 0 | } |
607 | | |
608 | | GEOSMessageHandler_r |
609 | | GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler_r ef, void* userData) |
610 | 0 | { |
611 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
612 | 0 | if(0 == handle->initialized) { |
613 | 0 | return nullptr; |
614 | 0 | } |
615 | | |
616 | 0 | return handle->setErrorHandler(ef, userData); |
617 | 0 | } |
618 | | |
619 | | GEOSContextInterruptCallback* |
620 | | GEOSContext_setInterruptCallback_r(GEOSContextHandle_t extHandle, GEOSContextInterruptCallback* cb, void* userData) |
621 | 0 | { |
622 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
623 | 0 | if(0 == handle->initialized) { |
624 | 0 | return nullptr; |
625 | 0 | } |
626 | | |
627 | 0 | return handle->setInterruptHandler(cb, userData); |
628 | 0 | } |
629 | | |
630 | | void |
631 | | finishGEOS_r(GEOSContextHandle_t extHandle) |
632 | 0 | { |
633 | | // Fix up freeing handle w.r.t. malloc above |
634 | 0 | delete extHandle; |
635 | 0 | extHandle = nullptr; |
636 | 0 | } |
637 | | |
638 | | void |
639 | | GEOS_finish_r(GEOSContextHandle_t extHandle) |
640 | 0 | { |
641 | 0 | finishGEOS_r(extHandle); |
642 | 0 | } |
643 | | |
644 | | void |
645 | | GEOSFree_r(GEOSContextHandle_t extHandle, void* buffer) |
646 | 0 | { |
647 | 0 | assert(nullptr != extHandle); |
648 | 0 | geos::ignore_unused_variable_warning(extHandle); |
649 | |
|
650 | 0 | free(buffer); |
651 | 0 | } |
652 | | |
653 | | //----------------------------------------------------------- |
654 | | // relate()-related functions |
655 | | // return 0 = false, 1 = true, 2 = error occurred |
656 | | //----------------------------------------------------------- |
657 | | |
658 | | char |
659 | | GEOSDisjoint_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
660 | 0 | { |
661 | 0 | return execute(extHandle, 2, [&]() { |
662 | 0 | return g1->disjoint(g2); |
663 | 0 | }); |
664 | 0 | } |
665 | | |
666 | | char |
667 | | GEOSTouches_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
668 | 0 | { |
669 | 0 | return execute(extHandle, 2, [&]() { |
670 | 0 | return g1->touches(g2); |
671 | 0 | }); |
672 | 0 | } |
673 | | |
674 | | char |
675 | | GEOSIntersects_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
676 | 0 | { |
677 | 0 | return execute(extHandle, 2, [&]() { |
678 | 0 | return g1->intersects(g2); |
679 | 0 | }); |
680 | 0 | } |
681 | | |
682 | | char |
683 | | GEOSCrosses_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
684 | 0 | { |
685 | 0 | return execute(extHandle, 2, [&]() { |
686 | 0 | return g1->crosses(g2); |
687 | 0 | }); |
688 | 0 | } |
689 | | |
690 | | char |
691 | | GEOSWithin_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
692 | 0 | { |
693 | 0 | return execute(extHandle, 2, [&]() { |
694 | 0 | return g1->within(g2); |
695 | 0 | }); |
696 | 0 | } |
697 | | |
698 | | char |
699 | | GEOSContains_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
700 | 0 | { |
701 | 0 | return execute(extHandle, 2, [&]() { |
702 | 0 | return g1->contains(g2); |
703 | 0 | }); |
704 | 0 | } |
705 | | |
706 | | char |
707 | | GEOSOverlaps_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
708 | 0 | { |
709 | 0 | return execute(extHandle, 2, [&]() { |
710 | 0 | return g1->overlaps(g2); |
711 | 0 | }); |
712 | 0 | } |
713 | | |
714 | | char |
715 | | GEOSCovers_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
716 | 0 | { |
717 | 0 | return execute(extHandle, 2, [&]() { |
718 | 0 | return g1->covers(g2); |
719 | 0 | }); |
720 | 0 | } |
721 | | |
722 | | char |
723 | | GEOSCoveredBy_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
724 | 0 | { |
725 | 0 | return execute(extHandle, 2, [&]() { |
726 | 0 | return g1->coveredBy(g2); |
727 | 0 | }); |
728 | 0 | } |
729 | | |
730 | | char |
731 | | GEOSEquals_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
732 | 0 | { |
733 | 0 | return execute(extHandle, 2, [&]() { |
734 | 0 | return g1->equals(g2); |
735 | 0 | }); |
736 | 0 | } |
737 | | |
738 | | |
739 | | //------------------------------------------------------------------- |
740 | | // low-level relate functions |
741 | | //------------------------------------------------------------------ |
742 | | |
743 | | char |
744 | | GEOSRelatePattern_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, const char* imPattern) |
745 | 0 | { |
746 | 0 | return execute(extHandle, 2, [&]() { |
747 | 0 | std::string s(imPattern); |
748 | 0 | return g1->relate(g2, s); |
749 | 0 | }); |
750 | 0 | } |
751 | | |
752 | | char |
753 | | GEOSRelatePatternMatch_r(GEOSContextHandle_t extHandle, const char* intMatrix, |
754 | | const char* imPattern) |
755 | 0 | { |
756 | 0 | return execute(extHandle, 2, [&]() { |
757 | 0 | using geos::geom::IntersectionMatrix; |
758 | |
|
759 | 0 | std::string m(intMatrix); |
760 | 0 | std::string p(imPattern); |
761 | 0 | IntersectionMatrix im(m); |
762 | |
|
763 | 0 | return im.matches(p); |
764 | 0 | }); |
765 | 0 | } |
766 | | |
767 | | char* |
768 | | GEOSRelate_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
769 | 0 | { |
770 | 0 | return execute(extHandle, [&]() { |
771 | 0 | using geos::geom::IntersectionMatrix; |
772 | |
|
773 | 0 | auto im = g1->relate(g2); |
774 | 0 | if(im == nullptr) { |
775 | 0 | return (char*) nullptr; |
776 | 0 | } |
777 | | |
778 | 0 | return gstrdup(im->toString()); |
779 | 0 | }); |
780 | 0 | } |
781 | | |
782 | | char* |
783 | | GEOSRelateBoundaryNodeRule_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, int bnr) |
784 | 0 | { |
785 | 0 | using geos::operation::relate::RelateOp; |
786 | 0 | using geos::geom::IntersectionMatrix; |
787 | 0 | using geos::algorithm::BoundaryNodeRule; |
788 | |
|
789 | 0 | return execute(extHandle, [&]() -> char* { |
790 | 0 | std::unique_ptr<IntersectionMatrix> im; |
791 | |
|
792 | 0 | switch (bnr) { |
793 | 0 | case GEOSRELATE_BNR_MOD2: /* same as OGC */ |
794 | 0 | im = RelateNG::relate(g1, g2, |
795 | 0 | BoundaryNodeRule::getBoundaryRuleMod2()); |
796 | 0 | break; |
797 | 0 | case GEOSRELATE_BNR_ENDPOINT: |
798 | 0 | im = RelateNG::relate(g1, g2, |
799 | 0 | BoundaryNodeRule::getBoundaryEndPoint()); |
800 | 0 | break; |
801 | 0 | case GEOSRELATE_BNR_MULTIVALENT_ENDPOINT: |
802 | 0 | im = RelateNG::relate(g1, g2, |
803 | 0 | BoundaryNodeRule::getBoundaryMultivalentEndPoint()); |
804 | 0 | break; |
805 | 0 | case GEOSRELATE_BNR_MONOVALENT_ENDPOINT: |
806 | 0 | im = RelateNG::relate(g1, g2, |
807 | 0 | BoundaryNodeRule::getBoundaryMonovalentEndPoint()); |
808 | 0 | break; |
809 | 0 | default: |
810 | 0 | std::ostringstream ss; |
811 | 0 | ss << "Invalid boundary node rule " << bnr; |
812 | 0 | throw std::runtime_error(ss.str()); |
813 | 0 | } |
814 | | |
815 | 0 | if(!im) { |
816 | 0 | return nullptr; |
817 | 0 | } |
818 | | |
819 | 0 | char* result = gstrdup(im->toString()); |
820 | |
|
821 | 0 | return result; |
822 | 0 | }); |
823 | 0 | } |
824 | | |
825 | | |
826 | | |
827 | | //----------------------------------------------------------------- |
828 | | // isValid |
829 | | //----------------------------------------------------------------- |
830 | | |
831 | | |
832 | | char |
833 | | GEOSisValid_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
834 | 0 | { |
835 | 0 | return execute(extHandle, 2, [&]() { |
836 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
837 | |
|
838 | 0 | using geos::operation::valid::IsValidOp; |
839 | |
|
840 | 0 | IsValidOp ivo(g1); |
841 | 0 | const TopologyValidationError* err = ivo.getValidationError(); |
842 | |
|
843 | 0 | if(err) { |
844 | 0 | handle->NOTICE_MESSAGE("%s", err->toString().c_str()); |
845 | 0 | return false; |
846 | 0 | } |
847 | 0 | else { |
848 | 0 | return true; |
849 | 0 | } |
850 | 0 | }); |
851 | 0 | } |
852 | | |
853 | | char* |
854 | | GEOSisValidReason_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
855 | 0 | { |
856 | 0 | return execute(extHandle, [&]() { |
857 | 0 | using geos::operation::valid::IsValidOp; |
858 | |
|
859 | 0 | char* result = nullptr; |
860 | 0 | char const* const validstr = "Valid Geometry"; |
861 | |
|
862 | 0 | IsValidOp ivo(g1); |
863 | 0 | const TopologyValidationError* err = ivo.getValidationError(); |
864 | |
|
865 | 0 | if(err) { |
866 | 0 | std::ostringstream ss; |
867 | 0 | ss.precision(15); |
868 | 0 | ss << err->getCoordinate(); |
869 | 0 | const std::string errloc = ss.str(); |
870 | 0 | std::string errmsg(err->getMessage()); |
871 | 0 | errmsg += "[" + errloc + "]"; |
872 | 0 | result = gstrdup(errmsg); |
873 | 0 | } |
874 | 0 | else { |
875 | 0 | result = gstrdup(std::string(validstr)); |
876 | 0 | } |
877 | |
|
878 | 0 | return result; |
879 | 0 | }); |
880 | 0 | } |
881 | | |
882 | | char |
883 | | GEOSisValidDetail_r(GEOSContextHandle_t extHandle, const Geometry* g, |
884 | | int flags, char** reason, Geometry** location) |
885 | 0 | { |
886 | 0 | using geos::operation::valid::IsValidOp; |
887 | |
|
888 | 0 | return execute(extHandle, 2, [&]() { |
889 | 0 | IsValidOp ivo(g); |
890 | 0 | if(flags & GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE) { |
891 | 0 | ivo.setSelfTouchingRingFormingHoleValid(true); |
892 | 0 | } |
893 | 0 | const TopologyValidationError* err = ivo.getValidationError(); |
894 | 0 | if(err != nullptr) { |
895 | 0 | if(location) { |
896 | 0 | *location = g->getFactory()->createPoint(err->getCoordinate()).release(); |
897 | 0 | } |
898 | 0 | if(reason) { |
899 | 0 | std::string errmsg(err->getMessage()); |
900 | 0 | *reason = gstrdup(errmsg); |
901 | 0 | } |
902 | 0 | return false; |
903 | 0 | } |
904 | | |
905 | 0 | if(location) { |
906 | 0 | *location = nullptr; |
907 | 0 | } |
908 | 0 | if(reason) { |
909 | 0 | *reason = nullptr; |
910 | 0 | } |
911 | 0 | return true; /* valid */ |
912 | |
|
913 | 0 | }); |
914 | 0 | } |
915 | | |
916 | | //----------------------------------------------------------------- |
917 | | // general purpose |
918 | | //----------------------------------------------------------------- |
919 | | |
920 | | char |
921 | | GEOSEqualsExact_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double tolerance) |
922 | 0 | { |
923 | 0 | return execute(extHandle, 2, [&]() { |
924 | 0 | return g1->equalsExact(g2, tolerance); |
925 | 0 | }); |
926 | 0 | } |
927 | | |
928 | | char |
929 | | GEOSEqualsIdentical_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
930 | 0 | { |
931 | 0 | return execute(extHandle, 2, [&]() { |
932 | 0 | return g1->equalsIdentical(g2); |
933 | 0 | }); |
934 | 0 | } |
935 | | |
936 | | int |
937 | | GEOSDistance_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) |
938 | 0 | { |
939 | 0 | return execute(extHandle, 0, [&]() { |
940 | 0 | *dist = g1->distance(g2); |
941 | 0 | return 1; |
942 | 0 | }); |
943 | 0 | } |
944 | | |
945 | | char |
946 | | GEOSDistanceWithin_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double dist) |
947 | 0 | { |
948 | 0 | return execute(extHandle, 2, [&]() { |
949 | 0 | return g1->isWithinDistance(g2, dist); |
950 | 0 | }); |
951 | 0 | } |
952 | | |
953 | | int |
954 | | GEOSDistanceIndexed_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) |
955 | 0 | { |
956 | 0 | return execute(extHandle, 0, [&]() { |
957 | 0 | *dist = IndexedFacetDistance::distance(g1, g2); |
958 | 0 | return 1; |
959 | 0 | }); |
960 | 0 | } |
961 | | |
962 | | int |
963 | | GEOSHausdorffDistance_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) |
964 | 0 | { |
965 | 0 | return execute(extHandle, 0, [&]() { |
966 | 0 | *dist = DiscreteHausdorffDistance::distance(*g1, *g2); |
967 | 0 | return 1; |
968 | 0 | }); |
969 | 0 | } |
970 | | |
971 | | int |
972 | | GEOSHausdorffDistanceWithPoints_r(GEOSContextHandle_t extHandle, |
973 | | const Geometry* g1, const Geometry* g2, |
974 | | double* dist, double* p1x, double* p1y, |
975 | | double* p2x, double* p2y) |
976 | 0 | { |
977 | 0 | return execute(extHandle, 0, [&]() { |
978 | 0 | DiscreteHausdorffDistance dhd(*g1, *g2); |
979 | 0 | *dist = dhd.distance(); |
980 | 0 | const auto& pts = dhd.getCoordinates(); |
981 | 0 | *p1x = pts[0].x; |
982 | 0 | *p1y = pts[0].y; |
983 | 0 | *p2x = pts[1].x; |
984 | 0 | *p2y = pts[1].y; |
985 | 0 | return 1; |
986 | 0 | }); |
987 | 0 | } |
988 | | |
989 | | int |
990 | | GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, |
991 | | double densifyFrac, double* dist) |
992 | 0 | { |
993 | 0 | return execute(extHandle, 0, [&]() { |
994 | 0 | *dist = DiscreteHausdorffDistance::distance(*g1, *g2, densifyFrac); |
995 | 0 | return 1; |
996 | 0 | }); |
997 | 0 | } |
998 | | |
999 | | int |
1000 | | GEOSHausdorffDistanceDensifyWithPoints_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, |
1001 | | double densifyFrac, double* dist, double* p1x, double* p1y, double* p2x, double* p2y) |
1002 | 0 | { |
1003 | 0 | return execute(extHandle, 0, [&]() { |
1004 | 0 | DiscreteHausdorffDistance dhd(*g1, *g2); |
1005 | 0 | dhd.setDensifyFraction(densifyFrac); |
1006 | 0 | *dist = dhd.distance(); |
1007 | 0 | const auto& pts = dhd.getCoordinates(); |
1008 | 0 | *p1x = pts[0].x; |
1009 | 0 | *p1y = pts[0].y; |
1010 | 0 | *p2x = pts[1].x; |
1011 | 0 | *p2y = pts[1].y; |
1012 | 0 | return 1; |
1013 | 0 | }); |
1014 | 0 | } |
1015 | | |
1016 | | int |
1017 | | GEOSFrechetDistance_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) |
1018 | 0 | { |
1019 | 0 | return execute(extHandle, 0, [&]() { |
1020 | 0 | *dist = DiscreteFrechetDistance::distance(*g1, *g2); |
1021 | 0 | return 1; |
1022 | 0 | }); |
1023 | 0 | } |
1024 | | |
1025 | | int |
1026 | | GEOSFrechetDistanceDensify_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double densifyFrac, |
1027 | | double* dist) |
1028 | 0 | { |
1029 | 0 | return execute(extHandle, 0, [&]() { |
1030 | 0 | *dist = DiscreteFrechetDistance::distance(*g1, *g2, densifyFrac); |
1031 | 0 | return 1; |
1032 | 0 | }); |
1033 | 0 | } |
1034 | | |
1035 | | int |
1036 | | GEOSArea_r(GEOSContextHandle_t extHandle, const Geometry* g, double* area) |
1037 | 0 | { |
1038 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
1039 | 0 | *area = g->getArea(); |
1040 | 0 | return 1; |
1041 | 0 | }); |
1042 | 0 | } |
1043 | | |
1044 | | int |
1045 | | GEOSLength_r(GEOSContextHandle_t extHandle, const Geometry* g, double* length) |
1046 | 0 | { |
1047 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
1048 | 0 | *length = g->getLength(); |
1049 | 0 | return 1; |
1050 | 0 | }); |
1051 | 0 | } |
1052 | | |
1053 | | CoordinateSequence* |
1054 | | GEOSNearestPoints_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
1055 | 0 | { |
1056 | 0 | return execute(extHandle, [&]() -> CoordinateSequence* { |
1057 | 0 | if(g1->isEmpty() || g2->isEmpty()) { |
1058 | 0 | return nullptr; |
1059 | 0 | } |
1060 | 0 | return geos::operation::distance::DistanceOp::nearestPoints(g1, g2).release(); |
1061 | 0 | }); |
1062 | 0 | } |
1063 | | |
1064 | | static Clusters* capi_clusters(const Geometry* g, |
1065 | | geos::operation::cluster::AbstractClusterFinder& finder) |
1066 | 0 | { |
1067 | 0 | std::vector<const Geometry*> input{g->getNumGeometries()}; |
1068 | 0 | for (std::size_t i = 0; i < input.size(); i++) { |
1069 | 0 | input[i] = g->getGeometryN(i); |
1070 | 0 | } |
1071 | |
|
1072 | 0 | return new Clusters(finder.cluster(input)); |
1073 | 0 | } |
1074 | | |
1075 | | Clusters* |
1076 | | GEOSClusterDBSCAN_r(GEOSContextHandle_t extHandle, const Geometry* g, double eps, unsigned minPoints) |
1077 | 0 | { |
1078 | 0 | return execute(extHandle, [&]() { |
1079 | 0 | geos::operation::cluster::DBSCANClusterFinder finder(eps, minPoints); |
1080 | |
|
1081 | 0 | return capi_clusters(g, finder); |
1082 | 0 | }); |
1083 | 0 | } |
1084 | | |
1085 | | Clusters* |
1086 | | GEOSClusterGeometryIntersects_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1087 | 0 | { |
1088 | 0 | return execute(extHandle, [&]() { |
1089 | 0 | geos::operation::cluster::GeometryIntersectsClusterFinder finder; |
1090 | 0 | return capi_clusters(g, finder); |
1091 | 0 | }); |
1092 | 0 | } |
1093 | | |
1094 | | Clusters* |
1095 | | GEOSClusterEnvelopeIntersects_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1096 | 0 | { |
1097 | 0 | return execute(extHandle, [&]() { |
1098 | 0 | geos::operation::cluster::EnvelopeIntersectsClusterFinder finder; |
1099 | 0 | return capi_clusters(g, finder); |
1100 | 0 | }); |
1101 | 0 | } |
1102 | | |
1103 | | Clusters* |
1104 | | GEOSClusterEnvelopeDistance_r(GEOSContextHandle_t extHandle, const Geometry* g, double d) |
1105 | 0 | { |
1106 | 0 | return execute(extHandle, [&]() { |
1107 | 0 | geos::operation::cluster::EnvelopeDistanceClusterFinder finder(d); |
1108 | 0 | return capi_clusters(g, finder); |
1109 | 0 | }); |
1110 | 0 | } |
1111 | | |
1112 | | Clusters* |
1113 | | GEOSClusterGeometryDistance_r(GEOSContextHandle_t extHandle, const Geometry* g, double d) |
1114 | 0 | { |
1115 | 0 | return execute(extHandle, [&]() { |
1116 | 0 | geos::operation::cluster::GeometryDistanceClusterFinder finder(d); |
1117 | 0 | return capi_clusters(g, finder); |
1118 | 0 | }); |
1119 | 0 | } |
1120 | | |
1121 | | std::size_t GEOSClusterInfo_getNumClusters_r(GEOSContextHandle_t extHandle, const Clusters* clusters) |
1122 | 0 | { |
1123 | 0 | return execute(extHandle, 0, [&]() -> std::size_t { |
1124 | 0 | return static_cast<unsigned>(clusters->getNumClusters()); |
1125 | 0 | }); |
1126 | 0 | } |
1127 | | |
1128 | | std::size_t GEOSClusterInfo_getClusterSize_r(GEOSContextHandle_t extHandle, const Clusters* clusters, std::size_t i) |
1129 | 0 | { |
1130 | 0 | return execute(extHandle, 0, [&]() { |
1131 | 0 | return static_cast<unsigned>(clusters->getSize(i)); |
1132 | 0 | }); |
1133 | 0 | } |
1134 | | |
1135 | | const std::size_t* GEOSClusterInfo_getInputsForClusterN_r(GEOSContextHandle_t extHandle, const Clusters* clusters, std::size_t i) |
1136 | 0 | { |
1137 | 0 | return execute(extHandle, [&]() { |
1138 | 0 | return &*clusters->begin(i); |
1139 | 0 | }); |
1140 | 0 | } |
1141 | | |
1142 | | std::size_t* GEOSClusterInfo_getClustersForInputs_r(GEOSContextHandle_t extHandle, const Clusters* clusters) |
1143 | 0 | { |
1144 | 0 | return execute(extHandle, [&]() { |
1145 | 0 | auto ids = clusters->getClusterIds(GEOS_CLUSTER_NONE); |
1146 | 0 | std::size_t* ids_buf = (size_t*) malloc(ids.size() * sizeof(std::size_t)); |
1147 | 0 | std::copy(ids.begin(), ids.end(), ids_buf); |
1148 | 0 | return ids_buf; |
1149 | 0 | }); |
1150 | 0 | } |
1151 | | |
1152 | | void GEOSClusterInfo_destroy_r(GEOSContextHandle_t, Clusters* clusters) |
1153 | 0 | { |
1154 | 0 | delete clusters; |
1155 | 0 | } |
1156 | | |
1157 | | Geometry* |
1158 | | GEOSGeomFromWKT_r(GEOSContextHandle_t extHandle, const char* wkt) |
1159 | 8.74k | { |
1160 | 8.74k | return execute(extHandle, [&]() { |
1161 | 8.74k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
1162 | | |
1163 | 8.74k | const std::string wktstring(wkt); |
1164 | 8.74k | WKTReader r(static_cast<GeometryFactory const*>(handle->geomFactory)); |
1165 | | |
1166 | 8.74k | auto g = r.read(wktstring); |
1167 | 8.74k | return g.release(); |
1168 | 8.74k | }); |
1169 | 8.74k | } |
1170 | | |
1171 | | char* |
1172 | | GEOSGeomToWKT_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1173 | 7.82k | { |
1174 | 7.82k | return execute(extHandle, [&]() { |
1175 | | // Deprecated, show untrimmed 2D output |
1176 | 7.82k | geos::io::WKTWriter writer; |
1177 | 7.82k | writer.setTrim(false); |
1178 | 7.82k | writer.setOutputDimension(2); |
1179 | 7.82k | char* result = gstrdup(writer.write(g1)); |
1180 | 7.82k | return result; |
1181 | 7.82k | }); |
1182 | 7.82k | } |
1183 | | |
1184 | | // Remember to free the result! |
1185 | | unsigned char* |
1186 | | GEOSGeomToWKB_buf_r(GEOSContextHandle_t extHandle, const Geometry* g, std::size_t* size) |
1187 | 7.14k | { |
1188 | 7.14k | using geos::io::WKBWriter; |
1189 | | |
1190 | 7.14k | return execute(extHandle, [&]() { |
1191 | 7.14k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
1192 | | |
1193 | 7.14k | int byteOrder = handle->WKBByteOrder; |
1194 | 7.14k | WKBWriter w(handle->WKBOutputDims, byteOrder); |
1195 | 7.14k | std::ostringstream os(std::ios_base::binary); |
1196 | 7.14k | w.write(*g, os); |
1197 | 7.14k | std::string wkbstring(os.str()); |
1198 | 7.14k | const std::size_t len = wkbstring.length(); |
1199 | | |
1200 | 7.14k | unsigned char* result = static_cast<unsigned char*>(malloc(len)); |
1201 | 7.14k | if(result) { |
1202 | 7.14k | std::memcpy(result, wkbstring.c_str(), len); |
1203 | 7.14k | *size = len; |
1204 | 7.14k | } |
1205 | 7.14k | return result; |
1206 | 7.14k | }); |
1207 | 7.14k | } |
1208 | | |
1209 | | Geometry* |
1210 | | GEOSGeomFromWKB_buf_r(GEOSContextHandle_t extHandle, const unsigned char* wkb, std::size_t size) |
1211 | 7.82k | { |
1212 | 7.82k | using geos::io::WKBReader; |
1213 | | |
1214 | 7.82k | return execute(extHandle, [&]() { |
1215 | 7.82k | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
1216 | | |
1217 | 7.82k | WKBReader r(*(static_cast<GeometryFactory const*>(handle->geomFactory))); |
1218 | 7.82k | return r.read(wkb, size).release(); |
1219 | 7.82k | }); |
1220 | 7.82k | } |
1221 | | |
1222 | | /* Read/write wkb hex values. Returned geometries are |
1223 | | owned by the caller.*/ |
1224 | | unsigned char* |
1225 | | GEOSGeomToHEX_buf_r(GEOSContextHandle_t extHandle, const Geometry* g, std::size_t* size) |
1226 | 0 | { |
1227 | 0 | using geos::io::WKBWriter; |
1228 | |
|
1229 | 0 | return execute(extHandle, [&]() { |
1230 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
1231 | |
|
1232 | 0 | int byteOrder = handle->WKBByteOrder; |
1233 | 0 | WKBWriter w(handle->WKBOutputDims, byteOrder); |
1234 | 0 | std::ostringstream os(std::ios_base::binary); |
1235 | 0 | w.writeHEX(*g, os); |
1236 | 0 | std::string hexstring(os.str()); |
1237 | |
|
1238 | 0 | char* result = gstrdup(hexstring); |
1239 | 0 | if(result) { |
1240 | 0 | *size = hexstring.length(); |
1241 | 0 | } |
1242 | |
|
1243 | 0 | return reinterpret_cast<unsigned char*>(result); |
1244 | 0 | }); |
1245 | 0 | } |
1246 | | |
1247 | | Geometry* |
1248 | | GEOSGeomFromHEX_buf_r(GEOSContextHandle_t extHandle, const unsigned char* hex, std::size_t size) |
1249 | 0 | { |
1250 | 0 | using geos::io::WKBReader; |
1251 | |
|
1252 | 0 | return execute(extHandle, [&]() { |
1253 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
1254 | 0 | std::string hexstring(reinterpret_cast<const char*>(hex), size); |
1255 | 0 | WKBReader r(*(static_cast<GeometryFactory const*>(handle->geomFactory))); |
1256 | 0 | std::istringstream is(std::ios_base::binary); |
1257 | 0 | is.str(hexstring); |
1258 | 0 | is.seekg(0, std::ios::beg); // rewind reader pointer |
1259 | |
|
1260 | 0 | auto g = r.readHEX(is); |
1261 | 0 | return g.release(); |
1262 | 0 | }); |
1263 | 0 | } |
1264 | | |
1265 | | char |
1266 | | GEOSisEmpty_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1267 | 0 | { |
1268 | 0 | return execute(extHandle, 2, [&]() { |
1269 | 0 | return g1->isEmpty(); |
1270 | 0 | }); |
1271 | 0 | } |
1272 | | |
1273 | | char |
1274 | | GEOSisSimple_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1275 | 0 | { |
1276 | 0 | return execute(extHandle, 2, [&]() { |
1277 | 0 | return g1->isSimple(); |
1278 | 0 | }); |
1279 | 0 | } |
1280 | | |
1281 | | char |
1282 | | GEOSisSimpleDetail_r(GEOSContextHandle_t extHandle, const Geometry* g1, int returnAllPoints, Geometry** result) |
1283 | 0 | { |
1284 | 0 | return execute(extHandle, 2, [&]() { |
1285 | 0 | geos::operation::valid::IsSimpleOp iso(g1); |
1286 | 0 | iso.setFindAllLocations(returnAllPoints); |
1287 | |
|
1288 | 0 | *result = nullptr; |
1289 | |
|
1290 | 0 | bool simple = iso.isSimple(); |
1291 | 0 | if (!simple) { |
1292 | 0 | auto locations = iso.getNonSimpleLocations(); |
1293 | 0 | if (locations.size() == 1 || !returnAllPoints) { |
1294 | 0 | *result = extHandle->geomFactory->createPoint(locations.front()).release(); |
1295 | 0 | } else { |
1296 | 0 | *result = extHandle->geomFactory->createMultiPoint(locations).release(); |
1297 | 0 | } |
1298 | 0 | } |
1299 | |
|
1300 | 0 | return simple; |
1301 | 0 | }); |
1302 | 0 | } |
1303 | | |
1304 | | char |
1305 | | GEOSisRing_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1306 | 0 | { |
1307 | 0 | return execute(extHandle, 2, [&]() { |
1308 | 0 | const Curve* ls = dynamic_cast<const Curve*>(g); |
1309 | 0 | if(ls) { |
1310 | 0 | return ls->isRing(); |
1311 | 0 | } |
1312 | 0 | else { |
1313 | 0 | return false; |
1314 | 0 | } |
1315 | 0 | }); |
1316 | 0 | } |
1317 | | |
1318 | | //free the result of this |
1319 | | char* |
1320 | | GEOSGeomType_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1321 | 0 | { |
1322 | 0 | return execute(extHandle, [&]() { |
1323 | 0 | std::string s = g1->getGeometryType(); |
1324 | |
|
1325 | 0 | char* result = gstrdup(s); |
1326 | 0 | return result; |
1327 | 0 | }); |
1328 | 0 | } |
1329 | | |
1330 | | // Return postgis geometry type index |
1331 | | int |
1332 | | GEOSGeomTypeId_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1333 | 0 | { |
1334 | 0 | return execute(extHandle, -1, [&]() { |
1335 | 0 | return static_cast<int>(g1->getGeometryTypeId()); |
1336 | 0 | }); |
1337 | 0 | } |
1338 | | |
1339 | | //------------------------------------------------------------------- |
1340 | | // GEOS functions that return geometries |
1341 | | //------------------------------------------------------------------- |
1342 | | |
1343 | | Geometry* |
1344 | | GEOSEnvelope_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1345 | 0 | { |
1346 | 0 | return execute(extHandle, [&]() { |
1347 | 0 | Geometry* g3 = g1->getEnvelope().release(); |
1348 | 0 | g3->setSRID(g1->getSRID()); |
1349 | 0 | return g3; |
1350 | 0 | }); |
1351 | 0 | } |
1352 | | |
1353 | | Geometry* |
1354 | | GEOSIntersection_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
1355 | 7.14k | { |
1356 | 7.14k | return execute(extHandle, [&]() { |
1357 | 7.14k | auto g3 = g1->intersection(g2); |
1358 | 7.14k | g3->setSRID(g1->getSRID()); |
1359 | 7.14k | return g3.release(); |
1360 | 7.14k | }); |
1361 | 7.14k | } |
1362 | | |
1363 | | Geometry* |
1364 | | GEOSIntersectionPrec_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double gridSize) |
1365 | 0 | { |
1366 | 0 | return execute(extHandle, [&]() { |
1367 | 0 | std::unique_ptr<PrecisionModel> pm; |
1368 | 0 | if(gridSize != 0) { |
1369 | 0 | pm.reset(new PrecisionModel(1.0 / gridSize)); |
1370 | 0 | } |
1371 | 0 | else { |
1372 | 0 | pm.reset(new PrecisionModel()); |
1373 | 0 | } |
1374 | 0 | auto g3 = gridSize != 0 ? |
1375 | 0 | OverlayNG::overlay(g1, g2, OverlayNG::INTERSECTION, pm.get()) |
1376 | 0 | : |
1377 | 0 | OverlayNGRobust::Overlay(g1, g2, OverlayNG::INTERSECTION); |
1378 | 0 | g3->setSRID(g1->getSRID()); |
1379 | 0 | return g3.release(); |
1380 | 0 | }); |
1381 | 0 | } |
1382 | | |
1383 | | Geometry* |
1384 | | GEOSBuffer_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadrantsegments) |
1385 | 0 | { |
1386 | 0 | return execute(extHandle, [&]() { |
1387 | 0 | auto g3 = g1->buffer(width, quadrantsegments); |
1388 | 0 | g3->setSRID(g1->getSRID()); |
1389 | 0 | return g3.release(); |
1390 | 0 | }); |
1391 | 0 | } |
1392 | | |
1393 | | Geometry* |
1394 | | GEOSBufferWithStyle_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadsegs, int endCapStyle, |
1395 | | int joinStyle, double mitreLimit) |
1396 | 0 | { |
1397 | 0 | using geos::operation::buffer::BufferParameters; |
1398 | 0 | using geos::operation::buffer::BufferOp; |
1399 | 0 | using geos::util::IllegalArgumentException; |
1400 | |
|
1401 | 0 | return execute(extHandle, [&]() { |
1402 | 0 | BufferParameters bp; |
1403 | 0 | bp.setQuadrantSegments(quadsegs); |
1404 | |
|
1405 | 0 | if(endCapStyle > BufferParameters::CAP_SQUARE) { |
1406 | 0 | throw IllegalArgumentException("Invalid buffer endCap style"); |
1407 | 0 | } |
1408 | 0 | bp.setEndCapStyle( |
1409 | 0 | static_cast<BufferParameters::EndCapStyle>(endCapStyle) |
1410 | 0 | ); |
1411 | |
|
1412 | 0 | if(joinStyle > BufferParameters::JOIN_BEVEL) { |
1413 | 0 | throw IllegalArgumentException("Invalid buffer join style"); |
1414 | 0 | } |
1415 | 0 | bp.setJoinStyle( |
1416 | 0 | static_cast<BufferParameters::JoinStyle>(joinStyle) |
1417 | 0 | ); |
1418 | 0 | bp.setMitreLimit(mitreLimit); |
1419 | 0 | BufferOp op(g1, bp); |
1420 | 0 | std::unique_ptr<Geometry> g3 = op.getResultGeometry(width); |
1421 | 0 | g3->setSRID(g1->getSRID()); |
1422 | 0 | return g3.release(); |
1423 | 0 | }); |
1424 | 0 | } |
1425 | | |
1426 | | Geometry* |
1427 | | GEOSDensify_r(GEOSContextHandle_t extHandle, const Geometry* g, double tolerance) |
1428 | 0 | { |
1429 | 0 | using geos::geom::util::Densifier; |
1430 | |
|
1431 | 0 | return execute(extHandle, [&]() { |
1432 | 0 | Densifier densifier(g); |
1433 | 0 | densifier.setDistanceTolerance(tolerance); |
1434 | 0 | auto g3 = densifier.getResultGeometry(); |
1435 | 0 | g3->setSRID(g->getSRID()); |
1436 | 0 | return g3.release(); |
1437 | 0 | }); |
1438 | 0 | } |
1439 | | |
1440 | | Geometry* |
1441 | | GEOSOffsetCurve_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadsegs, int joinStyle, |
1442 | | double mitreLimit) |
1443 | 0 | { |
1444 | 0 | return execute(extHandle, [&]() { |
1445 | 0 | BufferParameters bp; |
1446 | | //-- use default cap style ROUND |
1447 | 0 | bp.setQuadrantSegments(quadsegs); |
1448 | |
|
1449 | 0 | if(joinStyle > BufferParameters::JOIN_BEVEL) { |
1450 | 0 | throw IllegalArgumentException("Invalid buffer join style"); |
1451 | 0 | } |
1452 | 0 | bp.setJoinStyle( |
1453 | 0 | static_cast<BufferParameters::JoinStyle>(joinStyle) |
1454 | 0 | ); |
1455 | 0 | bp.setMitreLimit(mitreLimit); |
1456 | |
|
1457 | 0 | OffsetCurve oc(*g1, width, bp); |
1458 | 0 | std::unique_ptr<Geometry> g3 = oc.getCurve(); |
1459 | 0 | g3->setSRID(g1->getSRID()); |
1460 | 0 | return g3.release(); |
1461 | 0 | }); |
1462 | 0 | } |
1463 | | |
1464 | | /* @deprecated in 3.3.0 */ |
1465 | | Geometry* |
1466 | | GEOSSingleSidedBuffer_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadsegs, int joinStyle, |
1467 | | double mitreLimit, int leftSide) |
1468 | 0 | { |
1469 | 0 | return execute(extHandle, [&]() { |
1470 | 0 | BufferParameters bp; |
1471 | 0 | bp.setEndCapStyle(BufferParameters::CAP_FLAT); |
1472 | 0 | bp.setQuadrantSegments(quadsegs); |
1473 | |
|
1474 | 0 | if(joinStyle > BufferParameters::JOIN_BEVEL) { |
1475 | 0 | throw IllegalArgumentException("Invalid buffer join style"); |
1476 | 0 | } |
1477 | 0 | bp.setJoinStyle( |
1478 | 0 | static_cast<BufferParameters::JoinStyle>(joinStyle) |
1479 | 0 | ); |
1480 | 0 | bp.setMitreLimit(mitreLimit); |
1481 | |
|
1482 | 0 | bool isLeftSide = leftSide == 0 ? false : true; |
1483 | 0 | BufferBuilder bufBuilder(bp); |
1484 | 0 | std::unique_ptr<Geometry> g3 = bufBuilder.bufferLineSingleSided(g1, width, isLeftSide); |
1485 | 0 | g3->setSRID(g1->getSRID()); |
1486 | 0 | return g3.release(); |
1487 | 0 | }); |
1488 | 0 | } |
1489 | | |
1490 | | Geometry* |
1491 | | GEOSConvexHull_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1492 | 0 | { |
1493 | 0 | return execute(extHandle, [&]() { |
1494 | 0 | auto g3 = g1->convexHull(); |
1495 | 0 | g3->setSRID(g1->getSRID()); |
1496 | 0 | return g3.release(); |
1497 | 0 | }); |
1498 | 0 | } |
1499 | | |
1500 | | Geometry* |
1501 | | GEOSConcaveHull_r(GEOSContextHandle_t extHandle, |
1502 | | const Geometry* g1, |
1503 | | double ratio, |
1504 | | unsigned int allowHoles) |
1505 | 0 | { |
1506 | 0 | return execute(extHandle, [&]() { |
1507 | 0 | ConcaveHull hull(g1); |
1508 | 0 | hull.setMaximumEdgeLengthRatio(ratio); |
1509 | 0 | hull.setHolesAllowed(allowHoles); |
1510 | 0 | std::unique_ptr<Geometry> g3 = hull.getHull(); |
1511 | 0 | g3->setSRID(g1->getSRID()); |
1512 | 0 | return g3.release(); |
1513 | 0 | }); |
1514 | 0 | } |
1515 | | |
1516 | | Geometry* |
1517 | | GEOSConcaveHullByLength_r(GEOSContextHandle_t extHandle, |
1518 | | const Geometry* g1, |
1519 | | double length, |
1520 | | unsigned int allowHoles) |
1521 | 0 | { |
1522 | 0 | return execute(extHandle, [&]() { |
1523 | 0 | ConcaveHull hull(g1); |
1524 | 0 | hull.setMaximumEdgeLength(length); |
1525 | 0 | hull.setHolesAllowed(allowHoles); |
1526 | 0 | std::unique_ptr<Geometry> g3 = hull.getHull(); |
1527 | 0 | g3->setSRID(g1->getSRID()); |
1528 | 0 | return g3.release(); |
1529 | 0 | }); |
1530 | 0 | } |
1531 | | |
1532 | | Geometry* |
1533 | | GEOSPolygonHullSimplify_r(GEOSContextHandle_t extHandle, |
1534 | | const Geometry* g1, |
1535 | | unsigned int isOuter, |
1536 | | double vertexNumFraction) |
1537 | 0 | { |
1538 | 0 | return execute(extHandle, [&]() { |
1539 | 0 | std::unique_ptr<Geometry> g3 = PolygonHullSimplifier::hull(g1, isOuter, vertexNumFraction); |
1540 | 0 | g3->setSRID(g1->getSRID()); |
1541 | 0 | return g3.release(); |
1542 | 0 | }); |
1543 | 0 | } |
1544 | | |
1545 | | Geometry* |
1546 | | GEOSPolygonHullSimplifyMode_r(GEOSContextHandle_t extHandle, |
1547 | | const Geometry* g1, |
1548 | | unsigned int isOuter, |
1549 | | unsigned int parameterMode, |
1550 | | double parameter) |
1551 | 0 | { |
1552 | 0 | return execute(extHandle, [&]() { |
1553 | 0 | if (parameterMode == GEOSHULL_PARAM_AREA_RATIO) { |
1554 | 0 | std::unique_ptr<Geometry> g3 = PolygonHullSimplifier::hullByAreaDelta(g1, isOuter, parameter); |
1555 | 0 | g3->setSRID(g1->getSRID()); |
1556 | 0 | return g3.release(); |
1557 | 0 | } |
1558 | 0 | else if (parameterMode == GEOSHULL_PARAM_VERTEX_RATIO) { |
1559 | 0 | std::unique_ptr<Geometry> g3 = PolygonHullSimplifier::hull(g1, isOuter, parameter); |
1560 | 0 | g3->setSRID(g1->getSRID()); |
1561 | 0 | return g3.release(); |
1562 | 0 | } |
1563 | 0 | else { |
1564 | 0 | throw IllegalArgumentException("GEOSPolygonHullSimplifyMode_r: Unknown parameterMode"); |
1565 | 0 | } |
1566 | 0 | }); |
1567 | 0 | } |
1568 | | |
1569 | | Geometry* |
1570 | | GEOSConcaveHullOfPolygons_r(GEOSContextHandle_t extHandle, |
1571 | | const Geometry* g1, |
1572 | | double lengthRatio, |
1573 | | unsigned int isTight, |
1574 | | unsigned int isHolesAllowed) |
1575 | 0 | { |
1576 | 0 | return execute(extHandle, [&]() { |
1577 | 0 | std::unique_ptr<Geometry> g3 = |
1578 | 0 | ConcaveHullOfPolygons::concaveHullByLengthRatio( |
1579 | 0 | g1, lengthRatio, |
1580 | 0 | isTight > 0, |
1581 | 0 | isHolesAllowed > 0); |
1582 | 0 | g3->setSRID(g1->getSRID()); |
1583 | 0 | return g3.release(); |
1584 | 0 | }); |
1585 | 0 | } |
1586 | | |
1587 | | Geometry* |
1588 | | GEOSMinimumRotatedRectangle_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1589 | 0 | { |
1590 | 0 | using geos::algorithm::MinimumAreaRectangle; |
1591 | |
|
1592 | 0 | return execute(extHandle, [&]() { |
1593 | 0 | auto g3 = MinimumAreaRectangle::getMinimumRectangle(g); |
1594 | 0 | g3->setSRID(g->getSRID()); |
1595 | 0 | return g3.release(); |
1596 | 0 | }); |
1597 | 0 | } |
1598 | | |
1599 | | Geometry* |
1600 | | GEOSMaximumInscribedCircle_r(GEOSContextHandle_t extHandle, const Geometry* g, double tolerance) |
1601 | 0 | { |
1602 | 0 | return execute(extHandle, [&]() { |
1603 | 0 | geos::algorithm::construct::MaximumInscribedCircle mic(g, tolerance); |
1604 | 0 | auto g3 = mic.getRadiusLine(); |
1605 | 0 | g3->setSRID(g->getSRID()); |
1606 | 0 | return g3.release(); |
1607 | 0 | }); |
1608 | 0 | } |
1609 | | |
1610 | | Geometry* |
1611 | | GEOSLargestEmptyCircle_r(GEOSContextHandle_t extHandle, const Geometry* g, const GEOSGeometry* boundary, double tolerance) |
1612 | 0 | { |
1613 | 0 | return execute(extHandle, [&]() { |
1614 | 0 | geos::algorithm::construct::LargestEmptyCircle lec(g, boundary, tolerance); |
1615 | 0 | auto g3 = lec.getRadiusLine(); |
1616 | 0 | g3->setSRID(g->getSRID()); |
1617 | 0 | return g3.release(); |
1618 | 0 | }); |
1619 | 0 | } |
1620 | | |
1621 | | Geometry* |
1622 | | GEOSMinimumWidth_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1623 | 0 | { |
1624 | 0 | return execute(extHandle, [&]() { |
1625 | 0 | geos::algorithm::MinimumDiameter m(g); |
1626 | 0 | auto g3 = m.getDiameter(); |
1627 | 0 | g3->setSRID(g->getSRID()); |
1628 | 0 | return g3.release(); |
1629 | 0 | }); |
1630 | 0 | } |
1631 | | |
1632 | | Geometry* |
1633 | | GEOSMinimumClearanceLine_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1634 | 0 | { |
1635 | 0 | return execute(extHandle, [&]() { |
1636 | 0 | geos::precision::MinimumClearance mc(g); |
1637 | 0 | auto g3 = mc.getLine(); |
1638 | 0 | g3->setSRID(g->getSRID()); |
1639 | 0 | return g3.release(); |
1640 | 0 | }); |
1641 | 0 | } |
1642 | | |
1643 | | int |
1644 | | GEOSMinimumClearance_r(GEOSContextHandle_t extHandle, const Geometry* g, double* d) |
1645 | 0 | { |
1646 | 0 | return execute(extHandle, 2, [&]() { |
1647 | 0 | geos::precision::MinimumClearance mc(g); |
1648 | 0 | double res = mc.getDistance(); |
1649 | 0 | *d = res; |
1650 | 0 | return 0; |
1651 | 0 | }); |
1652 | 0 | } |
1653 | | |
1654 | | |
1655 | | Geometry* |
1656 | | GEOSDifference_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
1657 | 7.14k | { |
1658 | 7.14k | return execute(extHandle, [&]() { |
1659 | 7.14k | auto g3 = g1->difference(g2); |
1660 | 7.14k | g3->setSRID(g1->getSRID()); |
1661 | 7.14k | return g3.release(); |
1662 | 7.14k | }); |
1663 | 7.14k | } |
1664 | | |
1665 | | Geometry* |
1666 | | GEOSDifferencePrec_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double gridSize) |
1667 | 0 | { |
1668 | 0 | return execute(extHandle, [&]() { |
1669 | |
|
1670 | 0 | std::unique_ptr<PrecisionModel> pm; |
1671 | 0 | if(gridSize != 0) { |
1672 | 0 | pm.reset(new PrecisionModel(1.0 / gridSize)); |
1673 | 0 | } |
1674 | 0 | else { |
1675 | 0 | pm.reset(new PrecisionModel()); |
1676 | 0 | } |
1677 | 0 | auto g3 = gridSize != 0 ? |
1678 | 0 | OverlayNG::overlay(g1, g2, OverlayNG::DIFFERENCE, pm.get()) |
1679 | 0 | : |
1680 | 0 | OverlayNGRobust::Overlay(g1, g2, OverlayNG::DIFFERENCE); |
1681 | 0 | g3->setSRID(g1->getSRID()); |
1682 | 0 | return g3.release(); |
1683 | 0 | }); |
1684 | 0 | } |
1685 | | |
1686 | | Geometry* |
1687 | | GEOSBoundary_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1688 | 0 | { |
1689 | 0 | return execute(extHandle, [&]() { |
1690 | 0 | auto g3 = g1->getBoundary(); |
1691 | 0 | g3->setSRID(g1->getSRID()); |
1692 | 0 | return g3.release(); |
1693 | 0 | }); |
1694 | 0 | } |
1695 | | |
1696 | | Geometry* |
1697 | | GEOSSymDifference_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
1698 | 0 | { |
1699 | 0 | return execute(extHandle, [&]() { |
1700 | 0 | auto g3 = g1->symDifference(g2); |
1701 | 0 | g3->setSRID(g1->getSRID()); |
1702 | 0 | return g3.release(); |
1703 | 0 | }); |
1704 | 0 | } |
1705 | | |
1706 | | Geometry* |
1707 | | GEOSSymDifferencePrec_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double gridSize) |
1708 | 0 | { |
1709 | 0 | return execute(extHandle, [&]() { |
1710 | |
|
1711 | 0 | std::unique_ptr<PrecisionModel> pm; |
1712 | 0 | if(gridSize != 0) { |
1713 | 0 | pm.reset(new PrecisionModel(1.0 / gridSize)); |
1714 | 0 | } |
1715 | 0 | else { |
1716 | 0 | pm.reset(new PrecisionModel()); |
1717 | 0 | } |
1718 | 0 | auto g3 = gridSize != 0 ? |
1719 | 0 | OverlayNG::overlay(g1, g2, OverlayNG::SYMDIFFERENCE, pm.get()) |
1720 | 0 | : |
1721 | 0 | OverlayNGRobust::Overlay(g1, g2, OverlayNG::SYMDIFFERENCE); |
1722 | 0 | g3->setSRID(g1->getSRID()); |
1723 | 0 | return g3.release(); |
1724 | 0 | }); |
1725 | 0 | } |
1726 | | |
1727 | | Geometry* |
1728 | | GEOSUnion_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) |
1729 | 7.14k | { |
1730 | 7.14k | return execute(extHandle, [&]() { |
1731 | 7.14k | auto g3 = g1->Union(g2); |
1732 | 7.14k | g3->setSRID(g1->getSRID()); |
1733 | 7.14k | return g3.release(); |
1734 | 7.14k | }); |
1735 | 7.14k | } |
1736 | | |
1737 | | Geometry* |
1738 | | GEOSUnionPrec_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double gridSize) |
1739 | 0 | { |
1740 | 0 | return execute(extHandle, [&]() { |
1741 | |
|
1742 | 0 | std::unique_ptr<PrecisionModel> pm; |
1743 | 0 | if(gridSize != 0) { |
1744 | 0 | pm.reset(new PrecisionModel(1.0 / gridSize)); |
1745 | 0 | } |
1746 | 0 | else { |
1747 | 0 | pm.reset(new PrecisionModel()); |
1748 | 0 | } |
1749 | 0 | auto g3 = gridSize != 0 ? |
1750 | 0 | OverlayNG::overlay(g1, g2, OverlayNG::UNION, pm.get()) |
1751 | 0 | : |
1752 | 0 | OverlayNGRobust::Overlay(g1, g2, OverlayNG::UNION); |
1753 | 0 | g3->setSRID(g1->getSRID()); |
1754 | 0 | return g3.release(); |
1755 | 0 | }); |
1756 | 0 | } |
1757 | | |
1758 | | Geometry* |
1759 | | GEOSCoverageUnion_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1760 | 0 | { |
1761 | 0 | return execute(extHandle, [&]() { |
1762 | 0 | auto g3 = geos::coverage::CoverageUnion::Union(g); |
1763 | 0 | g3->setSRID(g->getSRID()); |
1764 | 0 | return g3.release(); |
1765 | 0 | }); |
1766 | 0 | } |
1767 | | |
1768 | | Geometry* |
1769 | | GEOSDisjointSubsetUnion_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1770 | 0 | { |
1771 | 0 | return execute(extHandle, [&]() { |
1772 | 0 | auto g3 = geos::operation::geounion::DisjointSubsetUnion::Union(g); |
1773 | 0 | g3->setSRID(g->getSRID()); |
1774 | 0 | return g3.release(); |
1775 | 0 | }); |
1776 | 0 | } |
1777 | | |
1778 | | Geometry* |
1779 | | GEOSUnaryUnion_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1780 | 0 | { |
1781 | 0 | return execute(extHandle, [&]() { |
1782 | 0 | std::unique_ptr<Geometry> g3(g->Union()); |
1783 | 0 | g3->setSRID(g->getSRID()); |
1784 | 0 | return g3.release(); |
1785 | 0 | }); |
1786 | 0 | } |
1787 | | |
1788 | | Geometry* |
1789 | | GEOSUnaryUnionPrec_r(GEOSContextHandle_t extHandle, const Geometry* g1, double gridSize) |
1790 | 0 | { |
1791 | 0 | return execute(extHandle, [&]() { |
1792 | |
|
1793 | 0 | std::unique_ptr<PrecisionModel> pm; |
1794 | 0 | if(gridSize != 0) { |
1795 | 0 | pm.reset(new PrecisionModel(1.0 / gridSize)); |
1796 | 0 | } |
1797 | 0 | else { |
1798 | 0 | pm.reset(new PrecisionModel()); |
1799 | 0 | } |
1800 | 0 | auto g3 = gridSize != 0 ? |
1801 | 0 | UnaryUnionNG::Union(g1, *pm) |
1802 | 0 | : |
1803 | 0 | OverlayNGRobust::Union(g1); |
1804 | 0 | g3->setSRID(g1->getSRID()); |
1805 | 0 | return g3.release(); |
1806 | 0 | }); |
1807 | 0 | } |
1808 | | |
1809 | | Geometry* |
1810 | | GEOSNode_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1811 | 0 | { |
1812 | 0 | return execute(extHandle, [&]() { |
1813 | 0 | auto g3 = geos::noding::GeometryNoder::node(*g); |
1814 | 0 | g3->setSRID(g->getSRID()); |
1815 | 0 | return g3.release(); |
1816 | 0 | }); |
1817 | 0 | } |
1818 | | |
1819 | | Geometry* |
1820 | | GEOSUnionCascaded_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1821 | 0 | { |
1822 | 0 | return execute(extHandle, [&]() { |
1823 | | // CascadedUnion is the same as UnaryUnion, except that |
1824 | | // CascadedUnion only works on MultiPolygon, so we just delegate |
1825 | | // now and retain a check on MultiPolygon type. |
1826 | 0 | const MultiPolygon *p = dynamic_cast<const MultiPolygon *>(g1); |
1827 | 0 | if (!p) { |
1828 | 0 | throw IllegalArgumentException("Invalid argument (must be a MultiPolygon)"); |
1829 | 0 | } |
1830 | 0 | return GEOSUnaryUnion_r(extHandle, g1); |
1831 | 0 | }); |
1832 | 0 | } |
1833 | | |
1834 | | Geometry* |
1835 | | GEOSPointOnSurface_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
1836 | 0 | { |
1837 | 0 | return execute(extHandle, [&]() { |
1838 | 0 | auto ret = g1->getInteriorPoint(); |
1839 | 0 | ret->setSRID(g1->getSRID()); |
1840 | 0 | return ret.release(); |
1841 | 0 | }); |
1842 | 0 | } |
1843 | | |
1844 | | Geometry* |
1845 | | GEOSClipByRect_r(GEOSContextHandle_t extHandle, const Geometry* g, double xmin, double ymin, double xmax, double ymax) |
1846 | 0 | { |
1847 | 0 | return execute(extHandle, [&]() { |
1848 | 0 | using geos::operation::intersection::Rectangle; |
1849 | 0 | using geos::operation::intersection::RectangleIntersection; |
1850 | 0 | Rectangle rect(xmin, ymin, xmax, ymax); |
1851 | 0 | std::unique_ptr<Geometry> g3 = RectangleIntersection::clip(*g, rect); |
1852 | 0 | g3->setSRID(g->getSRID()); |
1853 | 0 | return g3.release(); |
1854 | 0 | }); |
1855 | 0 | } |
1856 | | |
1857 | | Geometry* |
1858 | | GEOSSubdivideByGrid_r(GEOSContextHandle_t extHandle, const Geometry* g, double xmin, double ymin, |
1859 | | double xmax, double ymax, unsigned nx, unsigned ny, int include_exterior) |
1860 | 0 | { |
1861 | 0 | return execute(extHandle, [&]() { |
1862 | 0 | Envelope env(xmin, xmax, ymin, ymax); |
1863 | 0 | double dx = env.getWidth() / static_cast<double>(nx); |
1864 | 0 | double dy = env.getHeight() / static_cast<double>(ny); |
1865 | 0 | geos::operation::grid::Grid<geos::operation::grid::bounded_extent> grid(env, dx, dy); |
1866 | |
|
1867 | 0 | return geos::operation::grid::GridIntersection::subdividePolygon(grid, *g, include_exterior).release(); |
1868 | 0 | }); |
1869 | 0 | } |
1870 | | |
1871 | | int |
1872 | | GEOSGridIntersectionFractions_r(GEOSContextHandle_t extHandle, const Geometry* g, double xmin, double ymin, |
1873 | | double xmax, double ymax, unsigned nx, unsigned ny, float* buf) |
1874 | 0 | { |
1875 | 0 | return execute(extHandle, 0, [&]() { |
1876 | 0 | Envelope env(xmin, xmax, ymin, ymax); |
1877 | 0 | double dx = env.getWidth() / static_cast<double>(nx); |
1878 | 0 | double dy = env.getHeight() / static_cast<double>(ny); |
1879 | 0 | geos::operation::grid::Grid<geos::operation::grid::bounded_extent> grid(env, dx, dy); |
1880 | | |
1881 | | // Matrix wants a shared_ptr, but we don't actually want anything to be freed because |
1882 | | // buf is externally owned. So we give it an empty deleter. |
1883 | 0 | std::shared_ptr<float[]> bufPtr(buf, [](float*) {}); |
1884 | |
|
1885 | 0 | auto cov = std::make_shared<geos::operation::grid::Matrix<float>>(ny, nx, bufPtr); |
1886 | 0 | geos::operation::grid::GridIntersection isect(grid, *g, cov); |
1887 | |
|
1888 | 0 | return 1; |
1889 | 0 | }); |
1890 | 0 | } |
1891 | | |
1892 | | Geometry* |
1893 | 0 | GEOSGeom_transformXY_r(GEOSContextHandle_t handle, const GEOSGeometry* g, GEOSTransformXYCallback callback, void* userdata) { |
1894 | |
|
1895 | 0 | struct TransformFilter final: public geos::geom::CoordinateFilter { |
1896 | 0 | TransformFilter(GEOSTransformXYCallback p_callback, |
1897 | 0 | void* p_userdata) : |
1898 | 0 | m_callback(p_callback), |
1899 | 0 | m_userdata(p_userdata) {} |
1900 | |
|
1901 | 0 | void filter_rw(CoordinateXY* c) const override { |
1902 | 0 | if (!m_callback(&(c->x), &(c->y), m_userdata)) { |
1903 | 0 | throw std::runtime_error(std::string("Failed to transform coordinates.")); |
1904 | 0 | } |
1905 | 0 | } |
1906 | |
|
1907 | 0 | GEOSTransformXYCallback m_callback; |
1908 | 0 | void* m_userdata; |
1909 | 0 | }; |
1910 | |
|
1911 | 0 | return execute(handle, [&]() { |
1912 | 0 | TransformFilter filter(callback, userdata); |
1913 | 0 | auto ret = g->clone(); |
1914 | 0 | ret->apply_rw(&filter); |
1915 | 0 | ret->geometryChanged(); |
1916 | 0 | return ret.release(); |
1917 | 0 | }); |
1918 | 0 | } |
1919 | | |
1920 | | |
1921 | | Geometry* |
1922 | 0 | GEOSGeom_transformXYZ_r(GEOSContextHandle_t handle, const GEOSGeometry* g, GEOSTransformXYZCallback callback, void* userdata) { |
1923 | |
|
1924 | 0 | struct TransformFilter final: public geos::geom::CoordinateFilter { |
1925 | 0 | TransformFilter(GEOSTransformXYZCallback p_callback, |
1926 | 0 | void* p_userdata) : |
1927 | 0 | m_callback(p_callback), |
1928 | 0 | m_userdata(p_userdata) {} |
1929 | |
|
1930 | 0 | void filter_rw(Coordinate* c) const override { |
1931 | 0 | if (!m_callback(&(c->x), &(c->y), &(c->z), m_userdata)) { |
1932 | 0 | throw std::runtime_error(std::string("Failed to transform coordinates.")); |
1933 | 0 | } |
1934 | 0 | } |
1935 | |
|
1936 | 0 | GEOSTransformXYZCallback m_callback; |
1937 | 0 | void* m_userdata; |
1938 | 0 | }; |
1939 | |
|
1940 | 0 | return execute(handle, [&]() { |
1941 | 0 | TransformFilter filter(callback, userdata); |
1942 | 0 | auto ret = g->clone(); |
1943 | 0 | ret->apply_rw(&filter); |
1944 | 0 | ret->geometryChanged(); |
1945 | 0 | return ret.release(); |
1946 | 0 | }); |
1947 | 0 | } |
1948 | | |
1949 | | |
1950 | | //------------------------------------------------------------------- |
1951 | | // memory management functions |
1952 | | //------------------------------------------------------------------ |
1953 | | |
1954 | | void |
1955 | | GEOSGeom_destroy_r(GEOSContextHandle_t extHandle, Geometry* a) |
1956 | 36.4k | { |
1957 | 36.4k | execute(extHandle, [&]() { |
1958 | | // FIXME: mloskot: Does this try-catch around delete means that |
1959 | | // destructors in GEOS may throw? If it does, this is a serious |
1960 | | // violation of "never throw an exception from a destructor" principle |
1961 | 36.4k | delete a; |
1962 | 36.4k | }); |
1963 | 36.4k | } |
1964 | | |
1965 | | void |
1966 | | GEOSGeom_setUserData_r(GEOSContextHandle_t extHandle, Geometry* g, void* userData) |
1967 | 0 | { |
1968 | 0 | execute(extHandle, [&]() { |
1969 | 0 | g->setUserData(userData); |
1970 | 0 | }); |
1971 | 0 | } |
1972 | | |
1973 | | void |
1974 | | GEOSSetSRID_r(GEOSContextHandle_t extHandle, Geometry* g, int srid) |
1975 | 0 | { |
1976 | 0 | execute(extHandle, [&]() { |
1977 | 0 | g->setSRID(srid); |
1978 | 0 | }); |
1979 | 0 | } |
1980 | | |
1981 | | |
1982 | | int |
1983 | | GEOSGetNumCoordinates_r(GEOSContextHandle_t extHandle, const Geometry* g) |
1984 | 0 | { |
1985 | 0 | return execute(extHandle, -1, [&]() { |
1986 | 0 | return static_cast<int>(g->getNumPoints()); |
1987 | 0 | }); |
1988 | 0 | } |
1989 | | |
1990 | | /* |
1991 | | * Return -1 on exception, 0 otherwise. |
1992 | | * Converts Geometry to normal form (or canonical form). |
1993 | | */ |
1994 | | int |
1995 | | GEOSNormalize_r(GEOSContextHandle_t extHandle, Geometry* g) |
1996 | 0 | { |
1997 | 0 | return execute(extHandle, -1, [&]() { |
1998 | 0 | g->normalize(); |
1999 | 0 | return 0; // SUCCESS |
2000 | 0 | }); |
2001 | 0 | } |
2002 | | |
2003 | | int |
2004 | | GEOSOrientPolygons_r(GEOSContextHandle_t extHandle, Geometry* g, int exteriorCW) |
2005 | 0 | { |
2006 | 0 | return execute(extHandle, -1, [&]() { |
2007 | 0 | class OrientPolygons : public geos::geom::GeometryComponentFilter { |
2008 | 0 | public: |
2009 | 0 | OrientPolygons(bool isExteriorCW) : exteriorCW(isExteriorCW) {} |
2010 | |
|
2011 | 0 | void filter_rw(Geometry* g) override { |
2012 | 0 | if (g->getGeometryTypeId() == geos::geom::GeometryTypeId::GEOS_POLYGON) { |
2013 | 0 | auto p = geos::detail::down_cast<Polygon*>(g); |
2014 | 0 | p->orientRings(exteriorCW); |
2015 | 0 | } else if (g->getGeometryTypeId() == geos::geom::GeometryTypeId::GEOS_CURVEPOLYGON) { |
2016 | 0 | throw geos::util::UnsupportedOperationException("Curved geometries not supported."); |
2017 | 0 | } |
2018 | 0 | } |
2019 | |
|
2020 | 0 | private: |
2021 | 0 | bool exteriorCW; |
2022 | 0 | }; |
2023 | |
|
2024 | 0 | OrientPolygons op(exteriorCW); |
2025 | 0 | g->apply_rw(&op); |
2026 | |
|
2027 | 0 | return 0; |
2028 | 0 | }); |
2029 | 0 | } |
2030 | | |
2031 | | int |
2032 | | GEOSGetNumInteriorRings_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2033 | 0 | { |
2034 | 0 | return execute<NotInterruptible>(extHandle, -1, [&]() { |
2035 | 0 | const Surface* p = dynamic_cast<const Surface*>(g1); |
2036 | 0 | if(!p) { |
2037 | 0 | throw IllegalArgumentException("Argument is not a Surface"); |
2038 | 0 | } |
2039 | 0 | return static_cast<int>(p->getNumInteriorRing()); |
2040 | 0 | }); |
2041 | 0 | } |
2042 | | |
2043 | | |
2044 | | // returns -1 on error and 1 for non-multi geometries |
2045 | | int |
2046 | | GEOSGetNumGeometries_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2047 | 0 | { |
2048 | 0 | return execute<NotInterruptible>(extHandle, -1, [&]() { |
2049 | 0 | return static_cast<int>(g1->getNumGeometries()); |
2050 | 0 | }); |
2051 | 0 | } |
2052 | | |
2053 | | |
2054 | | /* |
2055 | | * Call only on GEOMETRYCOLLECTION or MULTI*. |
2056 | | * Return a pointer to the internal Geometry. |
2057 | | */ |
2058 | | const Geometry* |
2059 | | GEOSGetGeometryN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) |
2060 | 0 | { |
2061 | 0 | return execute<NotInterruptible>(extHandle, [&]() { |
2062 | 0 | if(n < 0) { |
2063 | 0 | throw IllegalArgumentException("Index must be non-negative."); |
2064 | 0 | } |
2065 | 0 | return g1->getGeometryN(static_cast<size_t>(n)); |
2066 | 0 | }); |
2067 | 0 | } |
2068 | | |
2069 | | /* |
2070 | | * Call only on LINESTRING |
2071 | | * Returns NULL on exception |
2072 | | */ |
2073 | | Geometry* |
2074 | | GEOSGeomGetPointN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) |
2075 | 0 | { |
2076 | 0 | return execute(extHandle, [&]() { |
2077 | 0 | const SimpleCurve* ls = dynamic_cast<const SimpleCurve*>(g1); |
2078 | 0 | if(!ls) { |
2079 | 0 | throw IllegalArgumentException("Argument is not a SimpleCurve"); |
2080 | 0 | } |
2081 | 0 | if(n < 0) { |
2082 | 0 | throw IllegalArgumentException("Index must be non-negative."); |
2083 | 0 | } |
2084 | 0 | return ls->getPointN(static_cast<size_t>(n)).release(); |
2085 | 0 | }); |
2086 | 0 | } |
2087 | | |
2088 | | /* |
2089 | | * Call only on LINESTRING |
2090 | | */ |
2091 | | Geometry* |
2092 | | GEOSGeomGetStartPoint_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2093 | 0 | { |
2094 | 0 | return execute(extHandle, [&]() { |
2095 | 0 | const SimpleCurve* ls = dynamic_cast<const SimpleCurve*>(g1); |
2096 | 0 | if(!ls) { |
2097 | 0 | throw IllegalArgumentException("Argument is not a SimpleCurve"); |
2098 | 0 | } |
2099 | | |
2100 | 0 | return ls->getStartPoint().release(); |
2101 | 0 | }); |
2102 | 0 | } |
2103 | | |
2104 | | /* |
2105 | | * Call only on LINESTRING |
2106 | | */ |
2107 | | Geometry* |
2108 | | GEOSGeomGetEndPoint_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2109 | 0 | { |
2110 | 0 | return execute(extHandle, [&]() { |
2111 | 0 | const SimpleCurve* ls = dynamic_cast<const SimpleCurve*>(g1); |
2112 | 0 | if(!ls) { |
2113 | 0 | throw IllegalArgumentException("Argument is not a SimpleCurve"); |
2114 | 0 | } |
2115 | 0 | return ls->getEndPoint().release(); |
2116 | 0 | }); |
2117 | 0 | } |
2118 | | |
2119 | | /* |
2120 | | * Call only on LINESTRING or MULTILINESTRING |
2121 | | * return 2 on exception, 1 on true, 0 on false |
2122 | | */ |
2123 | | char |
2124 | | GEOSisClosed_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2125 | 0 | { |
2126 | 0 | return execute(extHandle, 2, [&]() { |
2127 | 0 | const Curve* ls = dynamic_cast<const Curve*>(g1); |
2128 | 0 | if(ls) { |
2129 | 0 | return ls->isClosed(); |
2130 | 0 | } |
2131 | | |
2132 | 0 | const MultiLineString* mls = dynamic_cast<const MultiLineString*>(g1); |
2133 | 0 | if(mls) { |
2134 | 0 | return mls->isClosed(); |
2135 | 0 | } |
2136 | | |
2137 | 0 | const MultiCurve* mc = dynamic_cast<const MultiCurve*>(g1); |
2138 | 0 | if(mc) { |
2139 | 0 | return mc->isClosed(); |
2140 | 0 | } |
2141 | | |
2142 | 0 | throw IllegalArgumentException("Argument is not a Curve, MultiLineString, or MultiCurve"); |
2143 | 0 | }); |
2144 | 0 | } |
2145 | | |
2146 | | /* |
2147 | | * Call only on LINESTRING |
2148 | | * return 0 on exception, otherwise 1 |
2149 | | */ |
2150 | | int |
2151 | | GEOSGeomGetLength_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* length) |
2152 | 0 | { |
2153 | 0 | return execute(extHandle, 0, [&]() { |
2154 | 0 | const LineString* ls = dynamic_cast<const LineString*>(g1); |
2155 | 0 | if(!ls) { |
2156 | 0 | throw IllegalArgumentException("Argument is not a LineString"); |
2157 | 0 | } |
2158 | 0 | *length = ls->getLength(); |
2159 | 0 | return 1; |
2160 | 0 | }); |
2161 | 0 | } |
2162 | | |
2163 | | /* |
2164 | | * Call only on LINESTRING |
2165 | | */ |
2166 | | int |
2167 | | GEOSGeomGetNumPoints_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2168 | 0 | { |
2169 | 0 | return execute(extHandle, -1, [&]() { |
2170 | 0 | const SimpleCurve* ls = dynamic_cast<const SimpleCurve*>(g1); |
2171 | 0 | if(!ls) { |
2172 | 0 | throw IllegalArgumentException("Argument is not a SimpleCurve"); |
2173 | 0 | } |
2174 | 0 | return static_cast<int>(ls->getNumPoints()); |
2175 | 0 | }); |
2176 | 0 | } |
2177 | | |
2178 | | /* |
2179 | | * For POINT |
2180 | | * returns 0 on exception, otherwise 1 |
2181 | | */ |
2182 | | int |
2183 | | GEOSGeomGetX_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* x) |
2184 | 0 | { |
2185 | 0 | return execute(extHandle, 0, [&]() { |
2186 | 0 | const Point* po = dynamic_cast<const Point*>(g1); |
2187 | 0 | if(!po) { |
2188 | 0 | throw IllegalArgumentException("Argument is not a Point"); |
2189 | 0 | } |
2190 | 0 | *x = po->getX(); |
2191 | 0 | return 1; |
2192 | 0 | }); |
2193 | 0 | } |
2194 | | |
2195 | | /* |
2196 | | * For POINT |
2197 | | * returns 0 on exception, otherwise 1 |
2198 | | */ |
2199 | | int |
2200 | | GEOSGeomGetY_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* y) |
2201 | 0 | { |
2202 | 0 | return execute(extHandle, 0, [&]() { |
2203 | 0 | const Point* po = dynamic_cast<const Point*>(g1); |
2204 | 0 | if(!po) { |
2205 | 0 | throw IllegalArgumentException("Argument is not a Point"); |
2206 | 0 | } |
2207 | 0 | *y = po->getY(); |
2208 | 0 | return 1; |
2209 | 0 | }); |
2210 | 0 | } |
2211 | | |
2212 | | /* |
2213 | | * For POINT |
2214 | | * returns 0 on exception, otherwise 1 |
2215 | | */ |
2216 | | int |
2217 | | GEOSGeomGetZ_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* z) |
2218 | 0 | { |
2219 | 0 | return execute(extHandle, 0, [&]() { |
2220 | 0 | const Point* po = dynamic_cast<const Point*>(g1); |
2221 | 0 | if(!po) { |
2222 | 0 | throw IllegalArgumentException("Argument is not a Point"); |
2223 | 0 | } |
2224 | 0 | *z = po->getZ(); |
2225 | 0 | return 1; |
2226 | 0 | }); |
2227 | 0 | } |
2228 | | |
2229 | | /* |
2230 | | * For POINT |
2231 | | * returns 0 on exception, otherwise 1 |
2232 | | */ |
2233 | | int |
2234 | | GEOSGeomGetM_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* m) |
2235 | 0 | { |
2236 | 0 | return execute(extHandle, 0, [&]() { |
2237 | 0 | const Point* po = dynamic_cast<const Point*>(g1); |
2238 | 0 | if(!po) { |
2239 | 0 | throw IllegalArgumentException("Argument is not a Point"); |
2240 | 0 | } |
2241 | 0 | *m = po->getM(); |
2242 | 0 | return 1; |
2243 | 0 | }); |
2244 | 0 | } |
2245 | | |
2246 | | /* |
2247 | | * Call only on polygon |
2248 | | * Return a pointer to the internal Geometry. |
2249 | | */ |
2250 | | const Geometry* |
2251 | | GEOSGetExteriorRing_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
2252 | 0 | { |
2253 | 0 | return execute<NotInterruptible>(extHandle, [&]() { |
2254 | 0 | const Surface* p = dynamic_cast<const Surface*>(g1); |
2255 | 0 | if(!p) { |
2256 | 0 | throw IllegalArgumentException("Invalid argument (must be a Surface)"); |
2257 | 0 | } |
2258 | 0 | return p->getExteriorRing(); |
2259 | 0 | }); |
2260 | 0 | } |
2261 | | |
2262 | | /* |
2263 | | * Call only on polygon |
2264 | | * Return a pointer to internal storage, do not destroy it. |
2265 | | */ |
2266 | | const Geometry* |
2267 | | GEOSGetInteriorRingN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) |
2268 | 0 | { |
2269 | 0 | return execute<NotInterruptible>(extHandle, [&]() { |
2270 | 0 | const Surface* p = dynamic_cast<const Surface*>(g1); |
2271 | 0 | if(!p) { |
2272 | 0 | throw IllegalArgumentException("Invalid argument (must be a Surface)"); |
2273 | 0 | } |
2274 | 0 | if(n < 0) { |
2275 | 0 | throw IllegalArgumentException("Index must be non-negative."); |
2276 | 0 | } |
2277 | 0 | return p->getInteriorRingN(static_cast<size_t>(n)); |
2278 | 0 | }); |
2279 | 0 | } |
2280 | | |
2281 | | Geometry* |
2282 | | GEOSGetCentroid_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2283 | 0 | { |
2284 | 0 | return execute(extHandle, [&]() -> Geometry* { |
2285 | 0 | auto ret = g->getCentroid(); |
2286 | 0 | ret->setSRID(g->getSRID()); |
2287 | 0 | return ret.release(); |
2288 | 0 | }); |
2289 | 0 | } |
2290 | | |
2291 | | int |
2292 | | GEOSHilbertCode_r(GEOSContextHandle_t extHandle, const GEOSGeometry *geom, |
2293 | | const GEOSGeometry* extent, unsigned int level, |
2294 | | unsigned int *code) |
2295 | 0 | { |
2296 | 0 | using geos::shape::fractal::HilbertEncoder; |
2297 | |
|
2298 | 0 | return execute(extHandle, 0, [&]() { |
2299 | 0 | Envelope e = *extent->getEnvelopeInternal(); |
2300 | 0 | HilbertEncoder encoder(level, e); |
2301 | 0 | *code = encoder.encode(geom->getEnvelopeInternal()); |
2302 | 0 | return 1; |
2303 | 0 | }); |
2304 | 0 | } |
2305 | | |
2306 | | Geometry* |
2307 | | GEOSMinimumBoundingCircle_r(GEOSContextHandle_t extHandle, const Geometry* g, |
2308 | | double* radius, Geometry** center) |
2309 | 0 | { |
2310 | 0 | return execute(extHandle, [&]() -> Geometry* { |
2311 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2312 | |
|
2313 | 0 | geos::algorithm::MinimumBoundingCircle mc(g); |
2314 | 0 | std::unique_ptr<Geometry> ret = mc.getCircle(); |
2315 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2316 | 0 | if (center) *center = gf->createPoint(mc.getCentre()).release(); |
2317 | 0 | if (radius) *radius = mc.getRadius(); |
2318 | 0 | ret->setSRID(g->getSRID()); |
2319 | 0 | return ret.release(); |
2320 | 0 | }); |
2321 | 0 | } |
2322 | | |
2323 | | Geometry* |
2324 | | GEOSGeom_createEmptyCollection_r(GEOSContextHandle_t extHandle, int type) |
2325 | 0 | { |
2326 | 0 | return execute(extHandle, [&]() { |
2327 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2328 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2329 | |
|
2330 | 0 | std::unique_ptr<Geometry> g = 0; |
2331 | 0 | switch(type) { |
2332 | 0 | case GEOS_GEOMETRYCOLLECTION: |
2333 | 0 | g = gf->createGeometryCollection(); |
2334 | 0 | break; |
2335 | 0 | case GEOS_MULTIPOINT: |
2336 | 0 | g = gf->createMultiPoint(); |
2337 | 0 | break; |
2338 | 0 | case GEOS_MULTILINESTRING: |
2339 | 0 | g = gf->createMultiLineString(); |
2340 | 0 | break; |
2341 | 0 | case GEOS_MULTIPOLYGON: |
2342 | 0 | g = gf->createMultiPolygon(); |
2343 | 0 | break; |
2344 | 0 | case GEOS_MULTICURVE: |
2345 | 0 | g = gf->createMultiCurve(); |
2346 | 0 | break; |
2347 | 0 | case GEOS_MULTISURFACE: |
2348 | 0 | g = gf->createMultiSurface(); |
2349 | 0 | break; |
2350 | 0 | default: |
2351 | 0 | throw IllegalArgumentException("Unsupported type request for GEOSGeom_createEmptyCollection_r"); |
2352 | 0 | } |
2353 | | |
2354 | 0 | return g.release(); |
2355 | 0 | }); |
2356 | 0 | } |
2357 | | |
2358 | | Geometry* |
2359 | | GEOSGeom_createCollection_r(GEOSContextHandle_t extHandle, int type, Geometry** geoms, unsigned int ngeoms) |
2360 | 0 | { |
2361 | 0 | return execute(extHandle, [&]() { |
2362 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2363 | |
|
2364 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2365 | |
|
2366 | 0 | std::vector<std::unique_ptr<Geometry>> vgeoms(ngeoms); |
2367 | 0 | for (std::size_t i = 0; i < ngeoms; i++) { |
2368 | 0 | vgeoms[i].reset(geoms[i]); |
2369 | 0 | } |
2370 | |
|
2371 | 0 | std::unique_ptr<Geometry> g; |
2372 | 0 | switch(type) { |
2373 | 0 | case GEOS_GEOMETRYCOLLECTION: |
2374 | 0 | g = gf->createGeometryCollection(std::move(vgeoms)); |
2375 | 0 | break; |
2376 | 0 | case GEOS_MULTIPOINT: |
2377 | 0 | g = gf->createMultiPoint(std::move(vgeoms)); |
2378 | 0 | break; |
2379 | 0 | case GEOS_MULTILINESTRING: |
2380 | 0 | g = gf->createMultiLineString(std::move(vgeoms)); |
2381 | 0 | break; |
2382 | 0 | case GEOS_MULTIPOLYGON: |
2383 | 0 | g = gf->createMultiPolygon(std::move(vgeoms)); |
2384 | 0 | break; |
2385 | 0 | case GEOS_MULTICURVE: |
2386 | 0 | g = gf->createMultiCurve(std::move(vgeoms)); |
2387 | 0 | break; |
2388 | 0 | case GEOS_MULTISURFACE: |
2389 | 0 | g = gf->createMultiSurface(std::move(vgeoms)); |
2390 | 0 | break; |
2391 | 0 | default: |
2392 | 0 | handle->ERROR_MESSAGE("Unsupported type request for GEOSGeom_createCollection_r"); |
2393 | 0 | } |
2394 | | |
2395 | 0 | return g.release(); |
2396 | 0 | }); |
2397 | 0 | } |
2398 | | |
2399 | | Geometry** |
2400 | | GEOSGeom_releaseCollection_r(GEOSContextHandle_t extHandle, Geometry* collection, unsigned int * ngeoms) |
2401 | 0 | { |
2402 | 0 | return execute(extHandle, [&]() { |
2403 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2404 | |
|
2405 | 0 | if (ngeoms == nullptr) { |
2406 | 0 | handle->ERROR_MESSAGE("Parameter ngeoms of GEOSGeom_releaseCollection_r must not be null"); |
2407 | 0 | } |
2408 | |
|
2409 | 0 | GeometryCollection *col = dynamic_cast<GeometryCollection*>(collection); |
2410 | 0 | if (!col) { |
2411 | 0 | handle->ERROR_MESSAGE("Parameter collection of GEOSGeom_releaseCollection_r must not be a collection"); |
2412 | 0 | } else { |
2413 | 0 | *ngeoms = static_cast<unsigned int>(col->getNumGeometries()); |
2414 | 0 | } |
2415 | | |
2416 | | // Early exit on empty/null input |
2417 | 0 | if (!col || *ngeoms == 0) { |
2418 | 0 | return static_cast<Geometry**>(nullptr); |
2419 | 0 | } |
2420 | | |
2421 | 0 | std::vector<std::unique_ptr<Geometry>> subgeoms = col->releaseGeometries(); |
2422 | |
|
2423 | 0 | Geometry** subgeomArray = static_cast<Geometry**>(malloc(sizeof(Geometry*) * subgeoms.size())); |
2424 | 0 | for (std::size_t i = 0; i < subgeoms.size(); i++) { |
2425 | 0 | subgeomArray[i] = subgeoms[i].release(); |
2426 | 0 | } |
2427 | |
|
2428 | 0 | return subgeomArray; |
2429 | 0 | }); |
2430 | 0 | } |
2431 | | |
2432 | | Geometry* |
2433 | | GEOSPolygonize_r(GEOSContextHandle_t extHandle, const Geometry* const* g, unsigned int ngeoms) |
2434 | 0 | { |
2435 | 0 | using geos::operation::polygonize::Polygonizer; |
2436 | |
|
2437 | 0 | return execute(extHandle, [&]() { |
2438 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2439 | | |
2440 | | // Polygonize |
2441 | 0 | Polygonizer plgnzr; |
2442 | 0 | for(std::size_t i = 0; i < ngeoms; ++i) { |
2443 | 0 | plgnzr.add(g[i]); |
2444 | 0 | } |
2445 | |
|
2446 | 0 | auto polys = plgnzr.getPolygons(); |
2447 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2448 | 0 | return gf->createGeometryCollection(std::move(polys)).release(); |
2449 | 0 | }); |
2450 | 0 | } |
2451 | | |
2452 | | Geometry* |
2453 | | GEOSPolygonize_valid_r(GEOSContextHandle_t extHandle, const Geometry* const* g, unsigned int ngeoms) |
2454 | 0 | { |
2455 | 0 | using geos::operation::polygonize::Polygonizer; |
2456 | |
|
2457 | 0 | return execute(extHandle, [&]() -> Geometry* { |
2458 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2459 | 0 | Geometry* out; |
2460 | | |
2461 | | // Polygonize |
2462 | 0 | Polygonizer plgnzr(true); |
2463 | 0 | int srid = 0; |
2464 | 0 | for(std::size_t i = 0; i < ngeoms; ++i) { |
2465 | 0 | plgnzr.add(g[i]); |
2466 | 0 | srid = g[i]->getSRID(); |
2467 | 0 | } |
2468 | |
|
2469 | 0 | auto polys = plgnzr.getPolygons(); |
2470 | 0 | if (polys.empty()) { |
2471 | 0 | out = handle->geomFactory->createGeometryCollection().release(); |
2472 | 0 | } else if (polys.size() == 1) { |
2473 | 0 | return polys[0].release(); |
2474 | 0 | } else { |
2475 | 0 | return handle->geomFactory->createMultiPolygon(std::move(polys)).release(); |
2476 | 0 | } |
2477 | | |
2478 | 0 | out->setSRID(srid); |
2479 | 0 | return out; |
2480 | 0 | }); |
2481 | 0 | } |
2482 | | |
2483 | | Geometry* |
2484 | | GEOSBuildArea_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2485 | 0 | { |
2486 | 0 | using geos::operation::polygonize::BuildArea; |
2487 | |
|
2488 | 0 | return execute(extHandle, [&]() { |
2489 | 0 | BuildArea builder; |
2490 | 0 | auto out = builder.build(g); |
2491 | 0 | out->setSRID(g->getSRID()); |
2492 | 0 | return out.release(); |
2493 | 0 | }); |
2494 | 0 | } |
2495 | | |
2496 | | /************************************************************************ |
2497 | | * Make Valid |
2498 | | */ |
2499 | | |
2500 | | Geometry* |
2501 | | GEOSMakeValid_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2502 | 0 | { |
2503 | 0 | GEOSMakeValidParams params; |
2504 | 0 | params.method = GEOS_MAKE_VALID_LINEWORK; |
2505 | 0 | params.keepCollapsed = 1; |
2506 | 0 | return GEOSMakeValidWithParams_r(extHandle, g, ¶ms); |
2507 | 0 | } |
2508 | | |
2509 | | GEOSMakeValidParams* |
2510 | | GEOSMakeValidParams_create_r(GEOSContextHandle_t extHandle) |
2511 | 0 | { |
2512 | 0 | return execute(extHandle, [&]() { |
2513 | 0 | GEOSMakeValidParams* p = new GEOSMakeValidParams(); |
2514 | 0 | p->method = GEOS_MAKE_VALID_LINEWORK; |
2515 | 0 | p->keepCollapsed = 0; |
2516 | 0 | return p; |
2517 | 0 | }); |
2518 | 0 | } |
2519 | | |
2520 | | void |
2521 | | GEOSMakeValidParams_destroy_r(GEOSContextHandle_t extHandle, GEOSMakeValidParams* parms) |
2522 | 0 | { |
2523 | 0 | (void)extHandle; |
2524 | 0 | delete parms; |
2525 | 0 | } |
2526 | | |
2527 | | int |
2528 | | GEOSMakeValidParams_setKeepCollapsed_r(GEOSContextHandle_t extHandle, |
2529 | | GEOSMakeValidParams* p, int keepCollapsed) |
2530 | 0 | { |
2531 | 0 | return execute(extHandle, 0, [&]() { |
2532 | 0 | p->keepCollapsed = keepCollapsed; |
2533 | 0 | return 1; |
2534 | 0 | }); |
2535 | 0 | } |
2536 | | |
2537 | | int |
2538 | | GEOSMakeValidParams_setMethod_r(GEOSContextHandle_t extHandle, |
2539 | | GEOSMakeValidParams* p, GEOSMakeValidMethods method) |
2540 | 0 | { |
2541 | 0 | return execute(extHandle, 0, [&]() { |
2542 | 0 | p->method = method; |
2543 | 0 | return 1; |
2544 | 0 | }); |
2545 | 0 | } |
2546 | | |
2547 | | Geometry* |
2548 | | GEOSMakeValidWithParams_r( |
2549 | | GEOSContextHandle_t extHandle, |
2550 | | const Geometry* g, |
2551 | | const GEOSMakeValidParams* params) |
2552 | 0 | { |
2553 | 0 | using geos::geom::util::GeometryFixer; |
2554 | 0 | using geos::operation::valid::MakeValid; |
2555 | |
|
2556 | 0 | if (params && params->method == GEOS_MAKE_VALID_LINEWORK) { |
2557 | 0 | return execute(extHandle, [&]() { |
2558 | 0 | MakeValid makeValid; |
2559 | 0 | auto out = makeValid.build(g); |
2560 | 0 | out->setSRID(g->getSRID()); |
2561 | 0 | return out.release(); |
2562 | 0 | }); |
2563 | 0 | } |
2564 | 0 | else if (params && params->method == GEOS_MAKE_VALID_STRUCTURE) { |
2565 | 0 | return execute(extHandle, [&]() { |
2566 | 0 | GeometryFixer fixer(g); |
2567 | 0 | fixer.setKeepCollapsed(params->keepCollapsed == 0 ? false : true); |
2568 | 0 | auto out = fixer.getResult(); |
2569 | 0 | out->setSRID(g->getSRID()); |
2570 | 0 | return out.release(); |
2571 | 0 | }); |
2572 | 0 | } |
2573 | 0 | else { |
2574 | 0 | extHandle->ERROR_MESSAGE("Unknown method in GEOSMakeValidParams"); |
2575 | 0 | return nullptr; |
2576 | 0 | } |
2577 | 0 | } |
2578 | | |
2579 | | Geometry* |
2580 | | GEOSRemoveRepeatedPoints_r( |
2581 | | GEOSContextHandle_t extHandle, |
2582 | | const Geometry* g, |
2583 | | double tolerance) |
2584 | 0 | { |
2585 | 0 | using geos::operation::valid::RepeatedPointRemover; |
2586 | |
|
2587 | 0 | return execute(extHandle, [&]() { |
2588 | 0 | auto out = RepeatedPointRemover::removeRepeatedPoints(g, tolerance); |
2589 | 0 | out->setSRID(g->getSRID()); |
2590 | 0 | return out.release(); |
2591 | 0 | }); |
2592 | 0 | } |
2593 | | |
2594 | | Geometry* |
2595 | | GEOSPolygonizer_getCutEdges_r(GEOSContextHandle_t extHandle, const Geometry* const* g, unsigned int ngeoms) |
2596 | 0 | { |
2597 | 0 | using geos::operation::polygonize::Polygonizer; |
2598 | |
|
2599 | 0 | return execute(extHandle, [&]() { |
2600 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2601 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2602 | | |
2603 | | // Polygonize |
2604 | 0 | Polygonizer plgnzr; |
2605 | 0 | int srid = 0; |
2606 | 0 | for(std::size_t i = 0; i < ngeoms; ++i) { |
2607 | 0 | plgnzr.add(g[i]); |
2608 | 0 | srid = g[i]->getSRID(); |
2609 | 0 | } |
2610 | |
|
2611 | 0 | const std::vector<const LineString*>& lines = plgnzr.getCutEdges(); |
2612 | | |
2613 | | // We need a vector of Geometry pointers, not Polygon pointers. |
2614 | | // STL vector doesn't allow transparent upcast of this |
2615 | | // nature, so we explicitly convert. |
2616 | | // (it's just a waste of processor and memory, btw) |
2617 | | // XXX mloskot: See comment for GEOSPolygonize_r |
2618 | |
|
2619 | 0 | std::vector<std::unique_ptr<Geometry>> linevec(lines.size()); |
2620 | |
|
2621 | 0 | for(std::size_t i = 0, n = lines.size(); i < n; ++i) { |
2622 | 0 | linevec[i] = lines[i]->clone(); |
2623 | 0 | } |
2624 | |
|
2625 | 0 | auto out = gf->createGeometryCollection(std::move(linevec)); |
2626 | 0 | out->setSRID(srid); |
2627 | |
|
2628 | 0 | return out.release(); |
2629 | 0 | }); |
2630 | 0 | } |
2631 | | |
2632 | | Geometry* |
2633 | | GEOSPolygonize_full_r(GEOSContextHandle_t extHandle, const Geometry* g, |
2634 | | Geometry** cuts, Geometry** dangles, Geometry** invalid) |
2635 | 0 | { |
2636 | 0 | using geos::operation::polygonize::Polygonizer; |
2637 | |
|
2638 | 0 | return execute(extHandle, [&]() { |
2639 | | // Polygonize |
2640 | 0 | Polygonizer plgnzr; |
2641 | 0 | for(std::size_t i = 0; i < g->getNumGeometries(); ++i) { |
2642 | 0 | plgnzr.add(g->getGeometryN(i)); |
2643 | 0 | } |
2644 | |
|
2645 | 0 | const GeometryFactory* gf = g->getFactory(); |
2646 | |
|
2647 | 0 | if(cuts) { |
2648 | 0 | const std::vector<const LineString*>& lines = plgnzr.getCutEdges(); |
2649 | 0 | std::vector<std::unique_ptr<Geometry>> linevec(lines.size()); |
2650 | 0 | for(std::size_t i = 0, n = lines.size(); i < n; ++i) { |
2651 | 0 | linevec[i] = lines[i]->clone(); |
2652 | 0 | } |
2653 | |
|
2654 | 0 | *cuts = gf->createGeometryCollection(std::move(linevec)).release(); |
2655 | 0 | } |
2656 | |
|
2657 | 0 | if(dangles) { |
2658 | 0 | const std::vector<const LineString*>& lines = plgnzr.getDangles(); |
2659 | 0 | std::vector<std::unique_ptr<Geometry>> linevec(lines.size()); |
2660 | 0 | for(std::size_t i = 0, n = lines.size(); i < n; ++i) { |
2661 | 0 | linevec[i] = lines[i]->clone(); |
2662 | 0 | } |
2663 | |
|
2664 | 0 | *dangles = gf->createGeometryCollection(std::move(linevec)).release(); |
2665 | 0 | } |
2666 | |
|
2667 | 0 | if(invalid) { |
2668 | 0 | const std::vector<std::unique_ptr<LineString>>& lines = plgnzr.getInvalidRingLines(); |
2669 | 0 | std::vector<std::unique_ptr<Geometry>> linevec(lines.size()); |
2670 | 0 | for(std::size_t i = 0, n = lines.size(); i < n; ++i) { |
2671 | 0 | linevec[i] = lines[i]->clone(); |
2672 | 0 | } |
2673 | |
|
2674 | 0 | *invalid = gf->createGeometryCollection(std::move(linevec)).release(); |
2675 | 0 | } |
2676 | |
|
2677 | 0 | auto polys = plgnzr.getPolygons(); |
2678 | 0 | Geometry* out = gf->createGeometryCollection(std::move(polys)).release(); |
2679 | 0 | out->setSRID(g->getSRID()); |
2680 | 0 | return out; |
2681 | 0 | }); |
2682 | 0 | } |
2683 | | |
2684 | | Geometry* |
2685 | | GEOSLineMerge_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2686 | 0 | { |
2687 | 0 | using geos::operation::linemerge::LineMerger; |
2688 | |
|
2689 | 0 | return execute(extHandle, [&]() { |
2690 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2691 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2692 | 0 | LineMerger lmrgr; |
2693 | 0 | lmrgr.add(g); |
2694 | |
|
2695 | 0 | auto lines = lmrgr.getMergedLineStrings(); |
2696 | |
|
2697 | 0 | auto out = gf->buildGeometry(std::move(lines)); |
2698 | 0 | out->setSRID(g->getSRID()); |
2699 | |
|
2700 | 0 | return out.release(); |
2701 | 0 | }); |
2702 | 0 | } |
2703 | | |
2704 | | Geometry* |
2705 | | GEOSLineMergeDirected_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2706 | 0 | { |
2707 | 0 | using geos::operation::linemerge::LineMerger; |
2708 | |
|
2709 | 0 | return execute(extHandle, [&]() { |
2710 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2711 | 0 | const GeometryFactory* gf = handle->geomFactory; |
2712 | 0 | LineMerger lmrgr(true); |
2713 | 0 | lmrgr.add(g); |
2714 | |
|
2715 | 0 | auto lines = lmrgr.getMergedLineStrings(); |
2716 | |
|
2717 | 0 | auto out = gf->buildGeometry(std::move(lines)); |
2718 | 0 | out->setSRID(g->getSRID()); |
2719 | |
|
2720 | 0 | return out.release(); |
2721 | 0 | }); |
2722 | 0 | } |
2723 | | |
2724 | | Geometry* |
2725 | | GEOSLineSubstring_r(GEOSContextHandle_t extHandle, const Geometry* g, double start_fraction, double end_fraction) |
2726 | 0 | { |
2727 | 0 | using geos::linearref::LengthIndexedLine; |
2728 | |
|
2729 | 0 | return execute(extHandle, [&]() { |
2730 | 0 | if (start_fraction < 0 || end_fraction < 0) { |
2731 | 0 | throw IllegalArgumentException("start fraction must be >= 0"); |
2732 | 0 | } |
2733 | 0 | if (start_fraction > 1 || end_fraction > 1) { |
2734 | 0 | throw IllegalArgumentException("end fraction must be <= 1"); |
2735 | 0 | } |
2736 | | |
2737 | 0 | LengthIndexedLine lil(g); |
2738 | |
|
2739 | 0 | auto length = g->getLength(); |
2740 | |
|
2741 | 0 | auto out = lil.extractLine(start_fraction * length, end_fraction * length); |
2742 | 0 | out->setSRID(g->getSRID()); |
2743 | |
|
2744 | 0 | return out.release(); |
2745 | 0 | }); |
2746 | 0 | } |
2747 | | |
2748 | | Geometry* |
2749 | | GEOSReverse_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2750 | 0 | { |
2751 | 0 | return execute(extHandle, [&]() { |
2752 | 0 | auto g3 = g->reverse(); |
2753 | 0 | g3->setSRID(g->getSRID()); |
2754 | 0 | return g3.release(); |
2755 | 0 | }); |
2756 | 0 | } |
2757 | | |
2758 | | void* |
2759 | | GEOSGeom_getUserData_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2760 | 0 | { |
2761 | 0 | return execute(extHandle, [&]() { |
2762 | 0 | return g->getUserData(); |
2763 | 0 | }); |
2764 | 0 | } |
2765 | | |
2766 | | int |
2767 | | GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2768 | 0 | { |
2769 | 0 | return execute(extHandle, 0, [&]() { |
2770 | 0 | return g->getSRID(); |
2771 | 0 | }); |
2772 | 0 | } |
2773 | | |
2774 | | const char* GEOSversion() |
2775 | 0 | { |
2776 | 0 | static char version[256]; |
2777 | 0 | snprintf(version, 256, "%s", GEOS_CAPI_VERSION); |
2778 | 0 | return version; |
2779 | 0 | } |
2780 | | |
2781 | | const char* GEOSjtsport() |
2782 | 0 | { |
2783 | 0 | return GEOS_JTS_PORT; |
2784 | 0 | } |
2785 | | |
2786 | | char |
2787 | | GEOSHasZ_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2788 | 0 | { |
2789 | 0 | return execute(extHandle, 2, [&]() { |
2790 | 0 | return g->hasZ(); |
2791 | 0 | }); |
2792 | 0 | } |
2793 | | |
2794 | | char |
2795 | | GEOSHasM_r(GEOSContextHandle_t extHandle, const Geometry* g) |
2796 | 0 | { |
2797 | 0 | return execute(extHandle, 2, [&]() { |
2798 | 0 | return g->hasM(); |
2799 | 0 | }); |
2800 | 0 | } |
2801 | | |
2802 | | int |
2803 | | GEOS_getWKBOutputDims_r(GEOSContextHandle_t extHandle) |
2804 | 0 | { |
2805 | 0 | return execute(extHandle, -1, [&]() -> int { |
2806 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
2807 | 0 | return handle->WKBOutputDims; |
2808 | 0 | }); |
2809 | 0 | } |
2810 | | |
2811 | | int |
2812 | | GEOS_setWKBOutputDims_r(GEOSContextHandle_t extHandle, int newdims) |
2813 | 0 | { |
2814 | 0 | return execute(extHandle, -1, [&]() { |
2815 | 0 | GEOSContextHandleInternal_t *handle = reinterpret_cast<GEOSContextHandleInternal_t *>(extHandle); |
2816 | |
|
2817 | 0 | if (newdims < 2 || newdims > 4) { |
2818 | 0 | handle->ERROR_MESSAGE("WKB output dimensions out of range 2..4"); |
2819 | 0 | } |
2820 | |
|
2821 | 0 | const int olddims = handle->WKBOutputDims; |
2822 | 0 | handle->WKBOutputDims = static_cast<uint8_t>(newdims); |
2823 | |
|
2824 | 0 | return olddims; |
2825 | 0 | }); |
2826 | 0 | } |
2827 | | |
2828 | | int |
2829 | | GEOS_getWKBByteOrder_r(GEOSContextHandle_t extHandle) |
2830 | 0 | { |
2831 | 0 | return execute(extHandle, -1, [&]() { |
2832 | 0 | GEOSContextHandleInternal_t *handle = reinterpret_cast<GEOSContextHandleInternal_t *>(extHandle); |
2833 | 0 | return handle->WKBByteOrder; |
2834 | 0 | }); |
2835 | 0 | } |
2836 | | |
2837 | | int |
2838 | | GEOS_setWKBByteOrder_r(GEOSContextHandle_t extHandle, int byteOrder) |
2839 | 0 | { |
2840 | 0 | return execute(extHandle, -1, [&]() { |
2841 | 0 | GEOSContextHandleInternal_t *handle = reinterpret_cast<GEOSContextHandleInternal_t *>(extHandle); |
2842 | 0 | const int oldByteOrder = handle->WKBByteOrder; |
2843 | 0 | handle->WKBByteOrder = byteOrder; |
2844 | |
|
2845 | 0 | return oldByteOrder; |
2846 | 0 | }); |
2847 | 0 | } |
2848 | | |
2849 | | |
2850 | | CoordinateSequence* |
2851 | | GEOSCoordSeq_create_r(GEOSContextHandle_t extHandle, unsigned int size, unsigned int dims) |
2852 | 0 | { |
2853 | 0 | return execute(extHandle, [&]() { |
2854 | 0 | return new CoordinateSequence(size, dims); |
2855 | 0 | }); |
2856 | 0 | } |
2857 | | |
2858 | | CoordinateSequence* |
2859 | | GEOSCoordSeq_createWithDimensions_r(GEOSContextHandle_t extHandle, unsigned int size, int hasZ, int hasM) |
2860 | 0 | { |
2861 | 0 | return execute(extHandle, [&]() { |
2862 | 0 | return new CoordinateSequence(size, hasZ, hasM); |
2863 | 0 | }); |
2864 | 0 | } |
2865 | | |
2866 | | CoordinateSequence* |
2867 | | GEOSCoordSeq_copyFromBuffer_r(GEOSContextHandle_t extHandle, const double* buf, unsigned int size, int hasZ, int hasM) |
2868 | 0 | { |
2869 | 0 | return execute(extHandle, [&]() { |
2870 | 0 | std::ptrdiff_t stride = 2 + hasZ + hasM; |
2871 | 0 | auto coords = geos::detail::make_unique<CoordinateSequence>(size, hasZ, hasM, false); |
2872 | 0 | if (hasZ) { |
2873 | 0 | if (hasM) { |
2874 | | // XYZM |
2875 | 0 | assert(coords->getCoordinateType() == geos::geom::CoordinateType::XYZM); |
2876 | 0 | std::memcpy(coords->data(), buf, size * sizeof(CoordinateXYZM)); |
2877 | 0 | } else { |
2878 | | // XYZ |
2879 | 0 | assert(coords->getCoordinateType() == geos::geom::CoordinateType::XYZ); |
2880 | 0 | std::memcpy(coords->data(), buf, size * sizeof(Coordinate)); |
2881 | 0 | } |
2882 | 0 | } else { |
2883 | 0 | if (hasM) { |
2884 | | // XYM |
2885 | 0 | for (std::size_t i = 0; i < size; i++) { |
2886 | 0 | coords->setAt(CoordinateXYM{ *buf, *(buf + 1), *(buf + 2)}, i); |
2887 | 0 | buf += stride; |
2888 | 0 | } |
2889 | 0 | } else { |
2890 | | // XY |
2891 | 0 | for (std::size_t i = 0; i < size; i++) { |
2892 | 0 | coords->setAt(Coordinate{ *buf, *(buf + 1) }, i); |
2893 | 0 | buf += stride; |
2894 | 0 | } |
2895 | 0 | } |
2896 | 0 | } |
2897 | |
|
2898 | 0 | return coords.release(); |
2899 | 0 | }); |
2900 | 0 | } |
2901 | | |
2902 | | CoordinateSequence* |
2903 | | GEOSCoordSeq_copyFromArrays_r(GEOSContextHandle_t extHandle, const double* x, const double* y, const double* z, const double* m, unsigned int size) |
2904 | 0 | { |
2905 | 0 | return execute(extHandle, [&]() { |
2906 | 0 | bool hasZ = z != nullptr; |
2907 | 0 | bool hasM = m != nullptr; |
2908 | |
|
2909 | 0 | auto coords = geos::detail::make_unique<geos::geom::CoordinateSequence>(size, hasZ, hasM, false); |
2910 | |
|
2911 | 0 | CoordinateXYZM c; |
2912 | 0 | for (std::size_t i = 0; i < size; i++) { |
2913 | 0 | c.x = x[i]; |
2914 | 0 | c.y = y[i]; |
2915 | 0 | if (z) { |
2916 | 0 | c.z = z[i]; |
2917 | 0 | } |
2918 | 0 | if (m) { |
2919 | 0 | c.m = m[i]; |
2920 | 0 | } |
2921 | |
|
2922 | 0 | coords->setAt(c, i); |
2923 | 0 | } |
2924 | |
|
2925 | 0 | return coords.release(); |
2926 | 0 | }); |
2927 | 0 | } |
2928 | | |
2929 | | int |
2930 | | GEOSCoordSeq_copyToArrays_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, |
2931 | | double* x, double* y, double* z, double* m) |
2932 | 0 | { |
2933 | 0 | return execute(extHandle, 0, [&]() { |
2934 | 0 | CoordinateXYZM c; |
2935 | 0 | for (std::size_t i = 0; i < cs->size(); i++) { |
2936 | 0 | cs->getAt(i, c); |
2937 | 0 | x[i] = c.x; |
2938 | 0 | y[i] = c.y; |
2939 | 0 | if (z) { |
2940 | 0 | z[i] = c.z; |
2941 | 0 | } |
2942 | 0 | if (m) { |
2943 | 0 | m[i] = c.m; |
2944 | 0 | } |
2945 | 0 | } |
2946 | |
|
2947 | 0 | return 1; |
2948 | 0 | }); |
2949 | 0 | } |
2950 | | |
2951 | | int |
2952 | | GEOSCoordSeq_copyToBuffer_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, |
2953 | | double* buf, int hasZ, int hasM) |
2954 | 0 | { |
2955 | 0 | using geos::geom::CoordinateType; |
2956 | |
|
2957 | 0 | return execute(extHandle, 0, [&]() { |
2958 | 0 | CoordinateType srcType = cs->getCoordinateType(); |
2959 | 0 | CoordinateType dstType; |
2960 | 0 | std::size_t stride; |
2961 | 0 | if (hasZ) { |
2962 | 0 | if (hasM) { |
2963 | 0 | dstType = CoordinateType::XYZM; |
2964 | 0 | stride = 4; |
2965 | 0 | } else { |
2966 | 0 | dstType = CoordinateType::XYZ; |
2967 | 0 | stride = 3; |
2968 | 0 | } |
2969 | 0 | } else { |
2970 | 0 | if (hasM) { |
2971 | 0 | dstType = CoordinateType::XYM; |
2972 | 0 | stride = 3; |
2973 | 0 | } else { |
2974 | 0 | dstType = CoordinateType::XY; |
2975 | 0 | stride = 2; |
2976 | 0 | } |
2977 | 0 | } |
2978 | |
|
2979 | 0 | if (srcType == dstType) { |
2980 | 0 | std::memcpy(buf, cs->data(), cs->size() * stride * sizeof(double)); |
2981 | 0 | } else { |
2982 | 0 | switch(dstType) { |
2983 | 0 | case CoordinateType::XY: { |
2984 | 0 | for (std::size_t i = 0; i < cs->size(); i++) { |
2985 | 0 | CoordinateXY* c = reinterpret_cast<CoordinateXY*>(buf + i*stride); |
2986 | 0 | cs->getAt(i, *c); |
2987 | 0 | } |
2988 | 0 | break; |
2989 | 0 | } |
2990 | 0 | case CoordinateType::XYZ: { |
2991 | 0 | for (std::size_t i = 0; i < cs->size(); i++) { |
2992 | 0 | Coordinate* c = reinterpret_cast<Coordinate*>(buf + i*stride); |
2993 | 0 | cs->getAt(i, *c); |
2994 | 0 | } |
2995 | 0 | break; |
2996 | 0 | } |
2997 | 0 | case CoordinateType::XYM: { |
2998 | 0 | for (std::size_t i = 0; i < cs->size(); i++) { |
2999 | 0 | CoordinateXYM* c = reinterpret_cast<CoordinateXYM*>(buf + i*stride); |
3000 | 0 | cs->getAt(i, *c); |
3001 | 0 | } |
3002 | 0 | break; |
3003 | 0 | } |
3004 | 0 | case CoordinateType::XYZM: { |
3005 | 0 | for (std::size_t i = 0; i < cs->size(); i++) { |
3006 | 0 | CoordinateXYZM* c = reinterpret_cast<CoordinateXYZM*>(buf + i*stride); |
3007 | 0 | cs->getAt(i, *c); |
3008 | 0 | } |
3009 | 0 | break; |
3010 | 0 | } |
3011 | 0 | } |
3012 | 0 | } |
3013 | | |
3014 | 0 | return 1; |
3015 | 0 | }); |
3016 | 0 | } |
3017 | | |
3018 | | char |
3019 | | GEOSCoordSeq_hasZ_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) |
3020 | 0 | { |
3021 | 0 | return execute(extHandle, 2, [&]() { |
3022 | 0 | return cs->hasZ(); |
3023 | 0 | }); |
3024 | 0 | } |
3025 | | |
3026 | | char |
3027 | | GEOSCoordSeq_hasM_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) |
3028 | 0 | { |
3029 | 0 | return execute(extHandle, 2, [&]() { |
3030 | 0 | return cs->hasM(); |
3031 | 0 | }); |
3032 | 0 | } |
3033 | | |
3034 | | int |
3035 | | GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs, |
3036 | | unsigned int idx, unsigned int dim, double val) |
3037 | 0 | { |
3038 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3039 | 0 | cs->setOrdinate(idx, dim, val); |
3040 | 0 | return 1; |
3041 | 0 | }); |
3042 | 0 | } |
3043 | | |
3044 | | int |
3045 | | GEOSCoordSeq_setX_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) |
3046 | 0 | { |
3047 | 0 | return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, CoordinateSequence::X, val); |
3048 | 0 | } |
3049 | | |
3050 | | int |
3051 | | GEOSCoordSeq_setY_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) |
3052 | 0 | { |
3053 | 0 | return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, CoordinateSequence::Y, val); |
3054 | 0 | } |
3055 | | |
3056 | | int |
3057 | | GEOSCoordSeq_setZ_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) |
3058 | 0 | { |
3059 | 0 | return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, CoordinateSequence::Z, val); |
3060 | 0 | } |
3061 | | |
3062 | | int |
3063 | | GEOSCoordSeq_setM_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) |
3064 | 0 | { |
3065 | 0 | return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, CoordinateSequence::M, val); |
3066 | 0 | } |
3067 | | |
3068 | | int |
3069 | | GEOSCoordSeq_setXY_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs, unsigned int idx, double x, double y) |
3070 | 0 | { |
3071 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3072 | 0 | cs->setAt(CoordinateXY{x, y}, idx); |
3073 | 0 | return 1; |
3074 | 0 | }); |
3075 | 0 | } |
3076 | | |
3077 | | int |
3078 | | GEOSCoordSeq_setXYZ_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs, unsigned int idx, double x, double y, double z) |
3079 | 0 | { |
3080 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3081 | 0 | cs->setAt(Coordinate{x, y, z}, idx); |
3082 | 0 | return 1; |
3083 | 0 | }); |
3084 | 0 | } |
3085 | | |
3086 | | CoordinateSequence* |
3087 | | GEOSCoordSeq_clone_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs) |
3088 | 0 | { |
3089 | 0 | return execute(extHandle, [&]() { |
3090 | 0 | return cs->clone().release(); |
3091 | 0 | }); |
3092 | 0 | } |
3093 | | |
3094 | | int |
3095 | | GEOSCoordSeq_getOrdinate_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, |
3096 | | unsigned int idx, unsigned int dim, double* val) |
3097 | 0 | { |
3098 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3099 | 0 | *val = cs->getOrdinate(idx, dim); |
3100 | 0 | return 1; |
3101 | 0 | }); |
3102 | 0 | } |
3103 | | |
3104 | | int |
3105 | | GEOSCoordSeq_getX_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) |
3106 | 0 | { |
3107 | 0 | return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, CoordinateSequence::X, val); |
3108 | 0 | } |
3109 | | |
3110 | | int |
3111 | | GEOSCoordSeq_getY_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) |
3112 | 0 | { |
3113 | 0 | return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, CoordinateSequence::Y, val); |
3114 | 0 | } |
3115 | | |
3116 | | int |
3117 | | GEOSCoordSeq_getZ_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) |
3118 | 0 | { |
3119 | 0 | return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, CoordinateSequence::Z, val); |
3120 | 0 | } |
3121 | | |
3122 | | int |
3123 | | GEOSCoordSeq_getM_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) |
3124 | 0 | { |
3125 | 0 | return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, CoordinateSequence::M, val); |
3126 | 0 | } |
3127 | | |
3128 | | int |
3129 | | GEOSCoordSeq_getXY_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int idx, double* x, double* y) |
3130 | 0 | { |
3131 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3132 | 0 | auto& c = cs->getAt<CoordinateXY>(idx); |
3133 | 0 | *x = c.x; |
3134 | 0 | *y = c.y; |
3135 | 0 | return 1; |
3136 | 0 | }); |
3137 | 0 | } |
3138 | | |
3139 | | int |
3140 | | GEOSCoordSeq_getXYZ_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int idx, double* x, double* y, double* z) |
3141 | 0 | { |
3142 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3143 | 0 | auto& c = cs->getAt(idx); |
3144 | 0 | *x = c.x; |
3145 | 0 | *y = c.y; |
3146 | 0 | *z = c.z; |
3147 | 0 | return 1; |
3148 | 0 | }); |
3149 | 0 | } |
3150 | | |
3151 | | int |
3152 | | GEOSCoordSeq_getSize_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int* size) |
3153 | 0 | { |
3154 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3155 | 0 | const std::size_t sz = cs->getSize(); |
3156 | 0 | *size = static_cast<unsigned int>(sz); |
3157 | 0 | return 1; |
3158 | 0 | }); |
3159 | 0 | } |
3160 | | |
3161 | | int |
3162 | | GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int* dims) |
3163 | 0 | { |
3164 | 0 | return execute<NotInterruptible>(extHandle, 0, [&]() { |
3165 | 0 | const std::size_t dim = cs->getDimension(); |
3166 | 0 | *dims = static_cast<unsigned int>(dim); |
3167 | |
|
3168 | 0 | return 1; |
3169 | 0 | }); |
3170 | 0 | } |
3171 | | |
3172 | | int |
3173 | | GEOSCoordSeq_isCCW_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, char* val) |
3174 | 0 | { |
3175 | 0 | return execute(extHandle, 0, [&]() { |
3176 | 0 | *val = geos::algorithm::Orientation::isCCW(cs); |
3177 | 0 | return 1; |
3178 | 0 | }); |
3179 | 0 | } |
3180 | | |
3181 | | void |
3182 | | GEOSCoordSeq_destroy_r(GEOSContextHandle_t extHandle, CoordinateSequence* s) |
3183 | 0 | { |
3184 | 0 | return execute(extHandle, [&]() { |
3185 | 0 | delete s; |
3186 | 0 | }); |
3187 | 0 | } |
3188 | | |
3189 | | const CoordinateSequence* |
3190 | | GEOSGeom_getCoordSeq_r(GEOSContextHandle_t extHandle, const Geometry* g) |
3191 | 0 | { |
3192 | 0 | return execute(extHandle, [&]() { |
3193 | 0 | const SimpleCurve* ls = dynamic_cast<const SimpleCurve*>(g); |
3194 | 0 | if(ls) { |
3195 | 0 | return ls->getCoordinatesRO(); |
3196 | 0 | } |
3197 | | |
3198 | 0 | const Point* p = dynamic_cast<const Point*>(g); |
3199 | 0 | if(p) { |
3200 | 0 | return p->getCoordinatesRO(); |
3201 | 0 | } |
3202 | | |
3203 | 0 | throw IllegalArgumentException("Geometry must be a Point or LineString"); |
3204 | 0 | }); |
3205 | 0 | } |
3206 | | |
3207 | | Geometry* |
3208 | | GEOSGeom_createEmptyPoint_r(GEOSContextHandle_t extHandle) |
3209 | 0 | { |
3210 | 0 | return execute(extHandle, [&]() { |
3211 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3212 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3213 | 0 | return gf->createPoint().release(); |
3214 | 0 | }); |
3215 | 0 | } |
3216 | | |
3217 | | Geometry* |
3218 | | GEOSGeom_createPoint_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) |
3219 | 0 | { |
3220 | 0 | return execute(extHandle, [&]() { |
3221 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3222 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3223 | |
|
3224 | 0 | return gf->createPoint(std::unique_ptr<CoordinateSequence>(cs)).release(); |
3225 | 0 | }); |
3226 | 0 | } |
3227 | | |
3228 | | Geometry* |
3229 | | GEOSGeom_createPointFromXY_r(GEOSContextHandle_t extHandle, double x, double y) |
3230 | 0 | { |
3231 | 0 | return execute(extHandle, [&]() { |
3232 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3233 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3234 | |
|
3235 | 0 | CoordinateXY c(x, y); |
3236 | 0 | return gf->createPoint(c).release(); |
3237 | 0 | }); |
3238 | 0 | } |
3239 | | |
3240 | | Geometry* |
3241 | | GEOSGeom_createLinearRing_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) |
3242 | 0 | { |
3243 | 0 | return execute(extHandle, [&]() { |
3244 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3245 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3246 | |
|
3247 | 0 | return gf->createLinearRing(std::unique_ptr<CoordinateSequence>(cs)).release(); |
3248 | 0 | }); |
3249 | 0 | } |
3250 | | |
3251 | | Geometry* |
3252 | | GEOSGeom_createEmptyLineString_r(GEOSContextHandle_t extHandle) |
3253 | 0 | { |
3254 | 0 | return execute(extHandle, [&]() { |
3255 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3256 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3257 | |
|
3258 | 0 | return gf->createLineString().release(); |
3259 | 0 | }); |
3260 | 0 | } |
3261 | | |
3262 | | Geometry* |
3263 | | GEOSGeom_createLineString_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) |
3264 | 0 | { |
3265 | 0 | return execute(extHandle, [&]() { |
3266 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3267 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3268 | |
|
3269 | 0 | return gf->createLineString(std::unique_ptr<CoordinateSequence>(cs)).release(); |
3270 | 0 | }); |
3271 | 0 | } |
3272 | | |
3273 | | Geometry* |
3274 | | GEOSGeom_createEmptyPolygon_r(GEOSContextHandle_t extHandle) |
3275 | 0 | { |
3276 | 0 | return execute(extHandle, [&]() { |
3277 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3278 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3279 | 0 | return gf->createPolygon().release(); |
3280 | 0 | }); |
3281 | 0 | } |
3282 | | |
3283 | | Geometry* |
3284 | | GEOSGeom_createPolygon_r(GEOSContextHandle_t extHandle, Geometry* shell, Geometry** holes, unsigned int nholes) |
3285 | 0 | { |
3286 | 0 | return execute(extHandle, [&]() { |
3287 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3288 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3289 | 0 | bool good_holes = true, good_shell = true; |
3290 | | |
3291 | | // Validate input before taking ownership |
3292 | 0 | for (std::size_t i = 0; i < nholes; i++) { |
3293 | 0 | if ((!holes) || (!dynamic_cast<LinearRing*>(holes[i]))) { |
3294 | 0 | good_holes = false; |
3295 | 0 | break; |
3296 | 0 | } |
3297 | 0 | } |
3298 | 0 | if (!dynamic_cast<LinearRing*>(shell)) { |
3299 | 0 | good_shell = false; |
3300 | 0 | } |
3301 | | |
3302 | | // Contract for GEOSGeom_createPolygon is to take ownership of arguments |
3303 | | // which implies freeing them on exception, |
3304 | | // see https://trac.osgeo.org/geos/ticket/1111 |
3305 | 0 | if (!(good_holes && good_shell)) { |
3306 | 0 | if (shell) delete shell; |
3307 | 0 | for (std::size_t i = 0; i < nholes; i++) { |
3308 | 0 | if (holes && holes[i]) |
3309 | 0 | delete holes[i]; |
3310 | 0 | } |
3311 | 0 | if (!good_shell) |
3312 | 0 | throw IllegalArgumentException("Shell is not a LinearRing"); |
3313 | 0 | else |
3314 | 0 | throw IllegalArgumentException("Hole is not a LinearRing"); |
3315 | 0 | } |
3316 | | |
3317 | 0 | std::unique_ptr<LinearRing> tmpshell(static_cast<LinearRing*>(shell)); |
3318 | 0 | if (nholes) { |
3319 | 0 | std::vector<std::unique_ptr<LinearRing>> tmpholes(nholes); |
3320 | 0 | for (size_t i = 0; i < nholes; i++) { |
3321 | 0 | tmpholes[i].reset(static_cast<LinearRing*>(holes[i])); |
3322 | 0 | } |
3323 | |
|
3324 | 0 | return gf->createPolygon(std::move(tmpshell), std::move(tmpholes)).release(); |
3325 | 0 | } |
3326 | | |
3327 | 0 | return gf->createPolygon(std::move(tmpshell)).release(); |
3328 | 0 | }); |
3329 | 0 | } |
3330 | | |
3331 | | Geometry* |
3332 | | GEOSGeom_createRectangle_r(GEOSContextHandle_t extHandle, |
3333 | | double xmin, double ymin, |
3334 | | double xmax, double ymax) |
3335 | 0 | { |
3336 | 0 | return execute(extHandle, [&]() { |
3337 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3338 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3339 | 0 | Envelope env(xmin, xmax, ymin, ymax); |
3340 | 0 | return (gf->toGeometry(&env)).release(); |
3341 | 0 | }); |
3342 | 0 | } |
3343 | | |
3344 | | Geometry* |
3345 | | GEOSGeom_createCircularString_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) |
3346 | 0 | { |
3347 | 0 | return execute(extHandle, [&]() { |
3348 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3349 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3350 | |
|
3351 | 0 | return gf->createCircularString(std::unique_ptr<CoordinateSequence>(cs)).release(); |
3352 | 0 | }); |
3353 | 0 | } |
3354 | | |
3355 | | Geometry* |
3356 | | GEOSGeom_createEmptyCircularString_r(GEOSContextHandle_t extHandle) |
3357 | 0 | { |
3358 | 0 | return execute(extHandle, [&]() { |
3359 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3360 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3361 | |
|
3362 | 0 | return gf->createCircularString(false, false).release(); |
3363 | 0 | }); |
3364 | 0 | } |
3365 | | |
3366 | | Geometry* |
3367 | | GEOSGeom_createCompoundCurve_r(GEOSContextHandle_t extHandle, Geometry** geoms, unsigned int ngeoms) |
3368 | 0 | { |
3369 | 0 | return execute(extHandle, [&]() -> Geometry* { |
3370 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3371 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3372 | |
|
3373 | 0 | bool invalid_input = false; |
3374 | 0 | std::vector<std::unique_ptr<SimpleCurve>> geom_vec(ngeoms); |
3375 | 0 | for (std::size_t i = 0; i < ngeoms; i++) { |
3376 | 0 | if (SimpleCurve* c = dynamic_cast<SimpleCurve*>(geoms[i])) { |
3377 | 0 | geom_vec[i].reset(c); |
3378 | 0 | } else { |
3379 | 0 | delete geoms[i]; |
3380 | 0 | invalid_input = true; |
3381 | 0 | } |
3382 | 0 | } |
3383 | |
|
3384 | 0 | if (invalid_input) { |
3385 | 0 | throw IllegalArgumentException("Input is not a SimpleCurve"); |
3386 | 0 | } |
3387 | | |
3388 | 0 | return gf->createCompoundCurve(std::move(geom_vec)).release(); |
3389 | 0 | }); |
3390 | 0 | } |
3391 | | |
3392 | | Geometry* |
3393 | | GEOSGeom_createEmptyCompoundCurve_r(GEOSContextHandle_t extHandle) |
3394 | 0 | { |
3395 | 0 | return execute(extHandle, [&]() { |
3396 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3397 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3398 | |
|
3399 | 0 | return gf->createCompoundCurve().release(); |
3400 | 0 | }); |
3401 | 0 | } |
3402 | | |
3403 | | Geometry* |
3404 | | GEOSGeom_createCurvePolygon_r(GEOSContextHandle_t extHandle, Geometry* p_shell, Geometry** p_holes, unsigned int nholes) |
3405 | 0 | { |
3406 | 0 | return execute(extHandle, [&]() { |
3407 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3408 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3409 | 0 | bool good_holes = true, good_shell = true; |
3410 | |
|
3411 | 0 | std::unique_ptr<Curve> shell; |
3412 | 0 | std::vector<std::unique_ptr<Curve>> holes(nholes); |
3413 | |
|
3414 | 0 | if (Curve* c = dynamic_cast<Curve*>(p_shell)) { |
3415 | 0 | shell.reset(c); |
3416 | 0 | } else { |
3417 | 0 | good_shell = false; |
3418 | 0 | delete p_shell; |
3419 | 0 | } |
3420 | |
|
3421 | 0 | for (std::size_t i = 0; i < nholes; i++) { |
3422 | 0 | if (Curve* c = dynamic_cast<Curve*>(p_holes[i])) { |
3423 | 0 | holes[i].reset(c); |
3424 | 0 | } else { |
3425 | 0 | good_shell = false; |
3426 | 0 | delete p_holes[i]; |
3427 | 0 | } |
3428 | 0 | } |
3429 | |
|
3430 | 0 | if (good_shell && good_holes) { |
3431 | 0 | return gf->createCurvePolygon(std::move(shell), std::move(holes)).release(); |
3432 | 0 | } else if (!good_shell) { |
3433 | 0 | throw IllegalArgumentException("Shell is not a Curve"); |
3434 | 0 | } else { |
3435 | 0 | throw IllegalArgumentException("Hole is not a Curve"); |
3436 | 0 | } |
3437 | 0 | }); |
3438 | 0 | } |
3439 | | |
3440 | | |
3441 | | Geometry* |
3442 | | GEOSGeom_createEmptyCurvePolygon_r(GEOSContextHandle_t extHandle) |
3443 | 0 | { |
3444 | 0 | return execute(extHandle, [&]() { |
3445 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3446 | 0 | const GeometryFactory* gf = handle->geomFactory; |
3447 | 0 | return gf->createCurvePolygon(false, false).release(); |
3448 | 0 | }); |
3449 | 0 | } |
3450 | | |
3451 | | Geometry* |
3452 | | GEOSGeom_clone_r(GEOSContextHandle_t extHandle, const Geometry* g) |
3453 | 0 | { |
3454 | 0 | return execute(extHandle, [&]() { |
3455 | 0 | return g->clone().release(); |
3456 | 0 | }); |
3457 | 0 | } |
3458 | | |
3459 | | Geometry* |
3460 | | GEOSGeom_setPrecision_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g, |
3461 | | double gridSize, int flags) |
3462 | 0 | { |
3463 | 0 | return execute(extHandle, [&]() { |
3464 | 0 | PrecisionModel newpm; |
3465 | 0 | if(gridSize != 0) { |
3466 | | // Convert gridSize to scale factor |
3467 | 0 | double scale = 1.0 / std::abs(gridSize); |
3468 | 0 | newpm = PrecisionModel(scale); |
3469 | 0 | } |
3470 | |
|
3471 | 0 | const PrecisionModel* pm = g->getPrecisionModel(); |
3472 | 0 | double cursize = pm->isFloating() ? 0 : 1.0 / pm->getScale(); |
3473 | 0 | std::unique_ptr<Geometry> ret; |
3474 | 0 | GeometryFactory::Ptr gf = |
3475 | 0 | GeometryFactory::create(&newpm, g->getSRID()); |
3476 | 0 | if(gridSize != 0 && cursize != gridSize) { |
3477 | 0 | GeometryPrecisionReducer reducer(*gf); |
3478 | 0 | reducer.setChangePrecisionModel(true); |
3479 | 0 | reducer.setUseAreaReducer(!(flags & GEOS_PREC_NO_TOPO)); |
3480 | 0 | reducer.setPointwise(flags & GEOS_PREC_NO_TOPO); |
3481 | 0 | reducer.setRemoveCollapsedComponents(!(flags & GEOS_PREC_KEEP_COLLAPSED)); |
3482 | 0 | ret = reducer.reduce(*g); |
3483 | 0 | } |
3484 | 0 | else { |
3485 | | // No need or willing to snap, just change the factory |
3486 | 0 | ret = gf->createGeometry(g); |
3487 | 0 | } |
3488 | 0 | return ret.release(); |
3489 | 0 | }); |
3490 | 0 | } |
3491 | | |
3492 | | double |
3493 | | GEOSGeom_getPrecision_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g) |
3494 | 0 | { |
3495 | 0 | return execute(extHandle, -1.0, [&]() { |
3496 | 0 | const PrecisionModel* pm = g->getPrecisionModel(); |
3497 | 0 | double cursize = pm->isFloating() ? 0 : 1.0 / pm->getScale(); |
3498 | 0 | return cursize; |
3499 | 0 | }); |
3500 | 0 | } |
3501 | | |
3502 | | int |
3503 | | GEOSGeom_getDimensions_r(GEOSContextHandle_t extHandle, const Geometry* g) |
3504 | 0 | { |
3505 | 0 | return execute(extHandle, 0, [&]() { |
3506 | 0 | return (int) g->getDimension(); |
3507 | 0 | }); |
3508 | 0 | } |
3509 | | |
3510 | | int |
3511 | | GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t extHandle, const Geometry* g) |
3512 | 0 | { |
3513 | 0 | return execute(extHandle, 0, [&]() { |
3514 | 0 | return (int)(g->getCoordinateDimension()); |
3515 | 0 | }); |
3516 | 0 | } |
3517 | | |
3518 | | int |
3519 | | GEOSGeom_getXMin_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) |
3520 | 0 | { |
3521 | 0 | return execute(extHandle, 0, [&]() { |
3522 | 0 | if(g->isEmpty()) { |
3523 | 0 | return 0; |
3524 | 0 | } |
3525 | | |
3526 | 0 | *value = g->getEnvelopeInternal()->getMinX(); |
3527 | 0 | return 1; |
3528 | 0 | }); |
3529 | 0 | } |
3530 | | |
3531 | | int |
3532 | | GEOSGeom_getXMax_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) |
3533 | 0 | { |
3534 | 0 | return execute(extHandle, 0, [&]() { |
3535 | 0 | if(g->isEmpty()) { |
3536 | 0 | return 0; |
3537 | 0 | } |
3538 | | |
3539 | 0 | *value = g->getEnvelopeInternal()->getMaxX(); |
3540 | 0 | return 1; |
3541 | 0 | }); |
3542 | 0 | } |
3543 | | |
3544 | | int |
3545 | | GEOSGeom_getYMin_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) |
3546 | 0 | { |
3547 | 0 | return execute(extHandle, 0, [&]() { |
3548 | 0 | if(g->isEmpty()) { |
3549 | 0 | return 0; |
3550 | 0 | } |
3551 | | |
3552 | 0 | *value = g->getEnvelopeInternal()->getMinY(); |
3553 | 0 | return 1; |
3554 | 0 | }); |
3555 | 0 | } |
3556 | | |
3557 | | int |
3558 | | GEOSGeom_getYMax_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) |
3559 | 0 | { |
3560 | 0 | return execute(extHandle, 0, [&]() { |
3561 | 0 | if(g->isEmpty()) { |
3562 | 0 | return 0; |
3563 | 0 | } |
3564 | | |
3565 | 0 | *value = g->getEnvelopeInternal()->getMaxY(); |
3566 | 0 | return 1; |
3567 | 0 | }); |
3568 | 0 | } |
3569 | | |
3570 | | int |
3571 | | GEOSGeom_getExtent_r(GEOSContextHandle_t extHandle, const Geometry* g, double* xmin, double* ymin, double* xmax, double* ymax) |
3572 | 0 | { |
3573 | 0 | return execute(extHandle, 0, [&]() { |
3574 | 0 | if(g->isEmpty()) { |
3575 | 0 | return 0; |
3576 | 0 | } |
3577 | 0 | const Envelope* extent = g->getEnvelopeInternal(); |
3578 | 0 | *xmin = extent->getMinX(); |
3579 | 0 | *ymin = extent->getMinY(); |
3580 | 0 | *xmax = extent->getMaxX(); |
3581 | 0 | *ymax = extent->getMaxY(); |
3582 | 0 | return 1; |
3583 | 0 | }); |
3584 | 0 | } |
3585 | | |
3586 | | Geometry* |
3587 | | GEOSSimplify_r(GEOSContextHandle_t extHandle, const Geometry* g1, double tolerance) |
3588 | 0 | { |
3589 | 0 | return execute(extHandle, [&]() { |
3590 | 0 | Geometry::Ptr g3(geos::simplify::DouglasPeuckerSimplifier::simplify(g1, tolerance)); |
3591 | 0 | g3->setSRID(g1->getSRID()); |
3592 | 0 | return g3.release(); |
3593 | 0 | }); |
3594 | 0 | } |
3595 | | |
3596 | | Geometry* |
3597 | | GEOSTopologyPreserveSimplify_r(GEOSContextHandle_t extHandle, const Geometry* g1, double tolerance) |
3598 | 0 | { |
3599 | 0 | return execute(extHandle, [&]() { |
3600 | 0 | Geometry::Ptr g3(geos::simplify::TopologyPreservingSimplifier::simplify(g1, tolerance)); |
3601 | 0 | g3->setSRID(g1->getSRID()); |
3602 | 0 | return g3.release(); |
3603 | 0 | }); |
3604 | 0 | } |
3605 | | |
3606 | | |
3607 | | /* WKT Reader */ |
3608 | | WKTReader* |
3609 | | GEOSWKTReader_create_r(GEOSContextHandle_t extHandle) |
3610 | 0 | { |
3611 | 0 | return execute(extHandle, [&]() { |
3612 | 0 | GEOSContextHandleInternal_t *handle = reinterpret_cast<GEOSContextHandleInternal_t *>(extHandle); |
3613 | 0 | return new WKTReader((GeometryFactory *) handle->geomFactory); |
3614 | 0 | }); |
3615 | 0 | } |
3616 | | |
3617 | | void |
3618 | | GEOSWKTReader_destroy_r(GEOSContextHandle_t extHandle, WKTReader* reader) |
3619 | 0 | { |
3620 | 0 | return execute(extHandle, [&]() { |
3621 | 0 | delete reader; |
3622 | 0 | }); |
3623 | 0 | } |
3624 | | |
3625 | | void |
3626 | | GEOSWKTReader_setFixStructure_r(GEOSContextHandle_t extHandle, WKTReader* reader, char doFix) |
3627 | 0 | { |
3628 | 0 | return execute(extHandle, [&]() { |
3629 | 0 | return reader->setFixStructure(doFix); |
3630 | 0 | }); |
3631 | 0 | } |
3632 | | |
3633 | | Geometry* |
3634 | | GEOSWKTReader_read_r(GEOSContextHandle_t extHandle, WKTReader* reader, const char* wkt) |
3635 | 0 | { |
3636 | 0 | return execute(extHandle, [&]() { |
3637 | 0 | const std::string wktstring(wkt); |
3638 | 0 | return reader->read(wktstring).release(); |
3639 | 0 | }); |
3640 | 0 | } |
3641 | | |
3642 | | /* WKT Writer */ |
3643 | | WKTWriter* |
3644 | | GEOSWKTWriter_create_r(GEOSContextHandle_t extHandle) |
3645 | 0 | { |
3646 | 0 | using geos::io::WKTWriter; |
3647 | |
|
3648 | 0 | return execute(extHandle, [&]() { |
3649 | 0 | return new WKTWriter(); |
3650 | 0 | }); |
3651 | 0 | } |
3652 | | |
3653 | | void |
3654 | | GEOSWKTWriter_destroy_r(GEOSContextHandle_t extHandle, WKTWriter* Writer) |
3655 | 0 | { |
3656 | 0 | execute(extHandle, [&]() { |
3657 | 0 | delete Writer; |
3658 | 0 | }); |
3659 | 0 | } |
3660 | | |
3661 | | |
3662 | | char* |
3663 | | GEOSWKTWriter_write_r(GEOSContextHandle_t extHandle, WKTWriter* writer, const Geometry* geom) |
3664 | 0 | { |
3665 | 0 | return execute(extHandle, [&]() { |
3666 | 0 | std::string sgeom(writer->write(geom)); |
3667 | 0 | char* result = gstrdup(sgeom); |
3668 | 0 | return result; |
3669 | 0 | }); |
3670 | 0 | } |
3671 | | |
3672 | | void |
3673 | | GEOSWKTWriter_setTrim_r(GEOSContextHandle_t extHandle, WKTWriter* writer, char trim) |
3674 | 0 | { |
3675 | 0 | execute(extHandle, [&]() { |
3676 | 0 | writer->setTrim(0 != trim); |
3677 | 0 | }); |
3678 | 0 | } |
3679 | | |
3680 | | void |
3681 | | GEOSWKTWriter_setRoundingPrecision_r(GEOSContextHandle_t extHandle, WKTWriter* writer, int precision) |
3682 | 0 | { |
3683 | 0 | execute(extHandle, [&]() { |
3684 | 0 | writer->setRoundingPrecision(precision); |
3685 | 0 | }); |
3686 | 0 | } |
3687 | | |
3688 | | void |
3689 | | GEOSWKTWriter_setOutputDimension_r(GEOSContextHandle_t extHandle, WKTWriter* writer, int dim) |
3690 | 0 | { |
3691 | 0 | execute(extHandle, [&]() { |
3692 | 0 | writer->setOutputDimension(static_cast<uint8_t>(dim)); |
3693 | 0 | }); |
3694 | 0 | } |
3695 | | |
3696 | | int |
3697 | | GEOSWKTWriter_getOutputDimension_r(GEOSContextHandle_t extHandle, WKTWriter* writer) |
3698 | 0 | { |
3699 | 0 | return execute(extHandle, -1, [&]() { |
3700 | 0 | return writer->getOutputDimension(); |
3701 | 0 | }); |
3702 | 0 | } |
3703 | | |
3704 | | void |
3705 | | GEOSWKTWriter_setOld3D_r(GEOSContextHandle_t extHandle, WKTWriter* writer, int useOld3D) |
3706 | 0 | { |
3707 | 0 | execute(extHandle, [&]() { |
3708 | 0 | writer->setOld3D(0 != useOld3D); |
3709 | 0 | }); |
3710 | 0 | } |
3711 | | |
3712 | | /* WKB Reader */ |
3713 | | WKBReader* |
3714 | | GEOSWKBReader_create_r(GEOSContextHandle_t extHandle) |
3715 | 0 | { |
3716 | 0 | using geos::io::WKBReader; |
3717 | |
|
3718 | 0 | return execute(extHandle, [&]() { |
3719 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
3720 | 0 | return new WKBReader(*(GeometryFactory*)handle->geomFactory); |
3721 | 0 | }); |
3722 | 0 | } |
3723 | | |
3724 | | void |
3725 | | GEOSWKBReader_destroy_r(GEOSContextHandle_t extHandle, WKBReader* reader) |
3726 | 0 | { |
3727 | 0 | execute(extHandle, [&]() { |
3728 | 0 | delete reader; |
3729 | 0 | }); |
3730 | 0 | } |
3731 | | |
3732 | | void |
3733 | | GEOSWKBReader_setFixStructure_r(GEOSContextHandle_t extHandle, WKBReader* reader, char doFix) |
3734 | 0 | { |
3735 | 0 | return execute(extHandle, [&]() { |
3736 | 0 | return reader->setFixStructure(doFix); |
3737 | 0 | }); |
3738 | 0 | } |
3739 | | |
3740 | | struct membuf : public std::streambuf { |
3741 | | membuf(char* s, std::size_t n) |
3742 | 0 | { |
3743 | 0 | setg(s, s, s + n); |
3744 | 0 | } |
3745 | | }; |
3746 | | |
3747 | | Geometry* |
3748 | | GEOSWKBReader_read_r(GEOSContextHandle_t extHandle, WKBReader* reader, const unsigned char* wkb, std::size_t size) |
3749 | 0 | { |
3750 | 0 | return execute(extHandle, [&]() { |
3751 | 0 | return reader->read(wkb, size).release(); |
3752 | 0 | }); |
3753 | 0 | } |
3754 | | |
3755 | | Geometry* |
3756 | | GEOSWKBReader_readHEX_r(GEOSContextHandle_t extHandle, WKBReader* reader, const unsigned char* hex, std::size_t size) |
3757 | 0 | { |
3758 | 0 | return execute(extHandle, [&]() { |
3759 | 0 | std::string hexstring(reinterpret_cast<const char*>(hex), size); |
3760 | 0 | std::istringstream is(std::ios_base::binary); |
3761 | 0 | is.str(hexstring); |
3762 | 0 | is.seekg(0, std::ios::beg); // rewind reader pointer |
3763 | |
|
3764 | 0 | return reader->readHEX(is).release(); |
3765 | 0 | }); |
3766 | 0 | } |
3767 | | |
3768 | | /* WKB Writer */ |
3769 | | WKBWriter* |
3770 | | GEOSWKBWriter_create_r(GEOSContextHandle_t extHandle) |
3771 | 0 | { |
3772 | 0 | using geos::io::WKBWriter; |
3773 | |
|
3774 | 0 | return execute(extHandle, [&]() { |
3775 | 0 | return new WKBWriter(); |
3776 | 0 | }); |
3777 | 0 | } |
3778 | | |
3779 | | void |
3780 | | GEOSWKBWriter_destroy_r(GEOSContextHandle_t extHandle, WKBWriter* Writer) |
3781 | 0 | { |
3782 | 0 | execute(extHandle, [&]() { |
3783 | 0 | delete Writer; |
3784 | 0 | }); |
3785 | 0 | } |
3786 | | |
3787 | | |
3788 | | /* The caller owns the result */ |
3789 | | unsigned char* |
3790 | | GEOSWKBWriter_write_r(GEOSContextHandle_t extHandle, WKBWriter* writer, const Geometry* geom, std::size_t* size) |
3791 | 0 | { |
3792 | 0 | return execute(extHandle, [&]() { |
3793 | 0 | std::ostringstream os(std::ios_base::binary); |
3794 | 0 | writer->write(*geom, os); |
3795 | |
|
3796 | 0 | const std::string& wkbstring = os.str(); |
3797 | 0 | const std::size_t len = wkbstring.length(); |
3798 | |
|
3799 | 0 | unsigned char* result = (unsigned char*) malloc(len); |
3800 | 0 | std::memcpy(result, wkbstring.c_str(), len); |
3801 | 0 | *size = len; |
3802 | 0 | return result; |
3803 | 0 | }); |
3804 | 0 | } |
3805 | | |
3806 | | /* The caller owns the result */ |
3807 | | unsigned char* |
3808 | | GEOSWKBWriter_writeHEX_r(GEOSContextHandle_t extHandle, WKBWriter* writer, const Geometry* geom, std::size_t* size) |
3809 | 0 | { |
3810 | 0 | return execute(extHandle, [&]() { |
3811 | 0 | std::ostringstream os(std::ios_base::binary); |
3812 | 0 | writer->writeHEX(*geom, os); |
3813 | 0 | std::string wkbstring(os.str()); |
3814 | 0 | const std::size_t len = wkbstring.length(); |
3815 | |
|
3816 | 0 | unsigned char* result = (unsigned char*) malloc(len); |
3817 | 0 | std::memcpy(result, wkbstring.c_str(), len); |
3818 | 0 | *size = len; |
3819 | 0 | return result; |
3820 | 0 | }); |
3821 | 0 | } |
3822 | | |
3823 | | int |
3824 | | GEOSWKBWriter_getOutputDimension_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) |
3825 | 0 | { |
3826 | 0 | return execute(extHandle, 0, [&]() { |
3827 | 0 | return writer->getOutputDimension(); |
3828 | 0 | }); |
3829 | 0 | } |
3830 | | |
3831 | | void |
3832 | | GEOSWKBWriter_setOutputDimension_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int newDimension) |
3833 | 0 | { |
3834 | 0 | execute(extHandle, [&]() { |
3835 | 0 | writer->setOutputDimension(static_cast<uint8_t>(newDimension)); |
3836 | 0 | }); |
3837 | 0 | } |
3838 | | |
3839 | | int |
3840 | | GEOSWKBWriter_getByteOrder_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) |
3841 | 0 | { |
3842 | 0 | return execute(extHandle, 0, [&]() { |
3843 | 0 | return writer->getByteOrder(); |
3844 | 0 | }); |
3845 | 0 | } |
3846 | | |
3847 | | void |
3848 | | GEOSWKBWriter_setByteOrder_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int newByteOrder) |
3849 | 0 | { |
3850 | 0 | execute(extHandle, [&]() { |
3851 | 0 | writer->setByteOrder(newByteOrder); |
3852 | 0 | }); |
3853 | 0 | } |
3854 | | |
3855 | | char |
3856 | | GEOSWKBWriter_getIncludeSRID_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) |
3857 | 0 | { |
3858 | 0 | return execute(extHandle, 2, [&]{ |
3859 | 0 | return writer->getIncludeSRID(); |
3860 | 0 | }); |
3861 | 0 | } |
3862 | | |
3863 | | void |
3864 | | GEOSWKBWriter_setIncludeSRID_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, const char newIncludeSRID) |
3865 | 0 | { |
3866 | 0 | execute(extHandle, [&]{ |
3867 | 0 | writer->setIncludeSRID(newIncludeSRID); |
3868 | 0 | }); |
3869 | 0 | } |
3870 | | |
3871 | | int |
3872 | | GEOSWKBWriter_getFlavor_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) |
3873 | 0 | { |
3874 | 0 | return execute(extHandle, -1, [&]{ |
3875 | 0 | return writer->getFlavor(); |
3876 | 0 | }); |
3877 | 0 | } |
3878 | | |
3879 | | void |
3880 | | GEOSWKBWriter_setFlavor_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int flavor) |
3881 | 0 | { |
3882 | 0 | execute(extHandle, [&]{ |
3883 | 0 | writer->setFlavor(flavor); |
3884 | 0 | }); |
3885 | 0 | } |
3886 | | |
3887 | | /* GeoJSON Reader */ |
3888 | | GeoJSONReader* |
3889 | | GEOSGeoJSONReader_create_r(GEOSContextHandle_t extHandle) |
3890 | 0 | { |
3891 | 0 | using geos::io::GeoJSONReader; |
3892 | |
|
3893 | 0 | return execute(extHandle, [&]() { |
3894 | 0 | GEOSContextHandleInternal_t *handle = reinterpret_cast<GEOSContextHandleInternal_t *>(extHandle); |
3895 | 0 | return new GeoJSONReader(*(GeometryFactory*)handle->geomFactory); |
3896 | 0 | }); |
3897 | 0 | } |
3898 | | |
3899 | | void |
3900 | | GEOSGeoJSONReader_destroy_r(GEOSContextHandle_t extHandle, GEOSGeoJSONReader* reader) |
3901 | 0 | { |
3902 | 0 | return execute(extHandle, [&]() { |
3903 | 0 | delete reader; |
3904 | 0 | }); |
3905 | 0 | } |
3906 | | |
3907 | | Geometry* |
3908 | | GEOSGeoJSONReader_readGeometry_r(GEOSContextHandle_t extHandle, GEOSGeoJSONReader* reader, const char* geojson) |
3909 | 0 | { |
3910 | 0 | return execute(extHandle, [&]() { |
3911 | 0 | const std::string geojsonstring(geojson); |
3912 | 0 | return reader->read(geojsonstring).release(); |
3913 | 0 | }); |
3914 | 0 | } |
3915 | | |
3916 | | /* GeoJSON Writer */ |
3917 | | GeoJSONWriter* |
3918 | | GEOSGeoJSONWriter_create_r(GEOSContextHandle_t extHandle) |
3919 | 0 | { |
3920 | 0 | using geos::io::GeoJSONWriter; |
3921 | |
|
3922 | 0 | return execute(extHandle, [&]() { |
3923 | 0 | return new GeoJSONWriter(); |
3924 | 0 | }); |
3925 | 0 | } |
3926 | | |
3927 | | void |
3928 | | GEOSGeoJSONWriter_destroy_r(GEOSContextHandle_t extHandle, GEOSGeoJSONWriter* writer) |
3929 | 0 | { |
3930 | 0 | return execute(extHandle, [&]() { |
3931 | 0 | delete writer; |
3932 | 0 | }); |
3933 | 0 | } |
3934 | | |
3935 | | char* |
3936 | | GEOSGeoJSONWriter_writeGeometry_r(GEOSContextHandle_t extHandle, GEOSGeoJSONWriter* writer, const GEOSGeometry* g, int indent) |
3937 | 0 | { |
3938 | 0 | return execute(extHandle, [&]() { |
3939 | 0 | std::string geojson; |
3940 | 0 | if (indent >= 0) { |
3941 | 0 | geojson = writer->writeFormatted(g, geos::io::GeoJSONType::GEOMETRY, indent); |
3942 | 0 | } else { |
3943 | 0 | geojson = writer->write(g, geos::io::GeoJSONType::GEOMETRY); |
3944 | 0 | } |
3945 | 0 | char* result = gstrdup(geojson); |
3946 | 0 | return result; |
3947 | 0 | }); |
3948 | 0 | } |
3949 | | |
3950 | | void |
3951 | | GEOSGeoJSONWriter_setOutputDimension_r(GEOSContextHandle_t extHandle, GeoJSONWriter* writer, int dim) |
3952 | 0 | { |
3953 | 0 | execute(extHandle, [&]() { |
3954 | 0 | writer->setOutputDimension(static_cast<uint8_t>(dim)); |
3955 | 0 | }); |
3956 | 0 | } |
3957 | | |
3958 | | int |
3959 | | GEOSGeoJSONWriter_getOutputDimension_r(GEOSContextHandle_t extHandle, GeoJSONWriter* writer) |
3960 | 0 | { |
3961 | 0 | return execute(extHandle, -1, [&]() { |
3962 | 0 | return writer->getOutputDimension(); |
3963 | 0 | }); |
3964 | 0 | } |
3965 | | |
3966 | | |
3967 | | //----------------------------------------------------------------- |
3968 | | // Prepared Geometry |
3969 | | //----------------------------------------------------------------- |
3970 | | |
3971 | | const PreparedGeometry* |
3972 | | GEOSPrepare_r(GEOSContextHandle_t extHandle, const Geometry* g) |
3973 | 0 | { |
3974 | 0 | return execute(extHandle, [&]() { |
3975 | 0 | return geos::geom::prep::PreparedGeometryFactory::prepare(g).release(); |
3976 | 0 | }); |
3977 | 0 | } |
3978 | | |
3979 | | void |
3980 | | GEOSPreparedGeom_destroy_r(GEOSContextHandle_t extHandle, const PreparedGeometry* a) |
3981 | 0 | { |
3982 | 0 | execute(extHandle, [&]() { |
3983 | 0 | delete a; |
3984 | 0 | }); |
3985 | 0 | } |
3986 | | |
3987 | | char |
3988 | | GEOSPreparedContains_r(GEOSContextHandle_t extHandle, |
3989 | | const PreparedGeometry* pg, const Geometry* g) |
3990 | 0 | { |
3991 | 0 | return execute(extHandle, 2, [&]() { |
3992 | 0 | return pg->contains(g); |
3993 | 0 | }); |
3994 | 0 | } |
3995 | | |
3996 | | char |
3997 | | GEOSPreparedContainsXY_r(GEOSContextHandle_t extHandle, |
3998 | | const PreparedGeometry* pg, double x, double y) |
3999 | 0 | { |
4000 | 0 | extHandle->point2d->setXY(x, y); |
4001 | |
|
4002 | 0 | return GEOSPreparedContains_r(extHandle, pg, extHandle->point2d.get()); |
4003 | 0 | } |
4004 | | |
4005 | | char |
4006 | | GEOSPreparedContainsProperly_r(GEOSContextHandle_t extHandle, |
4007 | | const PreparedGeometry* pg, const Geometry* g) |
4008 | 0 | { |
4009 | 0 | return execute(extHandle, 2, [&]() { |
4010 | 0 | return pg->containsProperly(g); |
4011 | 0 | }); |
4012 | 0 | } |
4013 | | |
4014 | | char |
4015 | | GEOSPreparedCoveredBy_r(GEOSContextHandle_t extHandle, |
4016 | | const PreparedGeometry* pg, const Geometry* g) |
4017 | 0 | { |
4018 | 0 | return execute(extHandle, 2, [&]() { |
4019 | 0 | return pg->coveredBy(g); |
4020 | 0 | }); |
4021 | 0 | } |
4022 | | |
4023 | | char |
4024 | | GEOSPreparedCovers_r(GEOSContextHandle_t extHandle, |
4025 | | const PreparedGeometry* pg, const Geometry* g) |
4026 | 0 | { |
4027 | 0 | return execute(extHandle, 2, [&]() { |
4028 | 0 | return pg->covers(g); |
4029 | 0 | }); |
4030 | 0 | } |
4031 | | |
4032 | | char |
4033 | | GEOSPreparedCrosses_r(GEOSContextHandle_t extHandle, |
4034 | | const PreparedGeometry* pg, const Geometry* g) |
4035 | 0 | { |
4036 | 0 | return execute(extHandle, 2, [&]() { |
4037 | 0 | return pg->crosses(g); |
4038 | 0 | }); |
4039 | 0 | } |
4040 | | |
4041 | | char |
4042 | | GEOSPreparedDisjoint_r(GEOSContextHandle_t extHandle, |
4043 | | const PreparedGeometry* pg, const Geometry* g) |
4044 | 0 | { |
4045 | 0 | return execute(extHandle, 2, [&]() { |
4046 | 0 | return pg->disjoint(g); |
4047 | 0 | }); |
4048 | 0 | } |
4049 | | |
4050 | | char |
4051 | | GEOSPreparedIntersects_r(GEOSContextHandle_t extHandle, |
4052 | | const PreparedGeometry* pg, const Geometry* g) |
4053 | 0 | { |
4054 | 0 | return execute(extHandle, 2, [&]() { |
4055 | 0 | return pg->intersects(g); |
4056 | 0 | }); |
4057 | 0 | } |
4058 | | |
4059 | | char |
4060 | | GEOSPreparedIntersectsXY_r(GEOSContextHandle_t extHandle, |
4061 | | const PreparedGeometry* pg, double x, double y) |
4062 | 0 | { |
4063 | 0 | extHandle->point2d->setXY(x, y); |
4064 | |
|
4065 | 0 | return GEOSPreparedIntersects_r(extHandle, pg, extHandle->point2d.get()); |
4066 | 0 | } |
4067 | | |
4068 | | char |
4069 | | GEOSPreparedOverlaps_r(GEOSContextHandle_t extHandle, |
4070 | | const PreparedGeometry* pg, const Geometry* g) |
4071 | 0 | { |
4072 | 0 | return execute(extHandle, 2, [&]() { |
4073 | 0 | return pg->overlaps(g); |
4074 | 0 | }); |
4075 | 0 | } |
4076 | | |
4077 | | char |
4078 | | GEOSPreparedTouches_r(GEOSContextHandle_t extHandle, |
4079 | | const PreparedGeometry* pg, const Geometry* g) |
4080 | 0 | { |
4081 | 0 | return execute(extHandle, 2, [&]() { |
4082 | 0 | return pg->touches(g); |
4083 | 0 | }); |
4084 | 0 | } |
4085 | | |
4086 | | char |
4087 | | GEOSPreparedWithin_r(GEOSContextHandle_t extHandle, |
4088 | | const PreparedGeometry* pg, const Geometry* g) |
4089 | 0 | { |
4090 | 0 | return execute(extHandle, 2, [&]() { |
4091 | 0 | return pg->within(g); |
4092 | 0 | }); |
4093 | 0 | } |
4094 | | |
4095 | | char * |
4096 | | GEOSPreparedRelate_r(GEOSContextHandle_t extHandle, |
4097 | | const PreparedGeometry* pg, const Geometry* g) |
4098 | 0 | { |
4099 | 0 | return execute(extHandle, [&]() -> char * { |
4100 | 0 | return gstrdup(pg->relate(g)->toString()); |
4101 | 0 | }); |
4102 | 0 | } |
4103 | | |
4104 | | char |
4105 | | GEOSPreparedRelatePattern_r(GEOSContextHandle_t extHandle, |
4106 | | const PreparedGeometry* pg, const Geometry* g, const char* imPattern) |
4107 | 0 | { |
4108 | 0 | return execute(extHandle, 2, [&]() { |
4109 | 0 | return pg->relate(g, std::string(imPattern)); |
4110 | 0 | }); |
4111 | 0 | } |
4112 | | |
4113 | | CoordinateSequence* |
4114 | | GEOSPreparedNearestPoints_r(GEOSContextHandle_t extHandle, |
4115 | | const PreparedGeometry* pg, const Geometry* g) |
4116 | 0 | { |
4117 | 0 | return execute(extHandle, [&]() -> geos::geom::CoordinateSequence* { |
4118 | 0 | return pg->nearestPoints(g).release(); |
4119 | 0 | }); |
4120 | 0 | } |
4121 | | |
4122 | | int |
4123 | | GEOSPreparedDistance_r(GEOSContextHandle_t extHandle, |
4124 | | const PreparedGeometry* pg, |
4125 | | const Geometry* g, double* dist) |
4126 | 0 | { |
4127 | 0 | return execute(extHandle, 0, [&]() { |
4128 | 0 | *dist = pg->distance(g); |
4129 | 0 | return 1; |
4130 | 0 | }); |
4131 | 0 | } |
4132 | | |
4133 | | char |
4134 | | GEOSPreparedDistanceWithin_r(GEOSContextHandle_t extHandle, |
4135 | | const PreparedGeometry* pg, |
4136 | | const Geometry* g, double dist) |
4137 | 0 | { |
4138 | 0 | return execute(extHandle, 2, [&]() { |
4139 | 0 | return pg->isWithinDistance(g, dist); |
4140 | 0 | }); |
4141 | 0 | } |
4142 | | |
4143 | | //----------------------------------------------------------------- |
4144 | | // STRtree |
4145 | | //----------------------------------------------------------------- |
4146 | | |
4147 | | GEOSSTRtree* |
4148 | | GEOSSTRtree_create_r(GEOSContextHandle_t extHandle, |
4149 | | std::size_t nodeCapacity) |
4150 | 0 | { |
4151 | 0 | return execute(extHandle, [&]() { |
4152 | 0 | return new GEOSSTRtree(nodeCapacity); |
4153 | 0 | }); |
4154 | 0 | } |
4155 | | |
4156 | | int |
4157 | | GEOSSTRtree_build_r(GEOSContextHandle_t extHandle, |
4158 | | GEOSSTRtree* tree) |
4159 | 0 | { |
4160 | 0 | return execute(extHandle, 0, [&]() { |
4161 | 0 | tree->build(); |
4162 | 0 | return 1; |
4163 | 0 | }); |
4164 | 0 | } |
4165 | | |
4166 | | void |
4167 | | GEOSSTRtree_insert_r(GEOSContextHandle_t extHandle, |
4168 | | GEOSSTRtree* tree, |
4169 | | const Geometry* g, |
4170 | | void* item) |
4171 | 0 | { |
4172 | 0 | execute(extHandle, [&]() { |
4173 | 0 | tree->insert(g->getEnvelopeInternal(), item); |
4174 | 0 | }); |
4175 | 0 | } |
4176 | | |
4177 | | void |
4178 | | GEOSSTRtree_query_r(GEOSContextHandle_t extHandle, |
4179 | | GEOSSTRtree* tree, |
4180 | | const Geometry* g, |
4181 | | GEOSQueryCallback callback, |
4182 | | void* userdata) |
4183 | 0 | { |
4184 | 0 | execute(extHandle, [&]() { |
4185 | 0 | CAPI_ItemVisitor visitor(callback, userdata); |
4186 | 0 | tree->query(g->getEnvelopeInternal(), visitor); |
4187 | 0 | }); |
4188 | 0 | } |
4189 | | |
4190 | | const GEOSGeometry* |
4191 | | GEOSSTRtree_nearest_r(GEOSContextHandle_t extHandle, |
4192 | | GEOSSTRtree* tree, |
4193 | | const Geometry* geom) |
4194 | 0 | { |
4195 | 0 | return (const GEOSGeometry*) GEOSSTRtree_nearest_generic_r(extHandle, tree, geom, geom, nullptr, nullptr); |
4196 | 0 | } |
4197 | | |
4198 | | const void* |
4199 | | GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t extHandle, |
4200 | | GEOSSTRtree* tree, |
4201 | | const void* item, |
4202 | | const Geometry* itemEnvelope, |
4203 | | GEOSDistanceCallback distancefn, |
4204 | | void* userdata) |
4205 | 0 | { |
4206 | 0 | struct CustomItemDistance { |
4207 | 0 | CustomItemDistance(GEOSDistanceCallback p_distancefn, void* p_userdata) |
4208 | 0 | : m_distancefn(p_distancefn), m_userdata(p_userdata) {} |
4209 | |
|
4210 | 0 | GEOSDistanceCallback m_distancefn; |
4211 | 0 | void* m_userdata; |
4212 | |
|
4213 | 0 | double operator()(const void* a, const void* b) const |
4214 | 0 | { |
4215 | 0 | double d; |
4216 | |
|
4217 | 0 | if(!m_distancefn(a, b, &d, m_userdata)) { |
4218 | 0 | throw std::runtime_error(std::string("Failed to compute distance.")); |
4219 | 0 | } |
4220 | | |
4221 | 0 | return d; |
4222 | 0 | } |
4223 | 0 | }; |
4224 | |
|
4225 | 0 | struct GeometryDistance { |
4226 | 0 | double operator()(void* a, void* b) const { |
4227 | 0 | return static_cast<const Geometry*>(a)->distance(static_cast<const Geometry*>(b)); |
4228 | 0 | } |
4229 | 0 | }; |
4230 | |
|
4231 | 0 | return execute(extHandle, [&]() { |
4232 | 0 | if(distancefn) { |
4233 | 0 | CustomItemDistance itemDistance(distancefn, userdata); |
4234 | 0 | return tree->nearestNeighbour(*itemEnvelope->getEnvelopeInternal(), (void*) item, itemDistance); |
4235 | 0 | } |
4236 | 0 | else { |
4237 | 0 | return tree->nearestNeighbour<GeometryDistance>(*itemEnvelope->getEnvelopeInternal(), (void*) item); |
4238 | 0 | } |
4239 | 0 | }); |
4240 | 0 | } |
4241 | | |
4242 | | void |
4243 | | GEOSSTRtree_iterate_r(GEOSContextHandle_t extHandle, |
4244 | | GEOSSTRtree* tree, |
4245 | | GEOSQueryCallback callback, |
4246 | | void* userdata) |
4247 | 0 | { |
4248 | 0 | return execute(extHandle, [&]() { |
4249 | 0 | CAPI_ItemVisitor visitor(callback, userdata); |
4250 | 0 | tree->iterate(visitor); |
4251 | 0 | }); |
4252 | 0 | } |
4253 | | |
4254 | | char |
4255 | | GEOSSTRtree_remove_r(GEOSContextHandle_t extHandle, |
4256 | | GEOSSTRtree* tree, |
4257 | | const Geometry* g, |
4258 | 0 | void* item) { |
4259 | 0 | return execute(extHandle, 2, [&]() { |
4260 | 0 | return tree->remove(g->getEnvelopeInternal(), item); |
4261 | 0 | }); |
4262 | 0 | } |
4263 | | |
4264 | | void |
4265 | | GEOSSTRtree_destroy_r(GEOSContextHandle_t extHandle, |
4266 | | GEOSSTRtree* tree) |
4267 | 0 | { |
4268 | 0 | return execute(extHandle, [&]() { |
4269 | 0 | delete tree; |
4270 | 0 | }); |
4271 | 0 | } |
4272 | | |
4273 | | double |
4274 | | GEOSProject_r(GEOSContextHandle_t extHandle, |
4275 | | const Geometry* g, |
4276 | | const Geometry* p) |
4277 | 0 | { |
4278 | 0 | return execute(extHandle, -1.0, [&]() { |
4279 | 0 | const Point* point = dynamic_cast<const Point*>(p); |
4280 | 0 | if(!point) { |
4281 | 0 | throw std::runtime_error("third argument of GEOSProject_r must be Point"); |
4282 | 0 | } |
4283 | 0 | const geos::geom::Coordinate inputPt(*p->getCoordinate()); |
4284 | 0 | return geos::linearref::LengthIndexedLine(g).project(inputPt); |
4285 | 0 | }); |
4286 | 0 | } |
4287 | | |
4288 | | |
4289 | | Geometry* |
4290 | | GEOSInterpolate_r(GEOSContextHandle_t extHandle, const Geometry* g, double d) |
4291 | 0 | { |
4292 | 0 | return execute(extHandle, [&]() { |
4293 | 0 | GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
4294 | |
|
4295 | 0 | geos::linearref::LengthIndexedLine lil(g); |
4296 | 0 | geos::geom::Coordinate coord = lil.extractPoint(d); |
4297 | 0 | const GeometryFactory* gf = handle->geomFactory; |
4298 | 0 | auto point = coord.isNull() ? gf->createPoint(g->getCoordinateDimension()) : gf->createPoint(coord); |
4299 | 0 | point->setSRID(g->getSRID()); |
4300 | 0 | return point.release(); |
4301 | 0 | }); |
4302 | 0 | } |
4303 | | |
4304 | | |
4305 | | double |
4306 | | GEOSProjectNormalized_r(GEOSContextHandle_t extHandle, const Geometry* g, |
4307 | | const Geometry* p) |
4308 | 0 | { |
4309 | |
|
4310 | 0 | double length; |
4311 | 0 | double distance; |
4312 | 0 | if(GEOSLength_r(extHandle, g, &length) != 1) { |
4313 | 0 | return -1.0; |
4314 | 0 | }; |
4315 | |
|
4316 | 0 | distance = GEOSProject_r(extHandle, g, p); |
4317 | |
|
4318 | 0 | if (distance == 0.0 && length == 0.0) |
4319 | 0 | return 0.0; |
4320 | | |
4321 | | /* Meaningless projection? error */ |
4322 | 0 | if (distance < 0.0 || ! std::isfinite(distance) || length == 0.0) { |
4323 | 0 | return -1.0; |
4324 | 0 | } else { |
4325 | 0 | return distance / length; |
4326 | 0 | } |
4327 | 0 | } |
4328 | | |
4329 | | |
4330 | | Geometry* |
4331 | | GEOSInterpolateNormalized_r(GEOSContextHandle_t extHandle, const Geometry* g, |
4332 | | double d) |
4333 | 0 | { |
4334 | 0 | double length; |
4335 | 0 | if (GEOSLength_r(extHandle, g, &length) != 1) { |
4336 | 0 | return 0; |
4337 | 0 | } |
4338 | 0 | return GEOSInterpolate_r(extHandle, g, d * length); |
4339 | 0 | } |
4340 | | |
4341 | | GEOSGeometry* |
4342 | | GEOSGeom_extractUniquePoints_r(GEOSContextHandle_t extHandle, |
4343 | | const GEOSGeometry* g) |
4344 | 0 | { |
4345 | 0 | return execute(extHandle, [&]() { |
4346 | | /* 1: extract points */ |
4347 | 0 | std::vector<const Coordinate*> coords; |
4348 | 0 | geos::util::UniqueCoordinateArrayFilter filter(coords); |
4349 | 0 | g->apply_ro(&filter); |
4350 | | |
4351 | | /* 2: for each point, create a geometry and put into a vector */ |
4352 | 0 | std::vector<std::unique_ptr<Geometry>> points; |
4353 | 0 | points.reserve(coords.size()); |
4354 | 0 | const GeometryFactory* factory = g->getFactory(); |
4355 | 0 | for(std::vector<const Coordinate*>::iterator it = coords.begin(), |
4356 | 0 | itE = coords.end(); |
4357 | 0 | it != itE; ++it) { |
4358 | 0 | auto point = factory->createPoint(*(*it)); |
4359 | 0 | points.push_back(std::move(point)); |
4360 | 0 | } |
4361 | | |
4362 | | /* 3: create a multipoint */ |
4363 | 0 | auto out = factory->createMultiPoint(std::move(points)); |
4364 | 0 | out->setSRID(g->getSRID()); |
4365 | 0 | return out.release(); |
4366 | |
|
4367 | 0 | }); |
4368 | 0 | } |
4369 | | |
4370 | | int GEOSOrientationIndex_r(GEOSContextHandle_t extHandle, |
4371 | | double Ax, double Ay, double Bx, double By, double Px, double Py) |
4372 | 0 | { |
4373 | 0 | return execute(extHandle, 2, [&]() { |
4374 | 0 | Coordinate A(Ax, Ay); |
4375 | 0 | Coordinate B(Bx, By); |
4376 | 0 | Coordinate P(Px, Py); |
4377 | 0 | return geos::algorithm::Orientation::index(A, B, P); |
4378 | 0 | }); |
4379 | 0 | } |
4380 | | |
4381 | | GEOSGeometry* |
4382 | | GEOSSharedPaths_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const GEOSGeometry* g2) |
4383 | 0 | { |
4384 | 0 | using geos::operation::sharedpaths::SharedPathsOp; |
4385 | |
|
4386 | 0 | if(nullptr == extHandle) { |
4387 | 0 | return nullptr; |
4388 | 0 | } |
4389 | 0 | GEOSContextHandleInternal_t* handle = |
4390 | 0 | reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle); |
4391 | 0 | if(handle->initialized == 0) { |
4392 | 0 | return nullptr; |
4393 | 0 | } |
4394 | | |
4395 | 0 | SharedPathsOp::PathList forw, back; |
4396 | 0 | try { |
4397 | 0 | SharedPathsOp::sharedPathsOp(*g1, *g2, forw, back); |
4398 | 0 | } |
4399 | 0 | catch(const std::exception& e) { |
4400 | 0 | SharedPathsOp::clearEdges(forw); |
4401 | 0 | SharedPathsOp::clearEdges(back); |
4402 | 0 | handle->ERROR_MESSAGE("%s", e.what()); |
4403 | 0 | return nullptr; |
4404 | 0 | } |
4405 | 0 | catch(...) { |
4406 | 0 | SharedPathsOp::clearEdges(forw); |
4407 | 0 | SharedPathsOp::clearEdges(back); |
4408 | 0 | handle->ERROR_MESSAGE("Unknown exception thrown"); |
4409 | 0 | return nullptr; |
4410 | 0 | } |
4411 | | |
4412 | | // Now forw and back have the geoms we want to use to construct |
4413 | | // our output GeometryCollections... |
4414 | | |
4415 | 0 | const GeometryFactory* factory = g1->getFactory(); |
4416 | 0 | std::size_t count; |
4417 | |
|
4418 | 0 | std::vector<std::unique_ptr<Geometry>> out1; |
4419 | 0 | count = forw.size(); |
4420 | 0 | out1.reserve(count); |
4421 | 0 | for(std::size_t i = 0; i < count; ++i) { |
4422 | 0 | out1.emplace_back(forw[i]); |
4423 | 0 | } |
4424 | 0 | std::unique_ptr<Geometry> out1g( |
4425 | 0 | factory->createMultiLineString(std::move(out1)) |
4426 | 0 | ); |
4427 | |
|
4428 | 0 | std::vector<std::unique_ptr<Geometry>> out2; |
4429 | 0 | count = back.size(); |
4430 | 0 | out2.reserve(count); |
4431 | 0 | for(std::size_t i = 0; i < count; ++i) { |
4432 | 0 | out2.emplace_back(back[i]); |
4433 | 0 | } |
4434 | 0 | std::unique_ptr<Geometry> out2g( |
4435 | 0 | factory->createMultiLineString(std::move(out2)) |
4436 | 0 | ); |
4437 | |
|
4438 | 0 | std::vector<std::unique_ptr<Geometry>> out; |
4439 | 0 | out.reserve(2); |
4440 | 0 | out.push_back(std::move(out1g)); |
4441 | 0 | out.push_back(std::move(out2g)); |
4442 | |
|
4443 | 0 | std::unique_ptr<Geometry> outg( |
4444 | 0 | factory->createGeometryCollection(std::move(out)) |
4445 | 0 | ); |
4446 | |
|
4447 | 0 | outg->setSRID(g1->getSRID()); |
4448 | 0 | return outg.release(); |
4449 | 0 | } |
4450 | | |
4451 | | GEOSGeometry* |
4452 | | GEOSSnap_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, |
4453 | | const GEOSGeometry* g2, double tolerance) |
4454 | 0 | { |
4455 | 0 | return execute(extHandle, [&]() { |
4456 | 0 | geos::operation::overlay::snap::GeometrySnapper snapper(*g1); |
4457 | 0 | std::unique_ptr<Geometry> ret = snapper.snapTo(*g2, tolerance); |
4458 | 0 | ret->setSRID(g1->getSRID()); |
4459 | 0 | return ret.release(); |
4460 | 0 | }); |
4461 | 0 | } |
4462 | | |
4463 | | BufferParameters* |
4464 | | GEOSBufferParams_create_r(GEOSContextHandle_t extHandle) |
4465 | 0 | { |
4466 | 0 | return execute(extHandle, [&]() { |
4467 | 0 | return new BufferParameters(); |
4468 | 0 | }); |
4469 | 0 | } |
4470 | | |
4471 | | void |
4472 | | GEOSBufferParams_destroy_r(GEOSContextHandle_t extHandle, BufferParameters* p) |
4473 | 0 | { |
4474 | 0 | (void)extHandle; |
4475 | 0 | delete p; |
4476 | 0 | } |
4477 | | |
4478 | | int |
4479 | | GEOSBufferParams_setEndCapStyle_r(GEOSContextHandle_t extHandle, |
4480 | | GEOSBufferParams* p, int style) |
4481 | 0 | { |
4482 | 0 | return execute(extHandle, 0, [&]() { |
4483 | 0 | if(style > BufferParameters::CAP_SQUARE) { |
4484 | 0 | throw IllegalArgumentException("Invalid buffer endCap style"); |
4485 | 0 | } |
4486 | 0 | p->setEndCapStyle(static_cast<BufferParameters::EndCapStyle>(style)); |
4487 | 0 | return 1; |
4488 | 0 | }); |
4489 | 0 | } |
4490 | | |
4491 | | int |
4492 | | GEOSBufferParams_setJoinStyle_r(GEOSContextHandle_t extHandle, |
4493 | | GEOSBufferParams* p, int style) |
4494 | 0 | { |
4495 | 0 | return execute(extHandle, 0, [&]() { |
4496 | 0 | if(style > BufferParameters::JOIN_BEVEL) { |
4497 | 0 | throw IllegalArgumentException("Invalid buffer join style"); |
4498 | 0 | } |
4499 | 0 | p->setJoinStyle(static_cast<BufferParameters::JoinStyle>(style)); |
4500 | |
|
4501 | 0 | return 1; |
4502 | 0 | }); |
4503 | 0 | } |
4504 | | |
4505 | | int |
4506 | | GEOSBufferParams_setMitreLimit_r(GEOSContextHandle_t extHandle, |
4507 | | GEOSBufferParams* p, double limit) |
4508 | 0 | { |
4509 | 0 | return execute(extHandle, 0, [&]() { |
4510 | 0 | p->setMitreLimit(limit); |
4511 | 0 | return 1; |
4512 | 0 | }); |
4513 | 0 | } |
4514 | | |
4515 | | int |
4516 | | GEOSBufferParams_setQuadrantSegments_r(GEOSContextHandle_t extHandle, |
4517 | | GEOSBufferParams* p, int segs) |
4518 | 0 | { |
4519 | 0 | return execute(extHandle, 0, [&]() { |
4520 | 0 | p->setQuadrantSegments(segs); |
4521 | 0 | return 1; |
4522 | 0 | }); |
4523 | 0 | } |
4524 | | |
4525 | | int |
4526 | | GEOSBufferParams_setSingleSided_r(GEOSContextHandle_t extHandle, |
4527 | | GEOSBufferParams* p, int ss) |
4528 | 0 | { |
4529 | 0 | return execute(extHandle, 0, [&]() { |
4530 | 0 | p->setSingleSided((ss != 0)); |
4531 | 0 | return 1; |
4532 | 0 | }); |
4533 | 0 | } |
4534 | | |
4535 | | Geometry* |
4536 | | GEOSBufferWithParams_r(GEOSContextHandle_t extHandle, const Geometry* g1, const BufferParameters* bp, double width) |
4537 | 0 | { |
4538 | 0 | using geos::operation::buffer::BufferOp; |
4539 | |
|
4540 | 0 | return execute(extHandle, [&]() { |
4541 | 0 | BufferOp op(g1, *bp); |
4542 | 0 | std::unique_ptr<Geometry> g3 = op.getResultGeometry(width); |
4543 | 0 | g3->setSRID(g1->getSRID()); |
4544 | 0 | return g3.release(); |
4545 | 0 | }); |
4546 | 0 | } |
4547 | | |
4548 | | Geometry* |
4549 | | GEOSDelaunayTriangulation_r(GEOSContextHandle_t extHandle, const Geometry* g1, double tolerance, int onlyEdges) |
4550 | 0 | { |
4551 | 0 | using geos::triangulate::DelaunayTriangulationBuilder; |
4552 | |
|
4553 | 0 | return execute(extHandle, [&]() -> Geometry* { |
4554 | 0 | DelaunayTriangulationBuilder builder; |
4555 | 0 | builder.setTolerance(tolerance); |
4556 | 0 | builder.setSites(*g1); |
4557 | |
|
4558 | 0 | if(onlyEdges) { |
4559 | 0 | Geometry* out = builder.getEdges(*g1->getFactory()).release(); |
4560 | 0 | out->setSRID(g1->getSRID()); |
4561 | 0 | return out; |
4562 | 0 | } |
4563 | 0 | else { |
4564 | 0 | Geometry* out = builder.getTriangles(*g1->getFactory()).release(); |
4565 | 0 | out->setSRID(g1->getSRID()); |
4566 | 0 | return out; |
4567 | 0 | } |
4568 | 0 | }); |
4569 | 0 | } |
4570 | | |
4571 | | Geometry* |
4572 | | GEOSConstrainedDelaunayTriangulation_r(GEOSContextHandle_t extHandle, const Geometry* g1) |
4573 | 0 | { |
4574 | 0 | using geos::triangulate::polygon::ConstrainedDelaunayTriangulator; |
4575 | |
|
4576 | 0 | return execute(extHandle, [&]() -> Geometry* { |
4577 | 0 | return ConstrainedDelaunayTriangulator::triangulate(g1).release(); |
4578 | 0 | }); |
4579 | 0 | } |
4580 | | |
4581 | | Geometry* |
4582 | | GEOSVoronoiDiagram_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* env, double tolerance, |
4583 | | int flags) |
4584 | 0 | { |
4585 | 0 | using geos::triangulate::VoronoiDiagramBuilder; |
4586 | |
|
4587 | 0 | return execute(extHandle, [&]() -> Geometry* { |
4588 | 0 | VoronoiDiagramBuilder builder; |
4589 | 0 | builder.setSites(*g1); |
4590 | 0 | builder.setTolerance(tolerance); |
4591 | 0 | builder.setOrdered(flags & GEOS_VORONOI_PRESERVE_ORDER); |
4592 | 0 | std::unique_ptr<Geometry> out; |
4593 | 0 | if(env) { |
4594 | 0 | builder.setClipEnvelope(env->getEnvelopeInternal()); |
4595 | 0 | } |
4596 | 0 | if(flags & GEOS_VORONOI_ONLY_EDGES) { |
4597 | 0 | out = builder.getDiagramEdges(*g1->getFactory()); |
4598 | 0 | } |
4599 | 0 | else { |
4600 | 0 | out = builder.getDiagram(*g1->getFactory()); |
4601 | 0 | } |
4602 | |
|
4603 | 0 | out->setSRID(g1->getSRID()); |
4604 | 0 | return out.release(); |
4605 | 0 | }); |
4606 | 0 | } |
4607 | | |
4608 | | int |
4609 | | GEOSSegmentIntersection_r(GEOSContextHandle_t extHandle, |
4610 | | double ax0, double ay0, double ax1, double ay1, |
4611 | | double bx0, double by0, double bx1, double by1, |
4612 | | double* cx, double* cy) |
4613 | 0 | { |
4614 | 0 | return execute(extHandle, 0, [&]() { |
4615 | 0 | geos::geom::LineSegment a(ax0, ay0, ax1, ay1); |
4616 | 0 | geos::geom::LineSegment b(bx0, by0, bx1, by1); |
4617 | 0 | geos::geom::Coordinate isect = a.intersection(b); |
4618 | |
|
4619 | 0 | if(isect.isNull()) { |
4620 | 0 | return -1; |
4621 | 0 | } |
4622 | | |
4623 | 0 | *cx = isect.x; |
4624 | 0 | *cy = isect.y; |
4625 | |
|
4626 | 0 | return 1; |
4627 | 0 | }); |
4628 | 0 | } |
4629 | | |
4630 | | int |
4631 | | GEOSCoverageIsValid_r(GEOSContextHandle_t extHandle, |
4632 | | const Geometry* input, |
4633 | | double gapWidth, |
4634 | | Geometry** invalidEdges) |
4635 | 0 | { |
4636 | 0 | using geos::coverage::CoverageValidator; |
4637 | |
|
4638 | 0 | return execute(extHandle, 2, [&]() { |
4639 | 0 | const GeometryCollection* col = dynamic_cast<const GeometryCollection*>(input); |
4640 | 0 | if (!col) |
4641 | 0 | throw geos::util::IllegalArgumentException("input is not a collection"); |
4642 | | |
4643 | | // Initialize to nullptr |
4644 | 0 | if (invalidEdges) *invalidEdges = nullptr; |
4645 | |
|
4646 | 0 | std::vector<const Geometry*> coverage; |
4647 | 0 | for (const auto& g : *col) { |
4648 | 0 | coverage.push_back(g.get()); |
4649 | 0 | } |
4650 | |
|
4651 | 0 | CoverageValidator cov(coverage); |
4652 | 0 | cov.setGapWidth(gapWidth); |
4653 | 0 | std::vector<std::unique_ptr<Geometry>> invalid = cov.validate(); |
4654 | 0 | bool hasInvalid = CoverageValidator::hasInvalidResult(invalid); |
4655 | |
|
4656 | 0 | if (invalidEdges) { |
4657 | 0 | const GeometryFactory* gf = input->getFactory(); |
4658 | 0 | for (auto& g : invalid) { |
4659 | | // Replace nullptr with 'MULTILINESTRING EMPTY' |
4660 | 0 | if (g == nullptr) { |
4661 | 0 | auto empty = gf->createEmpty(1); |
4662 | 0 | g.reset(empty.release()); |
4663 | 0 | } |
4664 | 0 | } |
4665 | 0 | auto r = gf->createGeometryCollection(std::move(invalid)); |
4666 | 0 | *invalidEdges = r.release(); |
4667 | 0 | } |
4668 | |
|
4669 | 0 | return hasInvalid ? 0 : 1; |
4670 | 0 | }); |
4671 | 0 | } |
4672 | | |
4673 | | Geometry* |
4674 | | GEOSCoverageSimplifyVW_r(GEOSContextHandle_t extHandle, |
4675 | | const Geometry* input, |
4676 | | double tolerance, |
4677 | | int preserveBoundary) |
4678 | 0 | { |
4679 | 0 | using geos::coverage::CoverageSimplifier; |
4680 | |
|
4681 | 0 | return execute(extHandle, [&]() -> Geometry* { |
4682 | 0 | const GeometryCollection* col = dynamic_cast<const GeometryCollection*>(input); |
4683 | 0 | if (!col) |
4684 | 0 | return nullptr; |
4685 | | |
4686 | 0 | std::vector<const Geometry*> coverage; |
4687 | 0 | for (const auto& g : *col) { |
4688 | 0 | coverage.push_back(g.get()); |
4689 | 0 | } |
4690 | 0 | CoverageSimplifier cov(coverage); |
4691 | 0 | std::vector<std::unique_ptr<Geometry>> simple; |
4692 | 0 | if (preserveBoundary == 1) { |
4693 | 0 | simple = cov.simplifyInner(tolerance); |
4694 | 0 | } |
4695 | 0 | else if (preserveBoundary == 0) { |
4696 | 0 | simple = cov.simplify(tolerance); |
4697 | 0 | } |
4698 | 0 | else return nullptr; |
4699 | | |
4700 | 0 | const GeometryFactory* gf = input->getFactory(); |
4701 | 0 | std::unique_ptr<Geometry> r = gf->createGeometryCollection(std::move(simple)); |
4702 | 0 | return r.release(); |
4703 | 0 | }); |
4704 | 0 | } |
4705 | | |
4706 | | |
4707 | | /************************************************************************ |
4708 | | * Coverage Cleaner |
4709 | | */ |
4710 | | |
4711 | | GEOSCoverageCleanParams* |
4712 | | GEOSCoverageCleanParams_create_r(GEOSContextHandle_t extHandle) |
4713 | 0 | { |
4714 | 0 | return execute(extHandle, [&]() { |
4715 | 0 | GEOSCoverageCleanParams* p = new GEOSCoverageCleanParams(); |
4716 | 0 | p->overlapMergeStrategy = geos::coverage::CoverageCleaner::MERGE_LONGEST_BORDER; |
4717 | 0 | p->snappingDistance = -1.0; |
4718 | 0 | p->gapMaximumWidth = 0.0; |
4719 | 0 | return p; |
4720 | 0 | }); |
4721 | 0 | } |
4722 | | |
4723 | | void |
4724 | | GEOSCoverageCleanParams_destroy_r(GEOSContextHandle_t extHandle, |
4725 | | GEOSCoverageCleanParams* params) |
4726 | 0 | { |
4727 | 0 | (void)extHandle; |
4728 | 0 | delete params; |
4729 | 0 | } |
4730 | | |
4731 | | int |
4732 | | GEOSCoverageCleanParams_setSnappingDistance_r(GEOSContextHandle_t extHandle, |
4733 | | GEOSCoverageCleanParams* params, double snappingDistance) |
4734 | 0 | { |
4735 | 0 | return execute(extHandle, 0, [&]() { |
4736 | 0 | params->snappingDistance = snappingDistance; |
4737 | 0 | return 1; |
4738 | 0 | }); |
4739 | 0 | } |
4740 | | |
4741 | | int |
4742 | | GEOSCoverageCleanParams_setGapMaximumWidth_r(GEOSContextHandle_t extHandle, |
4743 | | GEOSCoverageCleanParams* params, double gapMaximumWidth) |
4744 | 0 | { |
4745 | 0 | return execute(extHandle, 0, [&]() { |
4746 | 0 | params->gapMaximumWidth = gapMaximumWidth; |
4747 | 0 | return 1; |
4748 | 0 | }); |
4749 | 0 | } |
4750 | | |
4751 | | int |
4752 | | GEOSCoverageCleanParams_setOverlapMergeStrategy_r(GEOSContextHandle_t extHandle, |
4753 | | GEOSCoverageCleanParams* params, int overlapMergeStrategy) |
4754 | 0 | { |
4755 | 0 | return execute(extHandle, 0, [&]() { |
4756 | 0 | if ( overlapMergeStrategy != geos::coverage::CoverageCleaner::MERGE_LONGEST_BORDER |
4757 | 0 | && overlapMergeStrategy != geos::coverage::CoverageCleaner::MERGE_MAX_AREA |
4758 | 0 | && overlapMergeStrategy != geos::coverage::CoverageCleaner::MERGE_MIN_AREA |
4759 | 0 | && overlapMergeStrategy != geos::coverage::CoverageCleaner::MERGE_MIN_INDEX) |
4760 | 0 | { |
4761 | 0 | extHandle->ERROR_MESSAGE("GEOSCoverageCleanParams_setOverlapMergeStrategy: Invalid overlapMergeStrategy"); |
4762 | 0 | return 0; |
4763 | 0 | } |
4764 | 0 | params->overlapMergeStrategy = overlapMergeStrategy; |
4765 | 0 | return 1; |
4766 | 0 | }); |
4767 | 0 | } |
4768 | | |
4769 | | GEOSGeometry * |
4770 | | GEOSCoverageCleanWithParams_r(GEOSContextHandle_t extHandle, |
4771 | | const GEOSGeometry* input, |
4772 | | const GEOSCoverageCleanParams* params) |
4773 | 0 | { |
4774 | 0 | using geos::coverage::CoverageCleaner; |
4775 | |
|
4776 | 0 | return execute(extHandle, [&]() -> Geometry* { |
4777 | 0 | const GeometryCollection* col = dynamic_cast<const GeometryCollection*>(input); |
4778 | 0 | if (!col) |
4779 | 0 | return nullptr; |
4780 | | |
4781 | 0 | std::vector<const Geometry*> coverage; |
4782 | 0 | for (const auto& g : *col) { |
4783 | 0 | coverage.push_back(g.get()); |
4784 | 0 | } |
4785 | 0 | geos::coverage::CoverageCleaner c(coverage); |
4786 | 0 | if (params) { |
4787 | 0 | c.setSnappingDistance(params->snappingDistance); |
4788 | 0 | c.setGapMaximumWidth(params->gapMaximumWidth); |
4789 | 0 | c.setOverlapMergeStrategy(params->overlapMergeStrategy); |
4790 | 0 | } |
4791 | 0 | c.clean(); |
4792 | |
|
4793 | 0 | auto cleanCov = c.getResult(); |
4794 | 0 | const GeometryFactory* gf = input->getFactory(); |
4795 | 0 | std::unique_ptr<Geometry> r = gf->createGeometryCollection(std::move(cleanCov)); |
4796 | 0 | return r.release(); |
4797 | 0 | }); |
4798 | 0 | } |
4799 | | |
4800 | | GEOSGeometry * |
4801 | | GEOSCoverageClean_r(GEOSContextHandle_t extHandle, |
4802 | | const GEOSGeometry* input) |
4803 | 0 | { |
4804 | 0 | return GEOSCoverageCleanWithParams_r(extHandle, input, nullptr); |
4805 | 0 | } |
4806 | | |
4807 | | |
4808 | | } /* extern "C" */ |