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