1 /************************************************************************
4 * C-Wrapper for GEOS library
6 * Copyright (C) 2010 2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
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.
14 * Author: Sandro Santilli <strk@keybit.net>
16 ***********************************************************************/
18 #include <geos/geom/prep/PreparedGeometryFactory.h>
19 #include <geos/index/strtree/STRtree.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/CLocalizer.h>
25 #include <geos/operation/overlay/OverlayOp.h>
26 #include <geos/operation/union/CascadedPolygonUnion.h>
27 #include <geos/algorithm/distance/DiscreteHausdorffDistance.h>
28 #include <geos/util/Interrupt.h>
34 #pragma warning(disable : 4099)
37 // Some extra magic to make type declarations in geos_c.h work - for cross-checking of types in header.
38 #define GEOSGeometry geos::geom::Geometry
39 #define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry
40 #define GEOSCoordSequence geos::geom::CoordinateSequence
41 #define GEOSSTRtree geos::index::strtree::STRtree
42 #define GEOSWKTReader_t geos::io::WKTReader
43 #define GEOSWKTWriter_t geos::io::WKTWriter
44 #define GEOSWKBReader_t geos::io::WKBReader
45 #define GEOSWKBWriter_t geos::io::WKBWriter
46 typedef struct GEOSBufParams_t GEOSBufferParams
;
50 /// Define this if you want operations triggering Exceptions to
51 /// be printed (will use the NOTIFY channel - only implemented for GEOSUnion so far)
53 #undef VERBOSE_EXCEPTIONS
55 #include <geos/export.h>
59 # define GEOS_DLL __declspec(dllexport)
65 // import the most frequently used definitions globally
66 using geos::geom::Geometry
;
67 using geos::geom::LineString
;
68 using geos::geom::Polygon
;
69 using geos::geom::CoordinateSequence
;
70 using geos::geom::GeometryFactory
;
72 using geos::io::WKTReader
;
73 using geos::io::WKTWriter
;
74 using geos::io::WKBReader
;
75 using geos::io::WKBWriter
;
76 using geos::io::CLocalizer
;
78 using geos::index::strtree::STRtree
;
80 using geos::operation::overlay::OverlayOp
;
81 using geos::operation::overlay::overlayOp
;
82 using geos::operation::geounion::CascadedPolygonUnion
;
84 typedef std::auto_ptr
<Geometry
> GeomAutoPtr
;
86 //## GLOBALS ################################################
88 // NOTE: SRID will have to be changed after geometry creation
89 GEOSContextHandle_t handle
= NULL
;
94 initGEOS (GEOSMessageHandler nf
, GEOSMessageHandler ef
)
98 handle
= initGEOS_r( nf
, ef
);
102 GEOSContext_setNoticeHandler_r(handle
, nf
);
103 GEOSContext_setErrorHandler_r(handle
, ef
);
106 geos::util::Interrupt::cancel();
112 if (handle
!= NULL
) {
113 finishGEOS_r( handle
);
118 GEOSInterruptCallback
*
119 GEOS_interruptRegisterCallback(GEOSInterruptCallback
* cb
)
121 return geos::util::Interrupt::registerCallback(cb
);
125 GEOS_interruptRequest()
127 geos::util::Interrupt::request();
131 GEOS_interruptCancel()
133 geos::util::Interrupt::cancel();
137 GEOSFree (void* buffer
)
139 GEOSFree_r( handle
, buffer
);
142 /****************************************************************
143 ** relate()-related functions
144 ** return 0 = false, 1 = true, 2 = error occured
148 GEOSDisjoint(const Geometry
*g1
, const Geometry
*g2
)
150 return GEOSDisjoint_r( handle
, g1
, g2
);
154 GEOSTouches(const Geometry
*g1
, const Geometry
*g2
)
156 return GEOSTouches_r( handle
, g1
, g2
);
160 GEOSIntersects(const Geometry
*g1
, const Geometry
*g2
)
162 return GEOSIntersects_r( handle
, g1
, g2
);
166 GEOSCrosses(const Geometry
*g1
, const Geometry
*g2
)
168 return GEOSCrosses_r( handle
, g1
, g2
);
172 GEOSWithin(const Geometry
*g1
, const Geometry
*g2
)
174 return GEOSWithin_r( handle
, g1
, g2
);
177 // call g1->contains(g2)
180 // 2 = error was trapped
182 GEOSContains(const Geometry
*g1
, const Geometry
*g2
)
184 return GEOSContains_r( handle
, g1
, g2
);
188 GEOSOverlaps(const Geometry
*g1
, const Geometry
*g2
)
190 return GEOSOverlaps_r( handle
, g1
, g2
);
194 GEOSCovers(const Geometry
*g1
, const Geometry
*g2
)
196 return GEOSCovers_r( handle
, g1
, g2
);
200 GEOSCoveredBy(const Geometry
*g1
, const Geometry
*g2
)
202 return GEOSCoveredBy_r( handle
, g1
, g2
);
206 //-------------------------------------------------------------------
207 // low-level relate functions
208 //------------------------------------------------------------------
211 GEOSRelatePattern(const Geometry
*g1
, const Geometry
*g2
, const char *pat
)
213 return GEOSRelatePattern_r( handle
, g1
, g2
, pat
);
217 GEOSRelatePatternMatch(const char *mat
, const char *pat
)
219 return GEOSRelatePatternMatch_r( handle
, mat
, pat
);
223 GEOSRelate(const Geometry
*g1
, const Geometry
*g2
)
225 return GEOSRelate_r( handle
, g1
, g2
);
229 GEOSRelateBoundaryNodeRule(const Geometry
*g1
, const Geometry
*g2
, int bnr
)
231 return GEOSRelateBoundaryNodeRule_r( handle
, g1
, g2
, bnr
);
235 //-----------------------------------------------------------------
237 //-----------------------------------------------------------------
241 GEOSisValid(const Geometry
*g
)
243 return GEOSisValid_r( handle
, g
);
247 GEOSisValidReason(const Geometry
*g
)
249 return GEOSisValidReason_r( handle
, g
);
253 GEOSisValidDetail(const Geometry
*g
, int flags
,
254 char** reason
, Geometry
** location
)
256 return GEOSisValidDetail_r( handle
, g
, flags
, reason
, location
);
259 //-----------------------------------------------------------------
261 //-----------------------------------------------------------------
264 GEOSEquals(const Geometry
*g1
, const Geometry
*g2
)
266 return GEOSEquals_r( handle
, g1
, g2
);
270 GEOSEqualsExact(const Geometry
*g1
, const Geometry
*g2
, double tolerance
)
272 return GEOSEqualsExact_r( handle
, g1
, g2
, tolerance
);
276 GEOSDistance(const Geometry
*g1
, const Geometry
*g2
, double *dist
)
278 return GEOSDistance_r( handle
, g1
, g2
, dist
);
282 GEOSHausdorffDistance(const Geometry
*g1
, const Geometry
*g2
, double *dist
)
284 return GEOSHausdorffDistance_r( handle
, g1
, g2
, dist
);
288 GEOSHausdorffDistanceDensify(const Geometry
*g1
, const Geometry
*g2
, double densifyFrac
, double *dist
)
290 return GEOSHausdorffDistanceDensify_r( handle
, g1
, g2
, densifyFrac
, dist
);
294 GEOSArea(const Geometry
*g
, double *area
)
296 return GEOSArea_r( handle
, g
, area
);
300 GEOSLength(const Geometry
*g
, double *length
)
302 return GEOSLength_r( handle
, g
, length
);
306 GEOSNearestPoints(const Geometry
*g1
, const Geometry
*g2
)
308 return GEOSNearestPoints_r( handle
, g1
, g2
);
312 GEOSGeomFromWKT(const char *wkt
)
314 return GEOSGeomFromWKT_r( handle
, wkt
);
318 GEOSGeomToWKT(const Geometry
*g
)
320 return GEOSGeomToWKT_r( handle
, g
);
323 // Remember to free the result!
325 GEOSGeomToWKB_buf(const Geometry
*g
, size_t *size
)
327 return GEOSGeomToWKB_buf_r( handle
, g
, size
);
331 GEOSGeomFromWKB_buf(const unsigned char *wkb
, size_t size
)
333 return GEOSGeomFromWKB_buf_r( handle
, wkb
, size
);
336 /* Read/write wkb hex values. Returned geometries are
337 owned by the caller.*/
339 GEOSGeomToHEX_buf(const Geometry
*g
, size_t *size
)
341 return GEOSGeomToHEX_buf_r( handle
, g
, size
);
345 GEOSGeomFromHEX_buf(const unsigned char *hex
, size_t size
)
347 return GEOSGeomFromHEX_buf_r( handle
, hex
, size
);
351 GEOSisEmpty(const Geometry
*g
)
353 return GEOSisEmpty_r( handle
, g
);
357 GEOSisSimple(const Geometry
*g
)
359 return GEOSisSimple_r( handle
, g
);
363 GEOSisRing(const Geometry
*g
)
365 return GEOSisRing_r( handle
, g
);
370 //free the result of this
372 GEOSGeomType(const Geometry
*g
)
374 return GEOSGeomType_r( handle
, g
);
377 // Return postgis geometry type index
379 GEOSGeomTypeId(const Geometry
*g
)
381 return GEOSGeomTypeId_r( handle
, g
);
387 //-------------------------------------------------------------------
388 // GEOS functions that return geometries
389 //-------------------------------------------------------------------
392 GEOSEnvelope(const Geometry
*g
)
394 return GEOSEnvelope_r( handle
, g
);
398 GEOSIntersection(const Geometry
*g1
, const Geometry
*g2
)
400 return GEOSIntersection_r( handle
, g1
, g2
);
404 GEOSBuffer(const Geometry
*g
, double width
, int quadrantsegments
)
406 return GEOSBuffer_r( handle
, g
, width
, quadrantsegments
);
410 GEOSBufferWithStyle(const Geometry
*g
, double width
, int quadsegs
,
411 int endCapStyle
, int joinStyle
, double mitreLimit
)
413 return GEOSBufferWithStyle_r( handle
, g
, width
, quadsegs
, endCapStyle
,
414 joinStyle
, mitreLimit
);
418 GEOSSingleSidedBuffer(const Geometry
*g
, double width
, int quadsegs
,
419 int joinStyle
, double mitreLimit
, int leftSide
)
421 return GEOSSingleSidedBuffer_r( handle
, g
, width
, quadsegs
,
422 joinStyle
, mitreLimit
, leftSide
);
426 GEOSOffsetCurve(const Geometry
*g
, double width
, int quadsegs
,
427 int joinStyle
, double mitreLimit
)
429 return GEOSOffsetCurve_r( handle
, g
, width
, quadsegs
,
430 joinStyle
, mitreLimit
);
434 GEOSConvexHull(const Geometry
*g
)
436 return GEOSConvexHull_r( handle
, g
);
440 GEOSMinimumRotatedRectangle(const Geometry
*g
)
442 return GEOSMinimumRotatedRectangle_r( handle
, g
);
446 GEOSMinimumDiameter(const Geometry
*g
)
448 return GEOSMinimumDiameter_r( handle
, g
);
452 GEOSDifference(const Geometry
*g1
, const Geometry
*g2
)
454 return GEOSDifference_r( handle
, g1
, g2
);
458 GEOSBoundary(const Geometry
*g
)
460 return GEOSBoundary_r( handle
, g
);
464 GEOSSymDifference(const Geometry
*g1
, const Geometry
*g2
)
466 return GEOSSymDifference_r( handle
, g1
, g2
);
470 GEOSUnion(const Geometry
*g1
, const Geometry
*g2
)
472 return GEOSUnion_r( handle
, g1
, g2
);
476 GEOSUnaryUnion(const Geometry
*g
)
478 return GEOSUnaryUnion_r( handle
, g
);
482 GEOSNode(const Geometry
*g
)
484 return GEOSNode_r( handle
, g
);
488 GEOSUnionCascaded(const Geometry
*g
)
490 return GEOSUnionCascaded_r( handle
, g
);
494 GEOSPointOnSurface(const Geometry
*g
)
496 return GEOSPointOnSurface_r( handle
, g
);
501 GEOSClipByRect(const Geometry
*g
, double xmin
, double ymin
, double xmax
, double ymax
)
503 return GEOSClipByRect_r( handle
, g
, xmin
, ymin
, xmax
, ymax
);
508 //-------------------------------------------------------------------
509 // memory management functions
510 //------------------------------------------------------------------
514 GEOSGeom_destroy(Geometry
*a
)
516 return GEOSGeom_destroy_r( handle
, a
);
521 GEOSGetNumCoordinates(const Geometry
*g
)
523 return GEOSGetNumCoordinates_r( handle
, g
);
527 * Return -1 on exception, 0 otherwise.
528 * Converts Geometry to normal form (or canonical form).
531 GEOSNormalize(Geometry
*g
)
533 return GEOSNormalize_r( handle
, g
);
537 GEOSGetNumInteriorRings(const Geometry
*g
)
539 return GEOSGetNumInteriorRings_r( handle
, g
);
543 // returns -1 on error and 1 for non-multi geometries
545 GEOSGetNumGeometries(const Geometry
*g
)
547 return GEOSGetNumGeometries_r( handle
, g
);
552 * Call only on GEOMETRYCOLLECTION or MULTI*.
553 * Return a pointer to the internal Geometry.
556 GEOSGetGeometryN(const Geometry
*g
, int n
)
558 return GEOSGetGeometryN_r( handle
, g
, n
);
562 * Call only on LINESTRING
563 * Returns NULL on exception
566 GEOSGeomGetPointN(const Geometry
*g
, int n
)
568 return GEOSGeomGetPointN_r(handle
, g
, n
);
572 * Call only on LINESTRING
575 GEOSGeomGetStartPoint(const Geometry
*g
)
577 return GEOSGeomGetStartPoint_r(handle
, g
);
581 * Call only on LINESTRING
584 GEOSGeomGetEndPoint(const Geometry
*g
)
586 return GEOSGeomGetEndPoint_r(handle
, g
);
590 * Call only on LINESTRING
591 * return 2 on exception, 1 on true, 0 on false
594 GEOSisClosed(const Geometry
*g
)
596 return GEOSisClosed_r(handle
, g
);
600 * Call only on LINESTRING
601 * returns 0 on exception, otherwise 1
604 GEOSGeomGetLength(const Geometry
*g
, double *length
)
606 return GEOSGeomGetLength_r(handle
, g
, length
);
610 * Call only on LINESTRING
611 * returns -1 on exception
614 GEOSGeomGetNumPoints(const Geometry
*g
)
616 return GEOSGeomGetNumPoints_r(handle
, g
);
621 * returns 0 on exception, otherwise 1
624 GEOSGeomGetX(const Geometry
*g
, double *x
)
626 return GEOSGeomGetX_r(handle
, g
, x
);
631 * returns 0 on exception, otherwise 1
634 GEOSGeomGetY(const Geometry
*g
, double *y
)
636 return GEOSGeomGetY_r(handle
, g
, y
);
640 * Call only on polygon
641 * Return a copy of the internal Geometry.
644 GEOSGetExteriorRing(const Geometry
*g
)
646 return GEOSGetExteriorRing_r( handle
, g
);
650 * Call only on polygon
651 * Return a pointer to internal storage, do not destroy it.
654 GEOSGetInteriorRingN(const Geometry
*g
, int n
)
656 return GEOSGetInteriorRingN_r( handle
, g
, n
);
660 GEOSGetCentroid(const Geometry
*g
)
662 return GEOSGetCentroid_r( handle
, g
);
666 GEOSGeom_createCollection(int type
, Geometry
**geoms
, unsigned int ngeoms
)
668 return GEOSGeom_createCollection_r( handle
, type
, geoms
, ngeoms
);
672 GEOSPolygonize(const Geometry
* const * g
, unsigned int ngeoms
)
674 return GEOSPolygonize_r( handle
, g
, ngeoms
);
678 GEOSPolygonizer_getCutEdges(const Geometry
* const * g
, unsigned int ngeoms
)
680 return GEOSPolygonizer_getCutEdges_r( handle
, g
, ngeoms
);
684 GEOSPolygonize_full(const GEOSGeometry
* input
,
685 GEOSGeometry
** cuts
, GEOSGeometry
** dangles
, GEOSGeometry
** invalid
)
687 return GEOSPolygonize_full_r(handle
, input
, cuts
, dangles
, invalid
);
691 GEOSLineMerge(const Geometry
*g
)
693 return GEOSLineMerge_r( handle
, g
);
697 GEOSGetSRID(const Geometry
*g
)
699 return GEOSGetSRID_r( handle
, g
);
703 GEOSSetSRID(Geometry
*g
, int srid
)
705 return GEOSSetSRID_r( handle
, g
, srid
);
709 GEOSHasZ(const Geometry
*g
)
711 return GEOSHasZ_r( handle
, g
);
715 GEOS_getWKBOutputDims()
717 return GEOS_getWKBOutputDims_r( handle
);
721 GEOS_setWKBOutputDims(int newdims
)
723 return GEOS_setWKBOutputDims_r( handle
, newdims
);
727 GEOS_getWKBByteOrder()
729 return GEOS_getWKBByteOrder_r( handle
);
733 GEOS_setWKBByteOrder(int byteOrder
)
735 return GEOS_setWKBByteOrder_r( handle
, byteOrder
);
740 GEOSCoordSeq_create(unsigned int size
, unsigned int dims
)
742 return GEOSCoordSeq_create_r( handle
, size
, dims
);
746 GEOSCoordSeq_setOrdinate(CoordinateSequence
*s
, unsigned int idx
, unsigned int dim
, double val
)
748 return GEOSCoordSeq_setOrdinate_r( handle
, s
, idx
, dim
, val
);
752 GEOSCoordSeq_setX(CoordinateSequence
*s
, unsigned int idx
, double val
)
754 return GEOSCoordSeq_setOrdinate(s
, idx
, 0, val
);
758 GEOSCoordSeq_setY(CoordinateSequence
*s
, unsigned int idx
, double val
)
760 return GEOSCoordSeq_setOrdinate(s
, idx
, 1, val
);
764 GEOSCoordSeq_setZ(CoordinateSequence
*s
, unsigned int idx
, double val
)
766 return GEOSCoordSeq_setOrdinate(s
, idx
, 2, val
);
770 GEOSCoordSeq_clone(const CoordinateSequence
*s
)
772 return GEOSCoordSeq_clone_r( handle
, s
);
776 GEOSCoordSeq_getOrdinate(const CoordinateSequence
*s
, unsigned int idx
, unsigned int dim
, double *val
)
778 return GEOSCoordSeq_getOrdinate_r( handle
, s
, idx
, dim
, val
);
782 GEOSCoordSeq_getX(const CoordinateSequence
*s
, unsigned int idx
, double *val
)
784 return GEOSCoordSeq_getOrdinate(s
, idx
, 0, val
);
788 GEOSCoordSeq_getY(const CoordinateSequence
*s
, unsigned int idx
, double *val
)
790 return GEOSCoordSeq_getOrdinate(s
, idx
, 1, val
);
794 GEOSCoordSeq_getZ(const CoordinateSequence
*s
, unsigned int idx
, double *val
)
796 return GEOSCoordSeq_getOrdinate(s
, idx
, 2, val
);
800 GEOSCoordSeq_getSize(const CoordinateSequence
*s
, unsigned int *size
)
802 return GEOSCoordSeq_getSize_r( handle
, s
, size
);
806 GEOSCoordSeq_getDimensions(const CoordinateSequence
*s
, unsigned int *dims
)
808 return GEOSCoordSeq_getDimensions_r( handle
, s
, dims
);
812 GEOSCoordSeq_destroy(CoordinateSequence
*s
)
814 return GEOSCoordSeq_destroy_r( handle
, s
);
817 const CoordinateSequence
*
818 GEOSGeom_getCoordSeq(const Geometry
*g
)
820 return GEOSGeom_getCoordSeq_r( handle
, g
);
824 GEOSGeom_createPoint(CoordinateSequence
*cs
)
826 return GEOSGeom_createPoint_r( handle
, cs
);
830 GEOSGeom_createLinearRing(CoordinateSequence
*cs
)
832 return GEOSGeom_createLinearRing_r( handle
, cs
);
836 GEOSGeom_createLineString(CoordinateSequence
*cs
)
838 return GEOSGeom_createLineString_r( handle
, cs
);
842 GEOSGeom_createPolygon(Geometry
*shell
, Geometry
**holes
, unsigned int nholes
)
844 return GEOSGeom_createPolygon_r( handle
, shell
, holes
, nholes
);
848 GEOSGeom_clone(const Geometry
*g
)
850 return GEOSGeom_clone_r( handle
, g
);
854 GEOSGeom_setPrecision(const GEOSGeometry
*g
, double gridSize
, int flags
)
856 return GEOSGeom_setPrecision_r(handle
, g
, gridSize
, flags
);
860 GEOSGeom_getPrecision(const GEOSGeometry
*g
)
862 return GEOSGeom_getPrecision_r(handle
, g
);
866 GEOSGeom_getDimensions(const Geometry
*g
)
868 return GEOSGeom_getDimensions_r( handle
, g
);
872 GEOSGeom_getCoordinateDimension(const Geometry
*g
)
874 return GEOSGeom_getCoordinateDimension_r( handle
, g
);
878 GEOSSimplify(const Geometry
*g
, double tolerance
)
880 return GEOSSimplify_r( handle
, g
, tolerance
);
884 GEOSTopologyPreserveSimplify(const Geometry
*g
, double tolerance
)
886 return GEOSTopologyPreserveSimplify_r( handle
, g
, tolerance
);
892 GEOSWKTReader_create()
894 return GEOSWKTReader_create_r( handle
);
898 GEOSWKTReader_destroy(WKTReader
*reader
)
900 GEOSWKTReader_destroy_r( handle
, reader
);
905 GEOSWKTReader_read(WKTReader
*reader
, const char *wkt
)
907 return GEOSWKTReader_read_r( handle
, reader
, wkt
);
912 GEOSWKTWriter_create()
914 return GEOSWKTWriter_create_r( handle
);
918 GEOSWKTWriter_destroy(WKTWriter
*Writer
)
920 GEOSWKTWriter_destroy_r( handle
, Writer
);
924 GEOSWKTWriter_write(WKTWriter
*writer
, const Geometry
*geom
)
926 return GEOSWKTWriter_write_r( handle
, writer
, geom
);
930 GEOSWKTWriter_setTrim(WKTWriter
*writer
, char trim
)
932 GEOSWKTWriter_setTrim_r(handle
, writer
, trim
);
936 GEOSWKTWriter_setRoundingPrecision(WKTWriter
*writer
, int precision
)
938 return GEOSWKTWriter_setRoundingPrecision_r(handle
, writer
, precision
);
942 GEOSWKTWriter_setOutputDimension(WKTWriter
*writer
, int dim
)
944 GEOSWKTWriter_setOutputDimension_r(handle
, writer
, dim
);
948 GEOSWKTWriter_getOutputDimension(WKTWriter
*writer
)
950 return GEOSWKTWriter_getOutputDimension_r(handle
, writer
);
954 GEOSWKTWriter_setOld3D(WKTWriter
*writer
, int useOld3D
)
956 GEOSWKTWriter_setOld3D_r(handle
, writer
, useOld3D
);
961 GEOSWKBReader_create()
963 return GEOSWKBReader_create_r( handle
);
967 GEOSWKBReader_destroy(WKBReader
*reader
)
969 GEOSWKBReader_destroy_r( handle
, reader
);
974 GEOSWKBReader_read(WKBReader
*reader
, const unsigned char *wkb
, size_t size
)
976 return GEOSWKBReader_read_r( handle
, reader
, wkb
, size
);
980 GEOSWKBReader_readHEX(WKBReader
*reader
, const unsigned char *hex
, size_t size
)
982 return GEOSWKBReader_readHEX_r( handle
, reader
, hex
, size
);
987 GEOSWKBWriter_create()
989 return GEOSWKBWriter_create_r( handle
);
993 GEOSWKBWriter_destroy(WKBWriter
*Writer
)
995 GEOSWKBWriter_destroy_r( handle
, Writer
);
999 /* The caller owns the result */
1001 GEOSWKBWriter_write(WKBWriter
*writer
, const Geometry
*geom
, size_t *size
)
1003 return GEOSWKBWriter_write_r( handle
, writer
, geom
, size
);
1006 /* The caller owns the result */
1008 GEOSWKBWriter_writeHEX(WKBWriter
*writer
, const Geometry
*geom
, size_t *size
)
1010 return GEOSWKBWriter_writeHEX_r( handle
, writer
, geom
, size
);
1014 GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter
* writer
)
1016 return GEOSWKBWriter_getOutputDimension_r( handle
, writer
);
1020 GEOSWKBWriter_setOutputDimension(GEOSWKBWriter
* writer
, int newDimension
)
1022 GEOSWKBWriter_setOutputDimension_r( handle
, writer
, newDimension
);
1026 GEOSWKBWriter_getByteOrder(const GEOSWKBWriter
* writer
)
1028 return GEOSWKBWriter_getByteOrder_r( handle
, writer
);
1032 GEOSWKBWriter_setByteOrder(GEOSWKBWriter
* writer
, int newByteOrder
)
1034 GEOSWKBWriter_setByteOrder_r( handle
, writer
, newByteOrder
);
1038 GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter
* writer
)
1040 return GEOSWKBWriter_getIncludeSRID_r( handle
, writer
);
1044 GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter
* writer
, const char newIncludeSRID
)
1046 GEOSWKBWriter_setIncludeSRID_r( handle
, writer
, newIncludeSRID
);
1050 //-----------------------------------------------------------------
1051 // Prepared Geometry
1052 //-----------------------------------------------------------------
1054 const geos::geom::prep::PreparedGeometry
*
1055 GEOSPrepare(const Geometry
*g
)
1057 return GEOSPrepare_r( handle
, g
);
1061 GEOSPreparedGeom_destroy(const geos::geom::prep::PreparedGeometry
*a
)
1063 GEOSPreparedGeom_destroy_r( handle
, a
);
1067 GEOSPreparedContains(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1069 return GEOSPreparedContains_r( handle
, pg1
, g2
);
1073 GEOSPreparedContainsProperly(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1075 return GEOSPreparedContainsProperly_r( handle
, pg1
, g2
);
1079 GEOSPreparedCoveredBy(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1081 return GEOSPreparedCoveredBy_r( handle
, pg1
, g2
);
1085 GEOSPreparedCovers(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1087 return GEOSPreparedCovers_r( handle
, pg1
, g2
);
1091 GEOSPreparedCrosses(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1093 return GEOSPreparedCrosses_r( handle
, pg1
, g2
);
1097 GEOSPreparedDisjoint(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1099 return GEOSPreparedDisjoint_r( handle
, pg1
, g2
);
1103 GEOSPreparedIntersects(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1105 return GEOSPreparedIntersects_r( handle
, pg1
, g2
);
1109 GEOSPreparedOverlaps(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1111 return GEOSPreparedOverlaps_r( handle
, pg1
, g2
);
1115 GEOSPreparedTouches(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1117 return GEOSPreparedTouches_r( handle
, pg1
, g2
);
1121 GEOSPreparedWithin(const geos::geom::prep::PreparedGeometry
*pg1
, const Geometry
*g2
)
1123 return GEOSPreparedWithin_r( handle
, pg1
, g2
);
1127 GEOSSTRtree_create (size_t nodeCapacity
)
1129 return GEOSSTRtree_create_r( handle
, nodeCapacity
);
1133 GEOSSTRtree_insert (geos::index::strtree::STRtree
*tree
,
1134 const geos::geom::Geometry
*g
,
1137 GEOSSTRtree_insert_r( handle
, tree
, g
, item
);
1141 GEOSSTRtree_query (geos::index::strtree::STRtree
*tree
,
1142 const geos::geom::Geometry
*g
,
1143 GEOSQueryCallback cb
,
1146 GEOSSTRtree_query_r( handle
, tree
, g
, cb
, userdata
);
1150 GEOSSTRtree_iterate(geos::index::strtree::STRtree
*tree
,
1151 GEOSQueryCallback callback
,
1154 GEOSSTRtree_iterate_r( handle
, tree
, callback
, userdata
);
1158 GEOSSTRtree_remove (geos::index::strtree::STRtree
*tree
,
1159 const geos::geom::Geometry
*g
,
1162 return GEOSSTRtree_remove_r( handle
, tree
, g
, item
);
1166 GEOSSTRtree_destroy (geos::index::strtree::STRtree
*tree
)
1168 GEOSSTRtree_destroy_r( handle
, tree
);
1172 GEOSProject (const geos::geom::Geometry
*g
,
1173 const geos::geom::Geometry
*p
)
1175 return GEOSProject_r (handle
, g
, p
);
1178 geos::geom::Geometry
*
1179 GEOSInterpolate (const geos::geom::Geometry
*g
,
1182 return GEOSInterpolate_r(handle
, g
, d
);
1186 GEOSProjectNormalized (const geos::geom::Geometry
*g
,
1187 const geos::geom::Geometry
*p
)
1189 return GEOSProjectNormalized_r (handle
, g
, p
);
1192 geos::geom::Geometry
*
1193 GEOSInterpolateNormalized (const geos::geom::Geometry
*g
,
1196 return GEOSInterpolateNormalized_r(handle
, g
, d
);
1199 geos::geom::Geometry
*
1200 GEOSGeom_extractUniquePoints (const geos::geom::Geometry
*g
)
1202 return GEOSGeom_extractUniquePoints_r(handle
, g
);
1205 geos::geom::Geometry
*
1206 GEOSGeom_createEmptyCollection(int type
)
1208 return GEOSGeom_createEmptyCollection_r(handle
, type
);
1211 geos::geom::Geometry
*
1212 GEOSGeom_createEmptyPoint()
1214 return GEOSGeom_createEmptyPoint_r(handle
);
1217 geos::geom::Geometry
*
1218 GEOSGeom_createEmptyLineString()
1220 return GEOSGeom_createEmptyLineString_r(handle
);
1223 geos::geom::Geometry
*
1224 GEOSGeom_createEmptyPolygon()
1226 return GEOSGeom_createEmptyPolygon_r(handle
);
1230 GEOSOrientationIndex(double Ax
, double Ay
, double Bx
, double By
,
1231 double Px
, double Py
)
1233 return GEOSOrientationIndex_r(handle
, Ax
, Ay
, Bx
, By
, Px
, Py
);
1237 GEOSSharedPaths(const GEOSGeometry
* g1
, const GEOSGeometry
* g2
)
1239 return GEOSSharedPaths_r(handle
, g1
, g2
);
1243 GEOSSnap(const GEOSGeometry
* g1
, const GEOSGeometry
* g2
, double tolerance
)
1245 return GEOSSnap_r(handle
, g1
, g2
, tolerance
);
1249 GEOSBufferParams_create()
1251 return GEOSBufferParams_create_r(handle
);
1255 GEOSBufferParams_destroy(GEOSBufferParams
* p
)
1257 return GEOSBufferParams_destroy_r(handle
, p
);
1261 GEOSBufferParams_setEndCapStyle(GEOSBufferParams
* p
, int style
)
1263 return GEOSBufferParams_setEndCapStyle_r(handle
, p
, style
);
1267 GEOSBufferParams_setJoinStyle(GEOSBufferParams
* p
, int joinStyle
)
1269 return GEOSBufferParams_setJoinStyle_r(handle
, p
, joinStyle
);
1273 GEOSBufferParams_setMitreLimit(GEOSBufferParams
* p
, double l
)
1275 return GEOSBufferParams_setMitreLimit_r(handle
, p
, l
);
1279 GEOSBufferParams_setQuadrantSegments(GEOSBufferParams
* p
, int joinStyle
)
1281 return GEOSBufferParams_setQuadrantSegments_r(handle
, p
, joinStyle
);
1285 GEOSBufferParams_setSingleSided(GEOSBufferParams
* p
, int singleSided
)
1287 return GEOSBufferParams_setSingleSided_r(handle
, p
, singleSided
);
1291 GEOSBufferWithParams(const Geometry
* g
, const GEOSBufferParams
* p
, double w
)
1293 return GEOSBufferWithParams_r(handle
, g
, p
, w
);
1297 GEOSDelaunayTriangulation(const Geometry
*g
, double tolerance
, int onlyEdges
)
1299 return GEOSDelaunayTriangulation_r(handle
, g
, tolerance
, onlyEdges
);
1303 GEOSVoronoiDiagram(const Geometry
*g
, const Geometry
*env
, double tolerance
, int onlyEdges
)
1305 return GEOSVoronoiDiagram_r(handle
, g
, env
, tolerance
, onlyEdges
);