/src/geos/capi/geos_c.cpp
Line | Count | Source |
1 | | /************************************************************************ |
2 | | * |
3 | | * |
4 | | * C-Wrapper for GEOS library |
5 | | * |
6 | | * Copyright (C) 2010 2011 Sandro Santilli <strk@kbt.io> |
7 | | * Copyright (C) 2005-2006 Refractions Research Inc. |
8 | | * |
9 | | * This is free software; you can redistribute and/or modify it under |
10 | | * the terms of the GNU Lesser General Public Licence as published |
11 | | * by the Free Software Foundation. |
12 | | * See the COPYING file for more information. |
13 | | * |
14 | | * Author: Sandro Santilli <strk@kbt.io> |
15 | | * |
16 | | ***********************************************************************/ |
17 | | |
18 | | #include <geos/geom/prep/PreparedGeometryFactory.h> |
19 | | #include <geos/index/strtree/TemplateSTRtree.h> |
20 | | #include <geos/io/WKTReader.h> |
21 | | #include <geos/io/WKBReader.h> |
22 | | #include <geos/io/WKTWriter.h> |
23 | | #include <geos/io/WKBWriter.h> |
24 | | #include <geos/io/GeoJSONReader.h> |
25 | | #include <geos/io/GeoJSONWriter.h> |
26 | | #include <geos/operation/buffer/BufferParameters.h> |
27 | | #include <geos/operation/cluster/Clusters.h> |
28 | | #include <geos/util/Interrupt.h> |
29 | | |
30 | | #include <stdexcept> |
31 | | #include <new> |
32 | | |
33 | | #ifdef _MSC_VER |
34 | | #pragma warning(disable : 4099) |
35 | | #endif |
36 | | |
37 | | // Some extra magic to make type declarations in geos_c.h work - |
38 | | // for cross-checking of types in header. |
39 | | // NOTE: the below defines or struct definition must be kept in exact |
40 | | // sync between geos_c.cpp and geos_ts_c.cpp to avoid C++ One Definition Rule |
41 | | // violations. |
42 | | #define GEOSGeometry geos::geom::Geometry |
43 | | #define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry |
44 | | #define GEOSClusterInfo geos::operation::cluster::Clusters |
45 | | #define GEOSCoordSequence geos::geom::CoordinateSequence |
46 | | #define GEOSBufferParams geos::operation::buffer::BufferParameters |
47 | | #define GEOSSTRtree geos::index::strtree::TemplateSTRtree<void*> |
48 | | #define GEOSWKTReader geos::io::WKTReader |
49 | | #define GEOSWKTWriter geos::io::WKTWriter |
50 | | #define GEOSWKBReader geos::io::WKBReader |
51 | | #define GEOSWKBWriter geos::io::WKBWriter |
52 | | #define GEOSGeoJSONReader geos::io::GeoJSONReader |
53 | | #define GEOSGeoJSONWriter geos::io::GeoJSONWriter |
54 | | |
55 | | // Implementation struct for the GEOSCoverageCleanParams object |
56 | | typedef struct { |
57 | | double snappingDistance; |
58 | | int overlapMergeStrategy; |
59 | | double gapMaximumWidth; |
60 | | } GEOSCoverageCleanParams; |
61 | | |
62 | | // Implementation struct for the GEOSMakeValidParams object |
63 | | typedef struct { |
64 | | int method; |
65 | | int keepCollapsed; |
66 | | } GEOSMakeValidParams; |
67 | | |
68 | | |
69 | | #include "geos_c.h" |
70 | | |
71 | | /// Define this if you want operations triggering Exceptions to |
72 | | /// be printed (will use the NOTIFY channel - only implemented for GEOSUnion so far) |
73 | | /// |
74 | | #undef VERBOSE_EXCEPTIONS |
75 | | |
76 | | #include <geos/export.h> |
77 | | |
78 | | /* |
79 | | #if defined(_MSC_VER) |
80 | | # define GEOS_DLL __declspec(dllexport) |
81 | | #else |
82 | | # define GEOS_DLL |
83 | | #endif |
84 | | */ |
85 | | |
86 | | // import the most frequently used definitions globally |
87 | | using geos::geom::Geometry; |
88 | | using geos::geom::LineString; |
89 | | using geos::geom::Polygon; |
90 | | using geos::geom::CoordinateSequence; |
91 | | using geos::geom::GeometryFactory; |
92 | | |
93 | | using geos::io::WKTReader; |
94 | | using geos::io::WKTWriter; |
95 | | using geos::io::WKBReader; |
96 | | using geos::io::WKBWriter; |
97 | | using geos::io::GeoJSONReader; |
98 | | using geos::io::GeoJSONWriter; |
99 | | |
100 | | |
101 | | typedef std::unique_ptr<Geometry> GeomPtr; |
102 | | |
103 | | //## GLOBALS ################################################ |
104 | | |
105 | | // NOTE: SRID will have to be changed after geometry creation |
106 | | GEOSContextHandle_t handle = NULL; |
107 | | |
108 | | extern "C" { |
109 | | |
110 | | void |
111 | | initGEOS(GEOSMessageHandler nf, GEOSMessageHandler ef) |
112 | 1 | { |
113 | 1 | if(! handle) { |
114 | 1 | handle = initGEOS_r(nf, ef); |
115 | 1 | } |
116 | 0 | else { |
117 | 0 | GEOSContext_setNoticeHandler_r(handle, nf); |
118 | 0 | GEOSContext_setErrorHandler_r(handle, ef); |
119 | 0 | } |
120 | | |
121 | 1 | geos::util::Interrupt::cancel(); |
122 | 1 | } |
123 | | |
124 | | void |
125 | | finishGEOS() |
126 | 0 | { |
127 | 0 | if(handle != NULL) { |
128 | 0 | finishGEOS_r(handle); |
129 | 0 | handle = NULL; |
130 | 0 | } |
131 | 0 | } |
132 | | |
133 | | GEOSInterruptCallback* |
134 | | GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb) |
135 | 0 | { |
136 | 0 | return geos::util::Interrupt::registerCallback(cb); |
137 | 0 | } |
138 | | |
139 | | void |
140 | | GEOS_interruptRequest() |
141 | 0 | { |
142 | 0 | geos::util::Interrupt::request(); |
143 | 0 | } |
144 | | |
145 | | void |
146 | | GEOS_interruptCancel() |
147 | 0 | { |
148 | 0 | geos::util::Interrupt::cancel(); |
149 | 0 | } |
150 | | |
151 | | void |
152 | | GEOSFree(void* buffer) |
153 | 0 | { |
154 | 0 | GEOSFree_r(handle, buffer); |
155 | 0 | } |
156 | | |
157 | | /**************************************************************** |
158 | | ** relate()-related functions |
159 | | ** return 0 = false, 1 = true, 2 = error occurred |
160 | | ** |
161 | | */ |
162 | | char |
163 | | GEOSDisjoint(const Geometry* g1, const Geometry* g2) |
164 | 0 | { |
165 | 0 | return GEOSDisjoint_r(handle, g1, g2); |
166 | 0 | } |
167 | | |
168 | | char |
169 | | GEOSTouches(const Geometry* g1, const Geometry* g2) |
170 | 0 | { |
171 | 0 | return GEOSTouches_r(handle, g1, g2); |
172 | 0 | } |
173 | | |
174 | | char |
175 | | GEOSIntersects(const Geometry* g1, const Geometry* g2) |
176 | 0 | { |
177 | 0 | return GEOSIntersects_r(handle, g1, g2); |
178 | 0 | } |
179 | | |
180 | | char |
181 | | GEOSCrosses(const Geometry* g1, const Geometry* g2) |
182 | 0 | { |
183 | 0 | return GEOSCrosses_r(handle, g1, g2); |
184 | 0 | } |
185 | | |
186 | | char |
187 | | GEOSWithin(const Geometry* g1, const Geometry* g2) |
188 | 0 | { |
189 | 0 | return GEOSWithin_r(handle, g1, g2); |
190 | 0 | } |
191 | | |
192 | | // call g1->contains(g2) |
193 | | // returns 0 = false |
194 | | // 1 = true |
195 | | // 2 = error was trapped |
196 | | char |
197 | | GEOSContains(const Geometry* g1, const Geometry* g2) |
198 | 0 | { |
199 | 0 | return GEOSContains_r(handle, g1, g2); |
200 | 0 | } |
201 | | |
202 | | char |
203 | | GEOSOverlaps(const Geometry* g1, const Geometry* g2) |
204 | 0 | { |
205 | 0 | return GEOSOverlaps_r(handle, g1, g2); |
206 | 0 | } |
207 | | |
208 | | char |
209 | | GEOSCovers(const Geometry* g1, const Geometry* g2) |
210 | 0 | { |
211 | 0 | return GEOSCovers_r(handle, g1, g2); |
212 | 0 | } |
213 | | |
214 | | char |
215 | | GEOSCoveredBy(const Geometry* g1, const Geometry* g2) |
216 | 0 | { |
217 | 0 | return GEOSCoveredBy_r(handle, g1, g2); |
218 | 0 | } |
219 | | |
220 | | |
221 | | //------------------------------------------------------------------- |
222 | | // low-level relate functions |
223 | | //------------------------------------------------------------------ |
224 | | |
225 | | char |
226 | | GEOSRelatePattern(const Geometry* g1, const Geometry* g2, const char* imPattern) |
227 | 0 | { |
228 | 0 | return GEOSRelatePattern_r(handle, g1, g2, imPattern); |
229 | 0 | } |
230 | | |
231 | | char |
232 | | GEOSRelatePatternMatch(const char* intMatrix, const char* imPattern) |
233 | 0 | { |
234 | 0 | return GEOSRelatePatternMatch_r(handle, intMatrix, imPattern); |
235 | 0 | } |
236 | | |
237 | | char* |
238 | | GEOSRelate(const Geometry* g1, const Geometry* g2) |
239 | 0 | { |
240 | 0 | return GEOSRelate_r(handle, g1, g2); |
241 | 0 | } |
242 | | |
243 | | char* |
244 | | GEOSRelateBoundaryNodeRule(const Geometry* g1, const Geometry* g2, int bnr) |
245 | 0 | { |
246 | 0 | return GEOSRelateBoundaryNodeRule_r(handle, g1, g2, bnr); |
247 | 0 | } |
248 | | |
249 | | |
250 | | //----------------------------------------------------------------- |
251 | | // isValid |
252 | | //----------------------------------------------------------------- |
253 | | |
254 | | |
255 | | char |
256 | | GEOSisValid(const Geometry* g) |
257 | 0 | { |
258 | 0 | return GEOSisValid_r(handle, g); |
259 | 0 | } |
260 | | |
261 | | char* |
262 | | GEOSisValidReason(const Geometry* g) |
263 | 0 | { |
264 | 0 | return GEOSisValidReason_r(handle, g); |
265 | 0 | } |
266 | | |
267 | | char |
268 | | GEOSisValidDetail(const Geometry* g, int flags, |
269 | | char** reason, Geometry** location) |
270 | 0 | { |
271 | 0 | return GEOSisValidDetail_r(handle, g, flags, reason, location); |
272 | 0 | } |
273 | | |
274 | | //----------------------------------------------------------------- |
275 | | // general purpose |
276 | | //----------------------------------------------------------------- |
277 | | |
278 | | char |
279 | | GEOSEquals(const Geometry* g1, const Geometry* g2) |
280 | 0 | { |
281 | 0 | return GEOSEquals_r(handle, g1, g2); |
282 | 0 | } |
283 | | |
284 | | char |
285 | | GEOSEqualsExact(const Geometry* g1, const Geometry* g2, double tolerance) |
286 | 0 | { |
287 | 0 | return GEOSEqualsExact_r(handle, g1, g2, tolerance); |
288 | 0 | } |
289 | | |
290 | | char |
291 | | GEOSEqualsIdentical(const Geometry* g1, const Geometry* g2) |
292 | 0 | { |
293 | 0 | return GEOSEqualsIdentical_r(handle, g1, g2); |
294 | 0 | } |
295 | | |
296 | | int |
297 | | GEOSDistance(const Geometry* g1, const Geometry* g2, double* dist) |
298 | 0 | { |
299 | 0 | return GEOSDistance_r(handle, g1, g2, dist); |
300 | 0 | } |
301 | | |
302 | | char |
303 | | GEOSDistanceWithin(const Geometry* g1, const Geometry* g2, double dist) |
304 | 0 | { |
305 | 0 | return GEOSDistanceWithin_r(handle, g1, g2, dist); |
306 | 0 | } |
307 | | |
308 | | int |
309 | | GEOSDistanceIndexed(const Geometry* g1, const Geometry* g2, double* dist) |
310 | 0 | { |
311 | 0 | return GEOSDistanceIndexed_r(handle, g1, g2, dist); |
312 | 0 | } |
313 | | |
314 | | int |
315 | | GEOSHausdorffDistance(const Geometry* g1, const Geometry* g2, double* dist) |
316 | 0 | { |
317 | 0 | return GEOSHausdorffDistance_r(handle, g1, g2, dist); |
318 | 0 | } |
319 | | |
320 | | int |
321 | | GEOSHausdorffDistanceWithPoints(const Geometry* g1, const Geometry* g2, double* dist, double* p1x, double* p1y, double* p2x, double* p2y) |
322 | 0 | { |
323 | 0 | return GEOSHausdorffDistanceWithPoints_r(handle, g1, g2, dist, p1x, p1y, p2x, p2y); |
324 | 0 | } |
325 | | |
326 | | int |
327 | | GEOSHausdorffDistanceDensify(const Geometry* g1, const Geometry* g2, double densifyFrac, double* dist) |
328 | 0 | { |
329 | 0 | return GEOSHausdorffDistanceDensify_r(handle, g1, g2, densifyFrac, dist); |
330 | 0 | } |
331 | | |
332 | | int |
333 | | GEOSHausdorffDistanceDensifyWithPoints(const Geometry* g1, const Geometry* g2, double densifyFrac, double* dist, double* p1x, double* p1y, double* p2x, double* p2y) |
334 | 0 | { |
335 | 0 | return GEOSHausdorffDistanceDensifyWithPoints_r(handle, g1, g2, densifyFrac, dist, p1x, p1y, p2x, p2y); |
336 | 0 | } |
337 | | |
338 | | int |
339 | | GEOSFrechetDistance(const Geometry* g1, const Geometry* g2, double* dist) |
340 | 0 | { |
341 | 0 | return GEOSFrechetDistance_r(handle, g1, g2, dist); |
342 | 0 | } |
343 | | |
344 | | int |
345 | | GEOSFrechetDistanceDensify(const Geometry* g1, const Geometry* g2, double densifyFrac, double* dist) |
346 | 0 | { |
347 | 0 | return GEOSFrechetDistanceDensify_r(handle, g1, g2, densifyFrac, dist); |
348 | 0 | } |
349 | | |
350 | | int |
351 | | GEOSArea(const Geometry* g, double* area) |
352 | 0 | { |
353 | 0 | return GEOSArea_r(handle, g, area); |
354 | 0 | } |
355 | | |
356 | | int |
357 | | GEOSLength(const Geometry* g, double* length) |
358 | 0 | { |
359 | 0 | return GEOSLength_r(handle, g, length); |
360 | 0 | } |
361 | | |
362 | | CoordinateSequence* |
363 | | GEOSNearestPoints(const Geometry* g1, const Geometry* g2) |
364 | 0 | { |
365 | 0 | return GEOSNearestPoints_r(handle, g1, g2); |
366 | 0 | } |
367 | | |
368 | | GEOSClusterInfo* |
369 | | GEOSClusterDBSCAN(const GEOSGeometry* g, double eps, unsigned minPoints) |
370 | 0 | { |
371 | 0 | return GEOSClusterDBSCAN_r(handle, g, eps, minPoints); |
372 | 0 | } |
373 | | |
374 | | GEOSClusterInfo* |
375 | | GEOSClusterGeometryDistance(const GEOSGeometry* g, double d) |
376 | 0 | { |
377 | 0 | return GEOSClusterGeometryDistance_r(handle, g, d); |
378 | 0 | } |
379 | | |
380 | | GEOSClusterInfo* |
381 | | GEOSClusterGeometryIntersects(const GEOSGeometry* g) |
382 | 0 | { |
383 | 0 | return GEOSClusterGeometryIntersects_r(handle, g); |
384 | 0 | } |
385 | | |
386 | | GEOSClusterInfo* |
387 | | GEOSClusterEnvelopeDistance(const GEOSGeometry* g, double d) |
388 | 0 | { |
389 | 0 | return GEOSClusterEnvelopeDistance_r(handle, g, d); |
390 | 0 | } |
391 | | |
392 | | GEOSClusterInfo* |
393 | | GEOSClusterEnvelopeIntersects(const GEOSGeometry* g) |
394 | 0 | { |
395 | 0 | return GEOSClusterEnvelopeIntersects_r(handle, g); |
396 | 0 | } |
397 | | |
398 | | std::size_t GEOSClusterInfo_getNumClusters(const GEOSClusterInfo* clusters) |
399 | 0 | { |
400 | 0 | return GEOSClusterInfo_getNumClusters_r(handle, clusters); |
401 | 0 | } |
402 | | |
403 | | std::size_t GEOSClusterInfo_getClusterSize(const GEOSClusterInfo* clusters, size_t i) |
404 | 0 | { |
405 | 0 | return GEOSClusterInfo_getClusterSize_r(handle, clusters, i); |
406 | 0 | } |
407 | | |
408 | | const std::size_t* GEOSClusterInfo_getInputsForClusterN(const GEOSClusterInfo* clusters, size_t i) |
409 | 0 | { |
410 | 0 | return GEOSClusterInfo_getInputsForClusterN_r(handle, clusters, i); |
411 | 0 | } |
412 | | |
413 | | std::size_t* GEOSClusterInfo_getClustersForInputs(const GEOSClusterInfo* clusters) |
414 | 0 | { |
415 | 0 | return GEOSClusterInfo_getClustersForInputs_r(handle, clusters); |
416 | 0 | } |
417 | | |
418 | | void GEOSClusterInfo_destroy(GEOSClusterInfo* info) |
419 | 0 | { |
420 | 0 | GEOSClusterInfo_destroy_r(handle, info); |
421 | 0 | } |
422 | | |
423 | | Geometry* |
424 | | GEOSGeomFromWKT(const char* wkt) |
425 | 8.74k | { |
426 | 8.74k | return GEOSGeomFromWKT_r(handle, wkt); |
427 | 8.74k | } |
428 | | |
429 | | char* |
430 | | GEOSGeomToWKT(const Geometry* g) |
431 | 7.82k | { |
432 | 7.82k | return GEOSGeomToWKT_r(handle, g); |
433 | 7.82k | } |
434 | | |
435 | | // Remember to free the result! |
436 | | unsigned char* |
437 | | GEOSGeomToWKB_buf(const Geometry* g, std::size_t* size) |
438 | 7.14k | { |
439 | 7.14k | return GEOSGeomToWKB_buf_r(handle, g, size); |
440 | 7.14k | } |
441 | | |
442 | | Geometry* |
443 | | GEOSGeomFromWKB_buf(const unsigned char* wkb, std::size_t size) |
444 | 7.82k | { |
445 | 7.82k | return GEOSGeomFromWKB_buf_r(handle, wkb, size); |
446 | 7.82k | } |
447 | | |
448 | | /* Read/write wkb hex values. Returned geometries are |
449 | | owned by the caller.*/ |
450 | | unsigned char* |
451 | | GEOSGeomToHEX_buf(const Geometry* g, std::size_t* size) |
452 | 0 | { |
453 | 0 | return GEOSGeomToHEX_buf_r(handle, g, size); |
454 | 0 | } |
455 | | |
456 | | Geometry* |
457 | | GEOSGeomFromHEX_buf(const unsigned char* hex, std::size_t size) |
458 | 0 | { |
459 | 0 | return GEOSGeomFromHEX_buf_r(handle, hex, size); |
460 | 0 | } |
461 | | |
462 | | char |
463 | | GEOSisEmpty(const Geometry* g) |
464 | 0 | { |
465 | 0 | return GEOSisEmpty_r(handle, g); |
466 | 0 | } |
467 | | |
468 | | char |
469 | | GEOSisSimple(const Geometry* g) |
470 | 0 | { |
471 | 0 | return GEOSisSimple_r(handle, g); |
472 | 0 | } |
473 | | |
474 | | char |
475 | | GEOSisSimpleDetail(const Geometry* g, int returnAllPoints, Geometry** result) |
476 | 0 | { |
477 | 0 | return GEOSisSimpleDetail_r(handle, g, returnAllPoints, result); |
478 | 0 | } |
479 | | |
480 | | char |
481 | | GEOSisRing(const Geometry* g) |
482 | 0 | { |
483 | 0 | return GEOSisRing_r(handle, g); |
484 | 0 | } |
485 | | |
486 | | |
487 | | |
488 | | //free the result of this |
489 | | char* |
490 | | GEOSGeomType(const Geometry* g) |
491 | 0 | { |
492 | 0 | return GEOSGeomType_r(handle, g); |
493 | 0 | } |
494 | | |
495 | | // Return postgis geometry type index |
496 | | int |
497 | | GEOSGeomTypeId(const Geometry* g) |
498 | 0 | { |
499 | 0 | return GEOSGeomTypeId_r(handle, g); |
500 | 0 | } |
501 | | |
502 | | |
503 | | |
504 | | |
505 | | //------------------------------------------------------------------- |
506 | | // GEOS functions that return geometries |
507 | | //------------------------------------------------------------------- |
508 | | |
509 | | Geometry* |
510 | | GEOSEnvelope(const Geometry* g) |
511 | 0 | { |
512 | 0 | return GEOSEnvelope_r(handle, g); |
513 | 0 | } |
514 | | |
515 | | Geometry* |
516 | | GEOSIntersection(const Geometry* g1, const Geometry* g2) |
517 | 7.14k | { |
518 | 7.14k | return GEOSIntersection_r(handle, g1, g2); |
519 | 7.14k | } |
520 | | |
521 | | Geometry* |
522 | | GEOSIntersectionPrec(const Geometry* g1, const Geometry* g2, double gridSize) |
523 | 0 | { |
524 | 0 | return GEOSIntersectionPrec_r(handle, g1, g2, gridSize); |
525 | 0 | } |
526 | | |
527 | | Geometry* |
528 | | GEOSBuffer(const Geometry* g, double width, int quadrantsegments) |
529 | 0 | { |
530 | 0 | return GEOSBuffer_r(handle, g, width, quadrantsegments); |
531 | 0 | } |
532 | | |
533 | | Geometry* |
534 | | GEOSBufferWithStyle(const Geometry* g, double width, int quadsegs, |
535 | | int endCapStyle, int joinStyle, double mitreLimit) |
536 | 0 | { |
537 | 0 | return GEOSBufferWithStyle_r(handle, g, width, quadsegs, endCapStyle, |
538 | 0 | joinStyle, mitreLimit); |
539 | 0 | } |
540 | | |
541 | | Geometry* |
542 | | GEOSDensify(const Geometry* g, double tolerance) |
543 | 0 | { |
544 | 0 | return GEOSDensify_r(handle, g, tolerance); |
545 | 0 | } |
546 | | |
547 | | |
548 | | Geometry* |
549 | | GEOSSingleSidedBuffer(const Geometry* g, double width, int quadsegs, |
550 | | int joinStyle, double mitreLimit, int leftSide) |
551 | 0 | { |
552 | 0 | return GEOSSingleSidedBuffer_r(handle, g, width, quadsegs, |
553 | 0 | joinStyle, mitreLimit, leftSide); |
554 | 0 | } |
555 | | |
556 | | Geometry* |
557 | | GEOSOffsetCurve(const Geometry* g, double width, int quadsegs, |
558 | | int joinStyle, double mitreLimit) |
559 | 0 | { |
560 | 0 | return GEOSOffsetCurve_r(handle, g, width, quadsegs, |
561 | 0 | joinStyle, mitreLimit); |
562 | 0 | } |
563 | | |
564 | | Geometry* |
565 | | GEOSConvexHull(const Geometry* g) |
566 | 0 | { |
567 | 0 | return GEOSConvexHull_r(handle, g); |
568 | 0 | } |
569 | | |
570 | | Geometry* |
571 | | GEOSConcaveHull(const Geometry* g, |
572 | | double ratio, |
573 | | unsigned int allowHoles) |
574 | | |
575 | 0 | { |
576 | 0 | return GEOSConcaveHull_r(handle, g, ratio, allowHoles); |
577 | 0 | } |
578 | | |
579 | | Geometry* |
580 | | GEOSConcaveHullByLength(const Geometry* g, |
581 | | double length, |
582 | | unsigned int allowHoles) |
583 | | |
584 | 0 | { |
585 | 0 | return GEOSConcaveHullByLength_r(handle, g, length, allowHoles); |
586 | 0 | } |
587 | | |
588 | | Geometry* |
589 | | GEOSPolygonHullSimplify(const Geometry* g, |
590 | | unsigned int isOuter, |
591 | | double vertexNumFraction) |
592 | 0 | { |
593 | 0 | return GEOSPolygonHullSimplify_r(handle, g, isOuter, vertexNumFraction); |
594 | 0 | } |
595 | | |
596 | | Geometry* |
597 | | GEOSPolygonHullSimplifyMode(const Geometry* g, |
598 | | unsigned int isOuter, |
599 | | unsigned int parameterMode, |
600 | | double parameter) |
601 | 0 | { |
602 | 0 | return GEOSPolygonHullSimplifyMode_r(handle, g, isOuter, parameterMode, parameter); |
603 | 0 | } |
604 | | |
605 | | Geometry* |
606 | | GEOSConcaveHullOfPolygons(const Geometry* g, |
607 | | double lengthRatio, |
608 | | unsigned int isTight, |
609 | | unsigned int isHolesAllowed) |
610 | 0 | { |
611 | 0 | return GEOSConcaveHullOfPolygons_r(handle, |
612 | 0 | g, lengthRatio, isTight, isHolesAllowed); |
613 | 0 | } |
614 | | |
615 | | Geometry* |
616 | | GEOSMinimumRotatedRectangle(const Geometry* g) |
617 | 0 | { |
618 | 0 | return GEOSMinimumRotatedRectangle_r(handle, g); |
619 | 0 | } |
620 | | |
621 | | Geometry* |
622 | | GEOSMaximumInscribedCircle(const Geometry* g, double tolerance) |
623 | 0 | { |
624 | 0 | return GEOSMaximumInscribedCircle_r(handle, g, tolerance); |
625 | 0 | } |
626 | | |
627 | | Geometry* |
628 | | GEOSLargestEmptyCircle(const Geometry* g, const Geometry* boundary, double tolerance) |
629 | 0 | { |
630 | 0 | return GEOSLargestEmptyCircle_r(handle, g, boundary, tolerance); |
631 | 0 | } |
632 | | |
633 | | Geometry* |
634 | | GEOSMinimumWidth(const Geometry* g) |
635 | 0 | { |
636 | 0 | return GEOSMinimumWidth_r(handle, g); |
637 | 0 | } |
638 | | |
639 | | Geometry* |
640 | | GEOSMinimumClearanceLine(const Geometry* g) |
641 | 0 | { |
642 | 0 | return GEOSMinimumClearanceLine_r(handle, g); |
643 | 0 | } |
644 | | |
645 | | int |
646 | | GEOSMinimumClearance(const Geometry* g, double* d) |
647 | 0 | { |
648 | 0 | return GEOSMinimumClearance_r(handle, g, d); |
649 | 0 | } |
650 | | |
651 | | Geometry* |
652 | | GEOSDifference(const Geometry* g1, const Geometry* g2) |
653 | 7.14k | { |
654 | 7.14k | return GEOSDifference_r(handle, g1, g2); |
655 | 7.14k | } |
656 | | |
657 | | Geometry* |
658 | | GEOSDifferencePrec(const Geometry* g1, const Geometry* g2, double gridSize) |
659 | 0 | { |
660 | 0 | return GEOSDifferencePrec_r(handle, g1, g2, gridSize); |
661 | 0 | } |
662 | | |
663 | | Geometry* |
664 | | GEOSBoundary(const Geometry* g) |
665 | 0 | { |
666 | 0 | return GEOSBoundary_r(handle, g); |
667 | 0 | } |
668 | | |
669 | | Geometry* |
670 | | GEOSSymDifference(const Geometry* g1, const Geometry* g2) |
671 | 0 | { |
672 | 0 | return GEOSSymDifference_r(handle, g1, g2); |
673 | 0 | } |
674 | | |
675 | | Geometry* |
676 | | GEOSSymDifferencePrec(const Geometry* g1, const Geometry* g2, double gridSize) |
677 | 0 | { |
678 | 0 | return GEOSSymDifferencePrec_r(handle, g1, g2, gridSize); |
679 | 0 | } |
680 | | |
681 | | Geometry* |
682 | | GEOSUnion(const Geometry* g1, const Geometry* g2) |
683 | 7.14k | { |
684 | 7.14k | return GEOSUnion_r(handle, g1, g2); |
685 | 7.14k | } |
686 | | |
687 | | Geometry* |
688 | | GEOSUnionPrec(const Geometry* g1, const Geometry* g2, double gridSize) |
689 | 0 | { |
690 | 0 | return GEOSUnionPrec_r(handle, g1, g2, gridSize); |
691 | 0 | } |
692 | | |
693 | | Geometry* |
694 | | GEOSUnaryUnion(const Geometry* g) |
695 | 0 | { |
696 | 0 | return GEOSUnaryUnion_r(handle, g); |
697 | 0 | } |
698 | | |
699 | | Geometry* |
700 | | GEOSUnaryUnionPrec(const Geometry* g, double gridSize) |
701 | 0 | { |
702 | 0 | return GEOSUnaryUnionPrec_r(handle, g, gridSize); |
703 | 0 | } |
704 | | |
705 | | Geometry* |
706 | | GEOSCoverageUnion(const Geometry* g) |
707 | 0 | { |
708 | 0 | return GEOSCoverageUnion_r(handle, g); |
709 | 0 | } |
710 | | |
711 | | Geometry* |
712 | | GEOSDisjointSubsetUnion(const Geometry* g) |
713 | 0 | { |
714 | 0 | return GEOSDisjointSubsetUnion_r(handle, g); |
715 | 0 | } |
716 | | |
717 | | Geometry* |
718 | | GEOSNode(const Geometry* g) |
719 | 0 | { |
720 | 0 | return GEOSNode_r(handle, g); |
721 | 0 | } |
722 | | |
723 | | Geometry* |
724 | | GEOSUnionCascaded(const Geometry* g) |
725 | 0 | { |
726 | 0 | return GEOSUnionCascaded_r(handle, g); |
727 | 0 | } |
728 | | |
729 | | Geometry* |
730 | | GEOSPointOnSurface(const Geometry* g) |
731 | 0 | { |
732 | 0 | return GEOSPointOnSurface_r(handle, g); |
733 | 0 | } |
734 | | |
735 | | |
736 | | Geometry* |
737 | | GEOSClipByRect(const Geometry* g, double xmin, double ymin, double xmax, double ymax) |
738 | 0 | { |
739 | 0 | return GEOSClipByRect_r(handle, g, xmin, ymin, xmax, ymax); |
740 | 0 | } |
741 | | |
742 | | Geometry* |
743 | | GEOSSubdivideByGrid(const Geometry* g, double xmin, double ymin, double xmax, double ymax, |
744 | | unsigned nx, unsigned ny, int include_exterior) |
745 | 0 | { |
746 | 0 | return GEOSSubdivideByGrid_r(handle, g, xmin, ymin, xmax, ymax, nx, ny, include_exterior); |
747 | 0 | } |
748 | | |
749 | | int |
750 | | GEOSGridIntersectionFractions(const Geometry* g, double xmin, double ymin, double xmax, double ymax, |
751 | | unsigned nx, unsigned ny, float* buf) |
752 | 0 | { |
753 | 0 | return GEOSGridIntersectionFractions_r(handle, g, xmin, ymin, xmax, ymax, nx, ny, buf); |
754 | 0 | } |
755 | | |
756 | | Geometry* |
757 | 0 | GEOSGeom_transformXY(const GEOSGeometry* g, GEOSTransformXYCallback callback, void* userdata) { |
758 | 0 | return GEOSGeom_transformXY_r(handle, g, callback, userdata); |
759 | 0 | } |
760 | | |
761 | | |
762 | | Geometry* |
763 | 0 | GEOSGeom_transformXYZ(const GEOSGeometry* g, GEOSTransformXYZCallback callback, void* userdata) { |
764 | 0 | return GEOSGeom_transformXYZ_r(handle, g, callback, userdata); |
765 | 0 | } |
766 | | |
767 | | |
768 | | //------------------------------------------------------------------- |
769 | | // memory management functions |
770 | | //------------------------------------------------------------------ |
771 | | |
772 | | |
773 | | void |
774 | | GEOSGeom_destroy(Geometry* a) |
775 | 36.4k | { |
776 | 36.4k | return GEOSGeom_destroy_r(handle, a); |
777 | 36.4k | } |
778 | | |
779 | | |
780 | | int |
781 | | GEOSGetNumCoordinates(const Geometry* g) |
782 | 0 | { |
783 | 0 | return GEOSGetNumCoordinates_r(handle, g); |
784 | 0 | } |
785 | | |
786 | | /* |
787 | | * Return -1 on exception, 0 otherwise. |
788 | | * Converts Geometry to normal form (or canonical form). |
789 | | */ |
790 | | int |
791 | | GEOSNormalize(Geometry* g) |
792 | 0 | { |
793 | 0 | return GEOSNormalize_r(handle, g); |
794 | 0 | } |
795 | | |
796 | | int |
797 | | GEOSOrientPolygons(Geometry* g, int exteriorCW) |
798 | 0 | { |
799 | 0 | return GEOSOrientPolygons_r(handle, g, exteriorCW); |
800 | 0 | } |
801 | | |
802 | | int |
803 | | GEOSGetNumInteriorRings(const Geometry* g) |
804 | 0 | { |
805 | 0 | return GEOSGetNumInteriorRings_r(handle, g); |
806 | 0 | } |
807 | | |
808 | | |
809 | | // returns -1 on error and 1 for non-multi geometries |
810 | | int |
811 | | GEOSGetNumGeometries(const Geometry* g) |
812 | 0 | { |
813 | 0 | return GEOSGetNumGeometries_r(handle, g); |
814 | 0 | } |
815 | | |
816 | | |
817 | | /* |
818 | | * Call only on GEOMETRYCOLLECTION or MULTI*. |
819 | | * Return a pointer to the internal Geometry. |
820 | | */ |
821 | | const Geometry* |
822 | | GEOSGetGeometryN(const Geometry* g, int n) |
823 | 0 | { |
824 | 0 | return GEOSGetGeometryN_r(handle, g, n); |
825 | 0 | } |
826 | | |
827 | | /* |
828 | | * Call only on LINESTRING |
829 | | * Returns NULL on exception |
830 | | */ |
831 | | Geometry* |
832 | | GEOSGeomGetPointN(const Geometry* g, int n) |
833 | 0 | { |
834 | 0 | return GEOSGeomGetPointN_r(handle, g, n); |
835 | 0 | } |
836 | | |
837 | | /* |
838 | | * Call only on LINESTRING |
839 | | */ |
840 | | Geometry* |
841 | | GEOSGeomGetStartPoint(const Geometry* g) |
842 | 0 | { |
843 | 0 | return GEOSGeomGetStartPoint_r(handle, g); |
844 | 0 | } |
845 | | |
846 | | /* |
847 | | * Call only on LINESTRING |
848 | | */ |
849 | | Geometry* |
850 | | GEOSGeomGetEndPoint(const Geometry* g) |
851 | 0 | { |
852 | 0 | return GEOSGeomGetEndPoint_r(handle, g); |
853 | 0 | } |
854 | | |
855 | | /* |
856 | | * Call only on LINESTRING |
857 | | * return 2 on exception, 1 on true, 0 on false |
858 | | */ |
859 | | char |
860 | | GEOSisClosed(const Geometry* g) |
861 | 0 | { |
862 | 0 | return GEOSisClosed_r(handle, g); |
863 | 0 | } |
864 | | |
865 | | /* |
866 | | * Call only on LINESTRING |
867 | | * returns 0 on exception, otherwise 1 |
868 | | */ |
869 | | int |
870 | | GEOSGeomGetLength(const Geometry* g, double* length) |
871 | 0 | { |
872 | 0 | return GEOSGeomGetLength_r(handle, g, length); |
873 | 0 | } |
874 | | |
875 | | /* |
876 | | * Call only on LINESTRING |
877 | | * returns -1 on exception |
878 | | */ |
879 | | int |
880 | | GEOSGeomGetNumPoints(const Geometry* g) |
881 | 0 | { |
882 | 0 | return GEOSGeomGetNumPoints_r(handle, g); |
883 | 0 | } |
884 | | |
885 | | /* |
886 | | * For POINT |
887 | | * returns 0 on exception, otherwise 1 |
888 | | */ |
889 | | int |
890 | | GEOSGeomGetX(const Geometry* g, double* x) |
891 | 0 | { |
892 | 0 | return GEOSGeomGetX_r(handle, g, x); |
893 | 0 | } |
894 | | |
895 | | /* |
896 | | * For POINT |
897 | | * returns 0 on exception, otherwise 1 |
898 | | */ |
899 | | int |
900 | | GEOSGeomGetY(const Geometry* g, double* y) |
901 | 0 | { |
902 | 0 | return GEOSGeomGetY_r(handle, g, y); |
903 | 0 | } |
904 | | |
905 | | /* |
906 | | * For POINT |
907 | | * returns 0 on exception, otherwise 1 |
908 | | */ |
909 | | int |
910 | | GEOSGeomGetZ(const Geometry* g1, double* z) |
911 | 0 | { |
912 | 0 | return GEOSGeomGetZ_r(handle, g1, z); |
913 | 0 | } |
914 | | |
915 | | /* |
916 | | * For POINT |
917 | | * returns 0 on exception, otherwise 1 |
918 | | */ |
919 | | int |
920 | | GEOSGeomGetM(const Geometry* g1, double* m) |
921 | 0 | { |
922 | 0 | return GEOSGeomGetM_r(handle, g1, m); |
923 | 0 | } |
924 | | |
925 | | /* |
926 | | * Call only on polygon |
927 | | * Return a copy of the internal Geometry. |
928 | | */ |
929 | | const Geometry* |
930 | | GEOSGetExteriorRing(const Geometry* g) |
931 | 0 | { |
932 | 0 | return GEOSGetExteriorRing_r(handle, g); |
933 | 0 | } |
934 | | |
935 | | /* |
936 | | * Call only on polygon |
937 | | * Return a pointer to internal storage, do not destroy it. |
938 | | */ |
939 | | const Geometry* |
940 | | GEOSGetInteriorRingN(const Geometry* g, int n) |
941 | 0 | { |
942 | 0 | return GEOSGetInteriorRingN_r(handle, g, n); |
943 | 0 | } |
944 | | |
945 | | Geometry* |
946 | | GEOSGetCentroid(const Geometry* g) |
947 | 0 | { |
948 | 0 | return GEOSGetCentroid_r(handle, g); |
949 | 0 | } |
950 | | |
951 | | int |
952 | | GEOSHilbertCode(const GEOSGeometry *geom, const GEOSGeometry* extent, |
953 | | unsigned int level, unsigned int *code) |
954 | 0 | { |
955 | 0 | return GEOSHilbertCode_r(handle, geom, extent, level, code); |
956 | 0 | } |
957 | | |
958 | | Geometry* |
959 | | GEOSMinimumBoundingCircle(const Geometry* g, double* radius, Geometry** center) |
960 | 0 | { |
961 | 0 | return GEOSMinimumBoundingCircle_r(handle, g, radius, center); |
962 | 0 | } |
963 | | |
964 | | Geometry* |
965 | | GEOSGeom_createCollection(int type, Geometry** geoms, unsigned int ngeoms) |
966 | 0 | { |
967 | 0 | return GEOSGeom_createCollection_r(handle, type, geoms, ngeoms); |
968 | 0 | } |
969 | | |
970 | | Geometry** |
971 | | GEOSGeom_releaseCollection(Geometry* collection, unsigned int * ngeoms) |
972 | 0 | { |
973 | 0 | return GEOSGeom_releaseCollection_r(handle, collection, ngeoms); |
974 | 0 | } |
975 | | |
976 | | Geometry* |
977 | | GEOSPolygonize(const Geometry* const* g, unsigned int ngeoms) |
978 | 0 | { |
979 | 0 | return GEOSPolygonize_r(handle, g, ngeoms); |
980 | 0 | } |
981 | | |
982 | | Geometry* |
983 | | GEOSPolygonize_valid(const Geometry* const* g, unsigned int ngeoms) |
984 | 0 | { |
985 | 0 | return GEOSPolygonize_valid_r(handle, g, ngeoms); |
986 | 0 | } |
987 | | |
988 | | Geometry* |
989 | | GEOSPolygonizer_getCutEdges(const Geometry* const* g, unsigned int ngeoms) |
990 | 0 | { |
991 | 0 | return GEOSPolygonizer_getCutEdges_r(handle, g, ngeoms); |
992 | 0 | } |
993 | | |
994 | | GEOSGeometry* |
995 | | GEOSPolygonize_full(const GEOSGeometry* input, |
996 | | GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid) |
997 | 0 | { |
998 | 0 | return GEOSPolygonize_full_r(handle, input, cuts, dangles, invalid); |
999 | 0 | } |
1000 | | |
1001 | | Geometry* |
1002 | | GEOSBuildArea(const Geometry* g) |
1003 | 0 | { |
1004 | 0 | return GEOSBuildArea_r(handle, g); |
1005 | 0 | } |
1006 | | |
1007 | | Geometry* |
1008 | | GEOSMakeValid(const Geometry* g) |
1009 | 0 | { |
1010 | 0 | return GEOSMakeValid_r(handle, g); |
1011 | 0 | } |
1012 | | |
1013 | | GEOSMakeValidParams* |
1014 | | GEOSMakeValidParams_create() |
1015 | 0 | { |
1016 | 0 | return GEOSMakeValidParams_create_r(handle); |
1017 | 0 | } |
1018 | | |
1019 | | void |
1020 | | GEOSMakeValidParams_destroy(GEOSMakeValidParams* parms) |
1021 | 0 | { |
1022 | 0 | return GEOSMakeValidParams_destroy_r(handle, parms); |
1023 | 0 | } |
1024 | | |
1025 | | int |
1026 | | GEOSMakeValidParams_setMethod( |
1027 | | GEOSMakeValidParams* p, |
1028 | | GEOSMakeValidMethods method) |
1029 | 0 | { |
1030 | 0 | return GEOSMakeValidParams_setMethod_r(handle, p, method); |
1031 | 0 | } |
1032 | | |
1033 | | int |
1034 | | GEOSMakeValidParams_setKeepCollapsed( |
1035 | | GEOSMakeValidParams* p, |
1036 | | int keepCollapsed) |
1037 | 0 | { |
1038 | 0 | return GEOSMakeValidParams_setKeepCollapsed_r(handle, p, keepCollapsed); |
1039 | 0 | } |
1040 | | |
1041 | | Geometry* |
1042 | | GEOSMakeValidWithParams( |
1043 | | const Geometry* g, |
1044 | | const GEOSMakeValidParams* params) |
1045 | 0 | { |
1046 | 0 | return GEOSMakeValidWithParams_r(handle, g, params); |
1047 | 0 | } |
1048 | | |
1049 | | GEOSCoverageCleanParams* |
1050 | | GEOSCoverageCleanParams_create() |
1051 | 0 | { |
1052 | 0 | return GEOSCoverageCleanParams_create_r(handle); |
1053 | 0 | } |
1054 | | |
1055 | | void |
1056 | | GEOSCoverageCleanParams_destroy( |
1057 | | GEOSCoverageCleanParams* params) |
1058 | 0 | { |
1059 | 0 | return GEOSCoverageCleanParams_destroy_r(handle, params); |
1060 | 0 | } |
1061 | | |
1062 | | int |
1063 | | GEOSCoverageCleanParams_setSnappingDistance( |
1064 | | GEOSCoverageCleanParams* params, double snappingDistance) |
1065 | 0 | { |
1066 | 0 | return GEOSCoverageCleanParams_setSnappingDistance_r( |
1067 | 0 | handle, params, snappingDistance); |
1068 | 0 | } |
1069 | | |
1070 | | int |
1071 | | GEOSCoverageCleanParams_setGapMaximumWidth( |
1072 | | GEOSCoverageCleanParams* params, double gapMaximumWidth) |
1073 | 0 | { |
1074 | 0 | return GEOSCoverageCleanParams_setGapMaximumWidth_r( |
1075 | 0 | handle, params, gapMaximumWidth); |
1076 | 0 | } |
1077 | | |
1078 | | int |
1079 | | GEOSCoverageCleanParams_setOverlapMergeStrategy( |
1080 | | GEOSCoverageCleanParams* params, int overlapMergeStrategy) |
1081 | 0 | { |
1082 | 0 | return GEOSCoverageCleanParams_setOverlapMergeStrategy_r( |
1083 | 0 | handle, params, overlapMergeStrategy); |
1084 | 0 | } |
1085 | | |
1086 | | GEOSGeometry * |
1087 | | GEOSCoverageCleanWithParams( |
1088 | | const GEOSGeometry* input, |
1089 | | const GEOSCoverageCleanParams* params) |
1090 | 0 | { |
1091 | 0 | return GEOSCoverageCleanWithParams_r( |
1092 | 0 | handle, input, params); |
1093 | 0 | } |
1094 | | |
1095 | | GEOSGeometry * |
1096 | | GEOSCoverageClean( |
1097 | | const GEOSGeometry * input) |
1098 | 0 | { |
1099 | 0 | return GEOSCoverageClean_r( |
1100 | 0 | handle, input); |
1101 | 0 | } |
1102 | | |
1103 | | Geometry* |
1104 | | GEOSRemoveRepeatedPoints( |
1105 | | const Geometry* g, |
1106 | | double tolerance) |
1107 | 0 | { |
1108 | 0 | return GEOSRemoveRepeatedPoints_r(handle, g, tolerance); |
1109 | 0 | } |
1110 | | |
1111 | | Geometry* |
1112 | | GEOSLineMerge(const Geometry* g) |
1113 | 0 | { |
1114 | 0 | return GEOSLineMerge_r(handle, g); |
1115 | 0 | } |
1116 | | |
1117 | | Geometry* |
1118 | | GEOSLineMergeDirected(const Geometry* g) |
1119 | 0 | { |
1120 | 0 | return GEOSLineMergeDirected_r(handle, g); |
1121 | 0 | } |
1122 | | |
1123 | | Geometry* |
1124 | | GEOSLineSubstring(const Geometry* g, double start_fraction, double end_fraction) |
1125 | 0 | { |
1126 | 0 | return GEOSLineSubstring_r(handle, g, start_fraction, end_fraction); |
1127 | 0 | } |
1128 | | |
1129 | | Geometry* |
1130 | | GEOSReverse(const Geometry* g) |
1131 | 0 | { |
1132 | 0 | return GEOSReverse_r(handle, g); |
1133 | 0 | } |
1134 | | |
1135 | | int |
1136 | | GEOSGetSRID(const Geometry* g) |
1137 | 0 | { |
1138 | 0 | return GEOSGetSRID_r(handle, g); |
1139 | 0 | } |
1140 | | |
1141 | | void |
1142 | | GEOSSetSRID(Geometry* g, int srid) |
1143 | 0 | { |
1144 | 0 | return GEOSSetSRID_r(handle, g, srid); |
1145 | 0 | } |
1146 | | |
1147 | | void* |
1148 | | GEOSGeom_getUserData(const Geometry* g) |
1149 | 0 | { |
1150 | 0 | return GEOSGeom_getUserData_r(handle, g); |
1151 | 0 | } |
1152 | | |
1153 | | void |
1154 | | GEOSGeom_setUserData(Geometry* g, void* userData) |
1155 | 0 | { |
1156 | 0 | return GEOSGeom_setUserData_r(handle, g, userData); |
1157 | 0 | } |
1158 | | |
1159 | | char |
1160 | | GEOSHasZ(const Geometry* g) |
1161 | 0 | { |
1162 | 0 | return GEOSHasZ_r(handle, g); |
1163 | 0 | } |
1164 | | |
1165 | | char |
1166 | | GEOSHasM(const Geometry* g) |
1167 | 0 | { |
1168 | 0 | return GEOSHasM_r(handle, g); |
1169 | 0 | } |
1170 | | |
1171 | | int |
1172 | | GEOS_getWKBOutputDims() |
1173 | 0 | { |
1174 | 0 | return GEOS_getWKBOutputDims_r(handle); |
1175 | 0 | } |
1176 | | |
1177 | | int |
1178 | | GEOS_setWKBOutputDims(int newdims) |
1179 | 0 | { |
1180 | 0 | return GEOS_setWKBOutputDims_r(handle, newdims); |
1181 | 0 | } |
1182 | | |
1183 | | int |
1184 | | GEOS_getWKBByteOrder() |
1185 | 0 | { |
1186 | 0 | return GEOS_getWKBByteOrder_r(handle); |
1187 | 0 | } |
1188 | | |
1189 | | int |
1190 | | GEOS_setWKBByteOrder(int byteOrder) |
1191 | 0 | { |
1192 | 0 | return GEOS_setWKBByteOrder_r(handle, byteOrder); |
1193 | 0 | } |
1194 | | |
1195 | | CoordinateSequence* |
1196 | | GEOSCoordSeq_create(unsigned int size, unsigned int dims) |
1197 | 0 | { |
1198 | 0 | return GEOSCoordSeq_create_r(handle, size, dims); |
1199 | 0 | } |
1200 | | |
1201 | | CoordinateSequence* |
1202 | | GEOSCoordSeq_createWithDimensions(unsigned int size, int hasZ, int hasM) |
1203 | 0 | { |
1204 | 0 | return GEOSCoordSeq_createWithDimensions_r(handle, size, hasZ, hasM); |
1205 | 0 | } |
1206 | | |
1207 | | CoordinateSequence* |
1208 | | GEOSCoordSeq_copyFromBuffer(const double* buf, unsigned int size, int hasZ, int hasM) |
1209 | 0 | { |
1210 | 0 | return GEOSCoordSeq_copyFromBuffer_r(handle, buf, size, hasZ, hasM); |
1211 | 0 | } |
1212 | | |
1213 | | int |
1214 | | GEOSCoordSeq_copyToBuffer(const CoordinateSequence* s, double* buf, int hasZ, int hasM) |
1215 | 0 | { |
1216 | 0 | return GEOSCoordSeq_copyToBuffer_r(handle, s, buf, hasZ, hasM); |
1217 | 0 | } |
1218 | | |
1219 | | CoordinateSequence* |
1220 | | GEOSCoordSeq_copyFromArrays(const double* x, const double* y, const double* z, const double* m, unsigned int size) |
1221 | 0 | { |
1222 | 0 | return GEOSCoordSeq_copyFromArrays_r(handle, x, y, z, m, size); |
1223 | 0 | } |
1224 | | |
1225 | | int |
1226 | | GEOSCoordSeq_copyToArrays(const CoordinateSequence* s, double* x, double* y, double* z, double* m) |
1227 | 0 | { |
1228 | 0 | return GEOSCoordSeq_copyToArrays_r(handle, s, x, y, z, m); |
1229 | 0 | } |
1230 | | |
1231 | | char |
1232 | | GEOSCoordSeq_hasZ(CoordinateSequence* s) |
1233 | 0 | { |
1234 | 0 | return GEOSCoordSeq_hasZ_r(handle, s); |
1235 | 0 | } |
1236 | | |
1237 | | char |
1238 | | GEOSCoordSeq_hasM(CoordinateSequence* s) |
1239 | 0 | { |
1240 | 0 | return GEOSCoordSeq_hasM_r(handle, s); |
1241 | 0 | } |
1242 | | |
1243 | | int |
1244 | | GEOSCoordSeq_setOrdinate(CoordinateSequence* s, unsigned int idx, unsigned int dim, double val) |
1245 | 0 | { |
1246 | 0 | return GEOSCoordSeq_setOrdinate_r(handle, s, idx, dim, val); |
1247 | 0 | } |
1248 | | |
1249 | | int |
1250 | | GEOSCoordSeq_setX(CoordinateSequence* s, unsigned int idx, double val) |
1251 | 0 | { |
1252 | 0 | return GEOSCoordSeq_setOrdinate(s, idx, CoordinateSequence::X, val); |
1253 | 0 | } |
1254 | | |
1255 | | int |
1256 | | GEOSCoordSeq_setY(CoordinateSequence* s, unsigned int idx, double val) |
1257 | 0 | { |
1258 | 0 | return GEOSCoordSeq_setOrdinate(s, idx, CoordinateSequence::Y, val); |
1259 | 0 | } |
1260 | | |
1261 | | int |
1262 | | GEOSCoordSeq_setZ(CoordinateSequence* s, unsigned int idx, double val) |
1263 | 0 | { |
1264 | 0 | return GEOSCoordSeq_setOrdinate(s, idx, CoordinateSequence::Z, val); |
1265 | 0 | } |
1266 | | |
1267 | | int |
1268 | | GEOSCoordSeq_setM(CoordinateSequence* s, unsigned int idx, double val) |
1269 | 0 | { |
1270 | 0 | return GEOSCoordSeq_setOrdinate(s, idx, CoordinateSequence::M, val); |
1271 | 0 | } |
1272 | | |
1273 | | int |
1274 | | GEOSCoordSeq_setXY(CoordinateSequence* s, unsigned int idx, double x, double y) |
1275 | 0 | { |
1276 | 0 | return GEOSCoordSeq_setXY_r(handle, s, idx, x, y); |
1277 | 0 | } |
1278 | | |
1279 | | int |
1280 | | GEOSCoordSeq_setXYZ(CoordinateSequence* s, unsigned int idx, double x, double y, double z) |
1281 | 0 | { |
1282 | 0 | return GEOSCoordSeq_setXYZ_r(handle, s, idx, x, y, z); |
1283 | 0 | } |
1284 | | |
1285 | | CoordinateSequence* |
1286 | | GEOSCoordSeq_clone(const CoordinateSequence* s) |
1287 | 0 | { |
1288 | 0 | return GEOSCoordSeq_clone_r(handle, s); |
1289 | 0 | } |
1290 | | |
1291 | | int |
1292 | | GEOSCoordSeq_getOrdinate(const CoordinateSequence* s, unsigned int idx, unsigned int dim, double* val) |
1293 | 0 | { |
1294 | 0 | return GEOSCoordSeq_getOrdinate_r(handle, s, idx, dim, val); |
1295 | 0 | } |
1296 | | |
1297 | | int |
1298 | | GEOSCoordSeq_getX(const CoordinateSequence* s, unsigned int idx, double* val) |
1299 | 0 | { |
1300 | 0 | return GEOSCoordSeq_getOrdinate(s, idx, CoordinateSequence::X, val); |
1301 | 0 | } |
1302 | | |
1303 | | int |
1304 | | GEOSCoordSeq_getY(const CoordinateSequence* s, unsigned int idx, double* val) |
1305 | 0 | { |
1306 | 0 | return GEOSCoordSeq_getOrdinate(s, idx, CoordinateSequence::Y, val); |
1307 | 0 | } |
1308 | | |
1309 | | int |
1310 | | GEOSCoordSeq_getZ(const CoordinateSequence* s, unsigned int idx, double* val) |
1311 | 0 | { |
1312 | 0 | return GEOSCoordSeq_getOrdinate(s, idx, CoordinateSequence::Z, val); |
1313 | 0 | } |
1314 | | |
1315 | | int |
1316 | | GEOSCoordSeq_getM(const CoordinateSequence* s, unsigned int idx, double* val) |
1317 | 0 | { |
1318 | 0 | return GEOSCoordSeq_getOrdinate(s, idx, CoordinateSequence::M, val); |
1319 | 0 | } |
1320 | | |
1321 | | int |
1322 | | GEOSCoordSeq_getXY(const CoordinateSequence* s, unsigned int idx, double* x, double* y) |
1323 | 0 | { |
1324 | 0 | return GEOSCoordSeq_getXY_r(handle, s, idx, x, y); |
1325 | 0 | } |
1326 | | |
1327 | | int |
1328 | | GEOSCoordSeq_getXYZ(const CoordinateSequence* s, unsigned int idx, double* x, double* y, double* z) |
1329 | 0 | { |
1330 | 0 | return GEOSCoordSeq_getXYZ_r(handle, s, idx, x, y, z); |
1331 | 0 | } |
1332 | | |
1333 | | int |
1334 | | GEOSCoordSeq_getSize(const CoordinateSequence* s, unsigned int* size) |
1335 | 0 | { |
1336 | 0 | return GEOSCoordSeq_getSize_r(handle, s, size); |
1337 | 0 | } |
1338 | | |
1339 | | int |
1340 | | GEOSCoordSeq_getDimensions(const CoordinateSequence* s, unsigned int* dims) |
1341 | 0 | { |
1342 | 0 | return GEOSCoordSeq_getDimensions_r(handle, s, dims); |
1343 | 0 | } |
1344 | | |
1345 | | int |
1346 | | GEOSCoordSeq_isCCW(const CoordinateSequence* s, char* is_ccw) |
1347 | 0 | { |
1348 | 0 | return GEOSCoordSeq_isCCW_r(handle, s, is_ccw); |
1349 | 0 | } |
1350 | | |
1351 | | void |
1352 | | GEOSCoordSeq_destroy(CoordinateSequence* s) |
1353 | 0 | { |
1354 | 0 | return GEOSCoordSeq_destroy_r(handle, s); |
1355 | 0 | } |
1356 | | |
1357 | | const CoordinateSequence* |
1358 | | GEOSGeom_getCoordSeq(const Geometry* g) |
1359 | 0 | { |
1360 | 0 | return GEOSGeom_getCoordSeq_r(handle, g); |
1361 | 0 | } |
1362 | | |
1363 | | Geometry* |
1364 | | GEOSGeom_createPoint(CoordinateSequence* cs) |
1365 | 0 | { |
1366 | 0 | return GEOSGeom_createPoint_r(handle, cs); |
1367 | 0 | } |
1368 | | |
1369 | | Geometry* |
1370 | | GEOSGeom_createPointFromXY(double x, double y) |
1371 | 0 | { |
1372 | 0 | return GEOSGeom_createPointFromXY_r(handle, x, y); |
1373 | 0 | } |
1374 | | |
1375 | | Geometry* |
1376 | | GEOSGeom_createLinearRing(CoordinateSequence* cs) |
1377 | 0 | { |
1378 | 0 | return GEOSGeom_createLinearRing_r(handle, cs); |
1379 | 0 | } |
1380 | | |
1381 | | Geometry* |
1382 | | GEOSGeom_createLineString(CoordinateSequence* cs) |
1383 | 0 | { |
1384 | 0 | return GEOSGeom_createLineString_r(handle, cs); |
1385 | 0 | } |
1386 | | |
1387 | | Geometry* |
1388 | | GEOSGeom_createPolygon(Geometry* shell, Geometry** holes, unsigned int nholes) |
1389 | 0 | { |
1390 | 0 | return GEOSGeom_createPolygon_r(handle, shell, holes, nholes); |
1391 | 0 | } |
1392 | | |
1393 | | Geometry* |
1394 | | GEOSGeom_createCircularString(CoordinateSequence* cs) |
1395 | 0 | { |
1396 | 0 | return GEOSGeom_createCircularString_r(handle, cs); |
1397 | 0 | } |
1398 | | |
1399 | | Geometry* |
1400 | | GEOSGeom_createCompoundCurve(Geometry** curves, unsigned int ngeoms) |
1401 | 0 | { |
1402 | 0 | return GEOSGeom_createCompoundCurve_r(handle, curves, ngeoms); |
1403 | 0 | } |
1404 | | |
1405 | | Geometry* |
1406 | | GEOSGeom_createCurvePolygon(Geometry* shell, Geometry** holes, unsigned int nholes) |
1407 | 0 | { |
1408 | 0 | return GEOSGeom_createCurvePolygon_r(handle, shell, holes, nholes); |
1409 | 0 | } |
1410 | | |
1411 | | Geometry* |
1412 | | GEOSGeom_clone(const Geometry* g) |
1413 | 0 | { |
1414 | 0 | return GEOSGeom_clone_r(handle, g); |
1415 | 0 | } |
1416 | | |
1417 | | GEOSGeometry* |
1418 | | GEOSGeom_setPrecision(const GEOSGeometry* g, double gridSize, int flags) |
1419 | 0 | { |
1420 | 0 | return GEOSGeom_setPrecision_r(handle, g, gridSize, flags); |
1421 | 0 | } |
1422 | | |
1423 | | double |
1424 | | GEOSGeom_getPrecision(const GEOSGeometry* g) |
1425 | 0 | { |
1426 | 0 | return GEOSGeom_getPrecision_r(handle, g); |
1427 | 0 | } |
1428 | | |
1429 | | int |
1430 | | GEOSGeom_getDimensions(const Geometry* g) |
1431 | 0 | { |
1432 | 0 | return GEOSGeom_getDimensions_r(handle, g); |
1433 | 0 | } |
1434 | | |
1435 | | int |
1436 | | GEOSGeom_getCoordinateDimension(const Geometry* g) |
1437 | 0 | { |
1438 | 0 | return GEOSGeom_getCoordinateDimension_r(handle, g); |
1439 | 0 | } |
1440 | | |
1441 | | int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value) |
1442 | 0 | { |
1443 | 0 | return GEOSGeom_getXMin_r(handle, g, value); |
1444 | 0 | } |
1445 | | |
1446 | | int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value) |
1447 | 0 | { |
1448 | 0 | return GEOSGeom_getYMin_r(handle, g, value); |
1449 | 0 | } |
1450 | | |
1451 | | int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value) |
1452 | 0 | { |
1453 | 0 | return GEOSGeom_getXMax_r(handle, g, value); |
1454 | 0 | } |
1455 | | |
1456 | | int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value) |
1457 | 0 | { |
1458 | 0 | return GEOSGeom_getYMax_r(handle, g, value); |
1459 | 0 | } |
1460 | | |
1461 | | int GEOS_DLL GEOSGeom_getExtent(const GEOSGeometry* g, double* xmin, double* ymin, double* xmax, double* ymax) |
1462 | 0 | { |
1463 | 0 | return GEOSGeom_getExtent_r(handle, g, xmin, ymin, xmax, ymax); |
1464 | 0 | } |
1465 | | |
1466 | | Geometry* |
1467 | | GEOSSimplify(const Geometry* g, double tolerance) |
1468 | 0 | { |
1469 | 0 | return GEOSSimplify_r(handle, g, tolerance); |
1470 | 0 | } |
1471 | | |
1472 | | Geometry* |
1473 | | GEOSTopologyPreserveSimplify(const Geometry* g, double tolerance) |
1474 | 0 | { |
1475 | 0 | return GEOSTopologyPreserveSimplify_r(handle, g, tolerance); |
1476 | 0 | } |
1477 | | |
1478 | | |
1479 | | /* WKT Reader */ |
1480 | | WKTReader* |
1481 | | GEOSWKTReader_create() |
1482 | 0 | { |
1483 | 0 | return GEOSWKTReader_create_r(handle); |
1484 | 0 | } |
1485 | | |
1486 | | void |
1487 | | GEOSWKTReader_destroy(WKTReader* reader) |
1488 | 0 | { |
1489 | 0 | GEOSWKTReader_destroy_r(handle, reader); |
1490 | 0 | } |
1491 | | |
1492 | | void |
1493 | | GEOSWKTReader_setFixStructure(WKTReader* reader, char doFix) |
1494 | 0 | { |
1495 | 0 | GEOSWKTReader_setFixStructure_r(handle, reader, doFix); |
1496 | 0 | } |
1497 | | |
1498 | | Geometry* |
1499 | | GEOSWKTReader_read(WKTReader* reader, const char* wkt) |
1500 | 0 | { |
1501 | 0 | return GEOSWKTReader_read_r(handle, reader, wkt); |
1502 | 0 | } |
1503 | | |
1504 | | /* WKT Writer */ |
1505 | | WKTWriter* |
1506 | | GEOSWKTWriter_create() |
1507 | 0 | { |
1508 | 0 | return GEOSWKTWriter_create_r(handle); |
1509 | 0 | } |
1510 | | |
1511 | | void |
1512 | | GEOSWKTWriter_destroy(WKTWriter* Writer) |
1513 | 0 | { |
1514 | 0 | GEOSWKTWriter_destroy_r(handle, Writer); |
1515 | 0 | } |
1516 | | |
1517 | | char* |
1518 | | GEOSWKTWriter_write(WKTWriter* writer, const Geometry* geom) |
1519 | 0 | { |
1520 | 0 | return GEOSWKTWriter_write_r(handle, writer, geom); |
1521 | 0 | } |
1522 | | |
1523 | | void |
1524 | | GEOSWKTWriter_setTrim(WKTWriter* writer, char trim) |
1525 | 0 | { |
1526 | 0 | GEOSWKTWriter_setTrim_r(handle, writer, trim); |
1527 | 0 | } |
1528 | | |
1529 | | void |
1530 | | GEOSWKTWriter_setRoundingPrecision(WKTWriter* writer, int precision) |
1531 | 0 | { |
1532 | 0 | return GEOSWKTWriter_setRoundingPrecision_r(handle, writer, precision); |
1533 | 0 | } |
1534 | | |
1535 | | void |
1536 | | GEOSWKTWriter_setOutputDimension(WKTWriter* writer, int dim) |
1537 | 0 | { |
1538 | 0 | GEOSWKTWriter_setOutputDimension_r(handle, writer, dim); |
1539 | 0 | } |
1540 | | |
1541 | | int |
1542 | | GEOSWKTWriter_getOutputDimension(WKTWriter* writer) |
1543 | 0 | { |
1544 | 0 | return GEOSWKTWriter_getOutputDimension_r(handle, writer); |
1545 | 0 | } |
1546 | | |
1547 | | void |
1548 | | GEOSWKTWriter_setOld3D(WKTWriter* writer, int useOld3D) |
1549 | 0 | { |
1550 | 0 | GEOSWKTWriter_setOld3D_r(handle, writer, useOld3D); |
1551 | 0 | } |
1552 | | |
1553 | | /* WKB Reader */ |
1554 | | WKBReader* |
1555 | | GEOSWKBReader_create() |
1556 | 0 | { |
1557 | 0 | return GEOSWKBReader_create_r(handle); |
1558 | 0 | } |
1559 | | |
1560 | | void |
1561 | | GEOSWKBReader_destroy(WKBReader* reader) |
1562 | 0 | { |
1563 | 0 | GEOSWKBReader_destroy_r(handle, reader); |
1564 | 0 | } |
1565 | | |
1566 | | void |
1567 | | GEOSWKBReader_setFixStructure(WKBReader* reader, char doFix) |
1568 | 0 | { |
1569 | 0 | GEOSWKBReader_setFixStructure_r(handle, reader, doFix); |
1570 | 0 | } |
1571 | | |
1572 | | Geometry* |
1573 | | GEOSWKBReader_read(WKBReader* reader, const unsigned char* wkb, std::size_t size) |
1574 | 0 | { |
1575 | 0 | return GEOSWKBReader_read_r(handle, reader, wkb, size); |
1576 | 0 | } |
1577 | | |
1578 | | Geometry* |
1579 | | GEOSWKBReader_readHEX(WKBReader* reader, const unsigned char* hex, std::size_t size) |
1580 | 0 | { |
1581 | 0 | return GEOSWKBReader_readHEX_r(handle, reader, hex, size); |
1582 | 0 | } |
1583 | | |
1584 | | /* WKB Writer */ |
1585 | | WKBWriter* |
1586 | | GEOSWKBWriter_create() |
1587 | 0 | { |
1588 | 0 | return GEOSWKBWriter_create_r(handle); |
1589 | 0 | } |
1590 | | |
1591 | | void |
1592 | | GEOSWKBWriter_destroy(WKBWriter* Writer) |
1593 | 0 | { |
1594 | 0 | GEOSWKBWriter_destroy_r(handle, Writer); |
1595 | 0 | } |
1596 | | |
1597 | | |
1598 | | /* The caller owns the result */ |
1599 | | unsigned char* |
1600 | | GEOSWKBWriter_write(WKBWriter* writer, const Geometry* geom, std::size_t* size) |
1601 | 0 | { |
1602 | 0 | return GEOSWKBWriter_write_r(handle, writer, geom, size); |
1603 | 0 | } |
1604 | | |
1605 | | /* The caller owns the result */ |
1606 | | unsigned char* |
1607 | | GEOSWKBWriter_writeHEX(WKBWriter* writer, const Geometry* geom, std::size_t* size) |
1608 | 0 | { |
1609 | 0 | return GEOSWKBWriter_writeHEX_r(handle, writer, geom, size); |
1610 | 0 | } |
1611 | | |
1612 | | int |
1613 | | GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer) |
1614 | 0 | { |
1615 | 0 | return GEOSWKBWriter_getOutputDimension_r(handle, writer); |
1616 | 0 | } |
1617 | | |
1618 | | void |
1619 | | GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension) |
1620 | 0 | { |
1621 | 0 | GEOSWKBWriter_setOutputDimension_r(handle, writer, newDimension); |
1622 | 0 | } |
1623 | | |
1624 | | int |
1625 | | GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer) |
1626 | 0 | { |
1627 | 0 | return GEOSWKBWriter_getByteOrder_r(handle, writer); |
1628 | 0 | } |
1629 | | |
1630 | | void |
1631 | | GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int newByteOrder) |
1632 | 0 | { |
1633 | 0 | GEOSWKBWriter_setByteOrder_r(handle, writer, newByteOrder); |
1634 | 0 | } |
1635 | | |
1636 | | int |
1637 | | GEOSWKBWriter_getFlavor(const GEOSWKBWriter* writer) |
1638 | 0 | { |
1639 | 0 | return GEOSWKBWriter_getFlavor_r(handle, writer); |
1640 | 0 | } |
1641 | | |
1642 | | void |
1643 | | GEOSWKBWriter_setFlavor(GEOSWKBWriter* writer, int newFlavor) |
1644 | 0 | { |
1645 | 0 | GEOSWKBWriter_setFlavor_r(handle, writer, newFlavor); |
1646 | 0 | } |
1647 | | |
1648 | | char |
1649 | | GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer) |
1650 | 0 | { |
1651 | 0 | return GEOSWKBWriter_getIncludeSRID_r(handle, writer); |
1652 | 0 | } |
1653 | | |
1654 | | void |
1655 | | GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char newIncludeSRID) |
1656 | 0 | { |
1657 | 0 | GEOSWKBWriter_setIncludeSRID_r(handle, writer, newIncludeSRID); |
1658 | 0 | } |
1659 | | |
1660 | | int |
1661 | 0 | GEOS_printDouble(double d, unsigned int precision, char *result) { |
1662 | 0 | return WKTWriter::writeTrimmedNumber(d, precision, result); |
1663 | 0 | } |
1664 | | |
1665 | | /* GeoJSON Reader */ |
1666 | | GeoJSONReader* |
1667 | | GEOSGeoJSONReader_create() |
1668 | 0 | { |
1669 | 0 | return GEOSGeoJSONReader_create_r(handle); |
1670 | 0 | } |
1671 | | |
1672 | | void |
1673 | | GEOSGeoJSONReader_destroy(GeoJSONReader* reader) |
1674 | 0 | { |
1675 | 0 | GEOSGeoJSONReader_destroy_r(handle, reader); |
1676 | 0 | } |
1677 | | |
1678 | | Geometry* |
1679 | | GEOSGeoJSONReader_readGeometry(GeoJSONReader* reader, const char* geojson) |
1680 | 0 | { |
1681 | 0 | return GEOSGeoJSONReader_readGeometry_r(handle, reader, geojson); |
1682 | 0 | } |
1683 | | |
1684 | | /* GeoJSON Writer */ |
1685 | | GeoJSONWriter* |
1686 | | GEOSGeoJSONWriter_create() |
1687 | 0 | { |
1688 | 0 | return GEOSGeoJSONWriter_create_r(handle); |
1689 | 0 | } |
1690 | | |
1691 | | void |
1692 | | GEOSGeoJSONWriter_destroy(GEOSGeoJSONWriter* writer) |
1693 | 0 | { |
1694 | 0 | GEOSGeoJSONWriter_destroy_r(handle, writer); |
1695 | 0 | } |
1696 | | |
1697 | | char* |
1698 | | GEOSGeoJSONWriter_writeGeometry(GEOSGeoJSONWriter* writer, const GEOSGeometry* g, int indent) |
1699 | 0 | { |
1700 | 0 | return GEOSGeoJSONWriter_writeGeometry_r(handle, writer, g, indent); |
1701 | 0 | } |
1702 | | |
1703 | | void |
1704 | | GEOSGeoJSONWriter_setOutputDimension(GeoJSONWriter* writer, int dim) |
1705 | 0 | { |
1706 | 0 | GEOSGeoJSONWriter_setOutputDimension_r(handle, writer, dim); |
1707 | 0 | } |
1708 | | |
1709 | | int |
1710 | | GEOSGeoJSONWriter_getOutputDimension(GeoJSONWriter* writer) |
1711 | 0 | { |
1712 | 0 | return GEOSGeoJSONWriter_getOutputDimension_r(handle, writer); |
1713 | 0 | } |
1714 | | |
1715 | | |
1716 | | //----------------------------------------------------------------- |
1717 | | // Prepared Geometry |
1718 | | //----------------------------------------------------------------- |
1719 | | |
1720 | | const geos::geom::prep::PreparedGeometry* |
1721 | | GEOSPrepare(const Geometry* g) |
1722 | 0 | { |
1723 | 0 | return GEOSPrepare_r(handle, g); |
1724 | 0 | } |
1725 | | |
1726 | | void |
1727 | | GEOSPreparedGeom_destroy(const geos::geom::prep::PreparedGeometry* a) |
1728 | 0 | { |
1729 | 0 | GEOSPreparedGeom_destroy_r(handle, a); |
1730 | 0 | } |
1731 | | |
1732 | | char |
1733 | | GEOSPreparedContains(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1734 | 0 | { |
1735 | 0 | return GEOSPreparedContains_r(handle, pg1, g2); |
1736 | 0 | } |
1737 | | |
1738 | | char |
1739 | | GEOSPreparedContainsXY(const geos::geom::prep::PreparedGeometry* pg1, double x, double y) |
1740 | 0 | { |
1741 | 0 | return GEOSPreparedContainsXY_r(handle, pg1, x, y); |
1742 | 0 | } |
1743 | | |
1744 | | char |
1745 | | GEOSPreparedContainsProperly(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1746 | 0 | { |
1747 | 0 | return GEOSPreparedContainsProperly_r(handle, pg1, g2); |
1748 | 0 | } |
1749 | | |
1750 | | char |
1751 | | GEOSPreparedCoveredBy(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1752 | 0 | { |
1753 | 0 | return GEOSPreparedCoveredBy_r(handle, pg1, g2); |
1754 | 0 | } |
1755 | | |
1756 | | char |
1757 | | GEOSPreparedCovers(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1758 | 0 | { |
1759 | 0 | return GEOSPreparedCovers_r(handle, pg1, g2); |
1760 | 0 | } |
1761 | | |
1762 | | char |
1763 | | GEOSPreparedCrosses(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1764 | 0 | { |
1765 | 0 | return GEOSPreparedCrosses_r(handle, pg1, g2); |
1766 | 0 | } |
1767 | | |
1768 | | char |
1769 | | GEOSPreparedDisjoint(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1770 | 0 | { |
1771 | 0 | return GEOSPreparedDisjoint_r(handle, pg1, g2); |
1772 | 0 | } |
1773 | | |
1774 | | char |
1775 | | GEOSPreparedIntersects(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1776 | 0 | { |
1777 | 0 | return GEOSPreparedIntersects_r(handle, pg1, g2); |
1778 | 0 | } |
1779 | | |
1780 | | char |
1781 | | GEOSPreparedIntersectsXY(const geos::geom::prep::PreparedGeometry* pg1, double x, double y) |
1782 | 0 | { |
1783 | 0 | return GEOSPreparedIntersectsXY_r(handle, pg1, x, y); |
1784 | 0 | } |
1785 | | |
1786 | | char |
1787 | | GEOSPreparedOverlaps(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1788 | 0 | { |
1789 | 0 | return GEOSPreparedOverlaps_r(handle, pg1, g2); |
1790 | 0 | } |
1791 | | |
1792 | | char |
1793 | | GEOSPreparedTouches(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1794 | 0 | { |
1795 | 0 | return GEOSPreparedTouches_r(handle, pg1, g2); |
1796 | 0 | } |
1797 | | |
1798 | | char |
1799 | | GEOSPreparedWithin(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1800 | 0 | { |
1801 | 0 | return GEOSPreparedWithin_r(handle, pg1, g2); |
1802 | 0 | } |
1803 | | |
1804 | | char * |
1805 | | GEOSPreparedRelate(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) |
1806 | 0 | { |
1807 | 0 | return GEOSPreparedRelate_r(handle, pg1, g2); |
1808 | 0 | } |
1809 | | |
1810 | | char |
1811 | | GEOSPreparedRelatePattern(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2, const char* imPattern) |
1812 | 0 | { |
1813 | 0 | return GEOSPreparedRelatePattern_r(handle, pg1, g2, imPattern); |
1814 | 0 | } |
1815 | | |
1816 | | CoordinateSequence* |
1817 | | GEOSPreparedNearestPoints(const geos::geom::prep::PreparedGeometry* g1, const Geometry* g2) |
1818 | 0 | { |
1819 | 0 | return GEOSPreparedNearestPoints_r(handle, g1, g2); |
1820 | 0 | } |
1821 | | |
1822 | | int |
1823 | | GEOSPreparedDistance(const geos::geom::prep::PreparedGeometry* g1, const Geometry* g2, double *dist) |
1824 | 0 | { |
1825 | 0 | return GEOSPreparedDistance_r(handle, g1, g2, dist); |
1826 | 0 | } |
1827 | | |
1828 | | char |
1829 | | GEOSPreparedDistanceWithin(const geos::geom::prep::PreparedGeometry* g1, const Geometry* g2, double dist) |
1830 | 0 | { |
1831 | 0 | return GEOSPreparedDistanceWithin_r(handle, g1, g2, dist); |
1832 | 0 | } |
1833 | | |
1834 | | GEOSSTRtree* |
1835 | | GEOSSTRtree_create(std::size_t nodeCapacity) |
1836 | 0 | { |
1837 | 0 | return GEOSSTRtree_create_r(handle, nodeCapacity); |
1838 | 0 | } |
1839 | | |
1840 | | int |
1841 | | GEOSSTRtree_build(GEOSSTRtree* tree) |
1842 | 0 | { |
1843 | 0 | return GEOSSTRtree_build_r(handle, tree); |
1844 | 0 | } |
1845 | | |
1846 | | void |
1847 | | GEOSSTRtree_insert(GEOSSTRtree* tree, |
1848 | | const geos::geom::Geometry* g, |
1849 | | void* item) |
1850 | 0 | { |
1851 | 0 | GEOSSTRtree_insert_r(handle, tree, g, item); |
1852 | 0 | } |
1853 | | |
1854 | | void |
1855 | | GEOSSTRtree_query(GEOSSTRtree* tree, |
1856 | | const geos::geom::Geometry* g, |
1857 | | GEOSQueryCallback cb, |
1858 | | void* userdata) |
1859 | 0 | { |
1860 | 0 | GEOSSTRtree_query_r(handle, tree, g, cb, userdata); |
1861 | 0 | } |
1862 | | |
1863 | | const GEOSGeometry* |
1864 | | GEOSSTRtree_nearest(GEOSSTRtree* tree, |
1865 | | const geos::geom::Geometry* g) |
1866 | 0 | { |
1867 | 0 | return GEOSSTRtree_nearest_r(handle, tree, g); |
1868 | 0 | } |
1869 | | |
1870 | | const void* GEOSSTRtree_nearest_generic(GEOSSTRtree* tree, |
1871 | | const void* item, |
1872 | | const GEOSGeometry* itemEnvelope, |
1873 | | GEOSDistanceCallback distancefn, |
1874 | | void* userdata) |
1875 | 0 | { |
1876 | 0 | return GEOSSTRtree_nearest_generic_r(handle, tree, item, itemEnvelope, distancefn, userdata); |
1877 | 0 | } |
1878 | | |
1879 | | void |
1880 | | GEOSSTRtree_iterate(GEOSSTRtree* tree, |
1881 | | GEOSQueryCallback callback, |
1882 | | void* userdata) |
1883 | 0 | { |
1884 | 0 | GEOSSTRtree_iterate_r(handle, tree, callback, userdata); |
1885 | 0 | } |
1886 | | |
1887 | | char |
1888 | | GEOSSTRtree_remove(GEOSSTRtree* tree, |
1889 | | const geos::geom::Geometry* g, |
1890 | | void* item) |
1891 | 0 | { |
1892 | 0 | return GEOSSTRtree_remove_r(handle, tree, g, item); |
1893 | 0 | } |
1894 | | |
1895 | | void |
1896 | | GEOSSTRtree_destroy(GEOSSTRtree* tree) |
1897 | 0 | { |
1898 | 0 | GEOSSTRtree_destroy_r(handle, tree); |
1899 | 0 | } |
1900 | | |
1901 | | double |
1902 | | GEOSProject(const geos::geom::Geometry* g, |
1903 | | const geos::geom::Geometry* p) |
1904 | 0 | { |
1905 | 0 | return GEOSProject_r(handle, g, p); |
1906 | 0 | } |
1907 | | |
1908 | | geos::geom::Geometry* |
1909 | | GEOSInterpolate(const geos::geom::Geometry* g, |
1910 | | double d) |
1911 | 0 | { |
1912 | 0 | return GEOSInterpolate_r(handle, g, d); |
1913 | 0 | } |
1914 | | |
1915 | | double |
1916 | | GEOSProjectNormalized(const geos::geom::Geometry* g, |
1917 | | const geos::geom::Geometry* p) |
1918 | 0 | { |
1919 | 0 | return GEOSProjectNormalized_r(handle, g, p); |
1920 | 0 | } |
1921 | | |
1922 | | geos::geom::Geometry* |
1923 | | GEOSInterpolateNormalized(const geos::geom::Geometry* g, |
1924 | | double d) |
1925 | 0 | { |
1926 | 0 | return GEOSInterpolateNormalized_r(handle, g, d); |
1927 | 0 | } |
1928 | | |
1929 | | geos::geom::Geometry* |
1930 | | GEOSGeom_extractUniquePoints(const geos::geom::Geometry* g) |
1931 | 0 | { |
1932 | 0 | return GEOSGeom_extractUniquePoints_r(handle, g); |
1933 | 0 | } |
1934 | | |
1935 | | geos::geom::Geometry* |
1936 | | GEOSGeom_createEmptyCollection(int type) |
1937 | 0 | { |
1938 | 0 | return GEOSGeom_createEmptyCollection_r(handle, type); |
1939 | 0 | } |
1940 | | |
1941 | | geos::geom::Geometry* |
1942 | | GEOSGeom_createEmptyPoint() |
1943 | 0 | { |
1944 | 0 | return GEOSGeom_createEmptyPoint_r(handle); |
1945 | 0 | } |
1946 | | |
1947 | | geos::geom::Geometry* |
1948 | | GEOSGeom_createEmptyLineString() |
1949 | 0 | { |
1950 | 0 | return GEOSGeom_createEmptyLineString_r(handle); |
1951 | 0 | } |
1952 | | |
1953 | | geos::geom::Geometry* |
1954 | | GEOSGeom_createEmptyPolygon() |
1955 | 0 | { |
1956 | 0 | return GEOSGeom_createEmptyPolygon_r(handle); |
1957 | 0 | } |
1958 | | |
1959 | | geos::geom::Geometry* |
1960 | | GEOSGeom_createEmptyCircularString() |
1961 | 0 | { |
1962 | 0 | return GEOSGeom_createEmptyCircularString_r(handle); |
1963 | 0 | } |
1964 | | |
1965 | | geos::geom::Geometry* |
1966 | | GEOSGeom_createEmptyCompoundCurve() |
1967 | 0 | { |
1968 | 0 | return GEOSGeom_createEmptyCompoundCurve_r(handle); |
1969 | 0 | } |
1970 | | |
1971 | | geos::geom::Geometry* |
1972 | | GEOSGeom_createEmptyCurvePolygon() |
1973 | 0 | { |
1974 | 0 | return GEOSGeom_createEmptyCurvePolygon_r(handle); |
1975 | 0 | } |
1976 | | |
1977 | | geos::geom::Geometry* |
1978 | | GEOSGeom_createRectangle(double xmin, double ymin, double xmax, |
1979 | | double ymax) |
1980 | 0 | { |
1981 | 0 | return GEOSGeom_createRectangle_r(handle, xmin, ymin, xmax, ymax); |
1982 | 0 | } |
1983 | | |
1984 | | int |
1985 | | GEOSOrientationIndex(double Ax, double Ay, double Bx, double By, |
1986 | | double Px, double Py) |
1987 | 0 | { |
1988 | 0 | return GEOSOrientationIndex_r(handle, Ax, Ay, Bx, By, Px, Py); |
1989 | 0 | } |
1990 | | |
1991 | | GEOSGeometry* |
1992 | | GEOSSharedPaths(const GEOSGeometry* g1, const GEOSGeometry* g2) |
1993 | 0 | { |
1994 | 0 | return GEOSSharedPaths_r(handle, g1, g2); |
1995 | 0 | } |
1996 | | |
1997 | | GEOSGeometry* |
1998 | | GEOSSnap(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance) |
1999 | 0 | { |
2000 | 0 | return GEOSSnap_r(handle, g1, g2, tolerance); |
2001 | 0 | } |
2002 | | |
2003 | | GEOSBufferParams* |
2004 | | GEOSBufferParams_create() |
2005 | 0 | { |
2006 | 0 | return GEOSBufferParams_create_r(handle); |
2007 | 0 | } |
2008 | | |
2009 | | void |
2010 | | GEOSBufferParams_destroy(GEOSBufferParams* p) |
2011 | 0 | { |
2012 | 0 | return GEOSBufferParams_destroy_r(handle, p); |
2013 | 0 | } |
2014 | | |
2015 | | int |
2016 | | GEOSBufferParams_setEndCapStyle(GEOSBufferParams* p, int style) |
2017 | 0 | { |
2018 | 0 | return GEOSBufferParams_setEndCapStyle_r(handle, p, style); |
2019 | 0 | } |
2020 | | |
2021 | | int |
2022 | | GEOSBufferParams_setJoinStyle(GEOSBufferParams* p, int joinStyle) |
2023 | 0 | { |
2024 | 0 | return GEOSBufferParams_setJoinStyle_r(handle, p, joinStyle); |
2025 | 0 | } |
2026 | | |
2027 | | int |
2028 | | GEOSBufferParams_setMitreLimit(GEOSBufferParams* p, double l) |
2029 | 0 | { |
2030 | 0 | return GEOSBufferParams_setMitreLimit_r(handle, p, l); |
2031 | 0 | } |
2032 | | |
2033 | | int |
2034 | | GEOSBufferParams_setQuadrantSegments(GEOSBufferParams* p, int joinStyle) |
2035 | 0 | { |
2036 | 0 | return GEOSBufferParams_setQuadrantSegments_r(handle, p, joinStyle); |
2037 | 0 | } |
2038 | | |
2039 | | int |
2040 | | GEOSBufferParams_setSingleSided(GEOSBufferParams* p, int singleSided) |
2041 | 0 | { |
2042 | 0 | return GEOSBufferParams_setSingleSided_r(handle, p, singleSided); |
2043 | 0 | } |
2044 | | |
2045 | | Geometry* |
2046 | | GEOSBufferWithParams(const Geometry* g, const GEOSBufferParams* p, double w) |
2047 | 0 | { |
2048 | 0 | return GEOSBufferWithParams_r(handle, g, p, w); |
2049 | 0 | } |
2050 | | |
2051 | | Geometry* |
2052 | | GEOSDelaunayTriangulation(const Geometry* g, double tolerance, int onlyEdges) |
2053 | 0 | { |
2054 | 0 | return GEOSDelaunayTriangulation_r(handle, g, tolerance, onlyEdges); |
2055 | 0 | } |
2056 | | |
2057 | | Geometry* |
2058 | | GEOSConstrainedDelaunayTriangulation(const Geometry* g) |
2059 | 0 | { |
2060 | 0 | return GEOSConstrainedDelaunayTriangulation_r(handle, g); |
2061 | 0 | } |
2062 | | |
2063 | | Geometry* |
2064 | | GEOSVoronoiDiagram(const Geometry* g, const Geometry* env, double tolerance, int flags) |
2065 | 0 | { |
2066 | 0 | return GEOSVoronoiDiagram_r(handle, g, env, tolerance, flags); |
2067 | 0 | } |
2068 | | |
2069 | | int |
2070 | | GEOSSegmentIntersection(double ax0, double ay0, double ax1, double ay1, |
2071 | | double bx0, double by0, double bx1, double by1, |
2072 | | double* cx, double* cy) |
2073 | 0 | { |
2074 | 0 | return GEOSSegmentIntersection_r(handle, |
2075 | 0 | ax0, ay0, ax1, ay1, |
2076 | 0 | bx0, by0, bx1, by1, |
2077 | 0 | cx, cy); |
2078 | 0 | } |
2079 | | |
2080 | | int |
2081 | | GEOSCoverageIsValid( |
2082 | | const Geometry* input, |
2083 | | double gapWidth, |
2084 | | Geometry** invalidEdges) |
2085 | 0 | { |
2086 | 0 | return GEOSCoverageIsValid_r(handle, input, gapWidth, invalidEdges); |
2087 | 0 | } |
2088 | | |
2089 | | Geometry* |
2090 | | GEOSCoverageSimplifyVW(const Geometry* input, double tolerance, int preserveBoundary) |
2091 | 0 | { |
2092 | 0 | return GEOSCoverageSimplifyVW_r(handle, input, tolerance, preserveBoundary); |
2093 | 0 | } |
2094 | | |
2095 | | |
2096 | | } /* extern "C" */ |