ChangeLog updated for 3.3.4
[geos.git] / capi / geos_c.cpp
blob5f12ae9d21e53ed2b57bbb977e8677d2ca0982f6
1 /************************************************************************
3 * $Id$
5 * C-Wrapper for GEOS library
7 * Copyright (C) 2010 2011 Sandro Santilli <strk@keybit.net>
8 * Copyright (C) 2005-2006 Refractions Research Inc.
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
15 * Author: Sandro Santilli <strk@refractions.net>
17 ***********************************************************************/
19 #include <geos/geom/prep/PreparedGeometryFactory.h>
20 #include <geos/index/strtree/STRtree.h>
21 #include <geos/io/WKTReader.h>
22 #include <geos/io/WKBReader.h>
23 #include <geos/io/WKTWriter.h>
24 #include <geos/io/WKBWriter.h>
25 #include <geos/io/CLocalizer.h>
26 #include <geos/operation/overlay/OverlayOp.h>
27 #include <geos/operation/union/CascadedPolygonUnion.h>
28 #include <geos/algorithm/distance/DiscreteHausdorffDistance.h>
30 #ifdef _MSC_VER
31 #pragma warning(disable : 4099)
32 #endif
34 // Some extra magic to make type declarations in geos_c.h work - for cross-checking of types in header.
35 #define GEOSGeometry geos::geom::Geometry
36 #define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry
37 #define GEOSCoordSequence geos::geom::CoordinateSequence
38 #define GEOSSTRtree geos::index::strtree::STRtree
39 #define GEOSWKTReader_t geos::io::WKTReader
40 #define GEOSWKTWriter_t geos::io::WKTWriter
41 #define GEOSWKBReader_t geos::io::WKBReader
42 #define GEOSWKBWriter_t geos::io::WKBWriter
43 typedef struct GEOSBufParams_t GEOSBufferParams;
45 #include "geos_c.h"
47 /// Define this if you want operations triggering Exceptions to
48 /// be printed (will use the NOTIFY channel - only implemented for GEOSUnion so far)
49 ///
50 #undef VERBOSE_EXCEPTIONS
52 #include <geos/export.h>
55 #if defined(_MSC_VER)
56 # define GEOS_DLL __declspec(dllexport)
57 #else
58 # define GEOS_DLL
59 #endif
62 // import the most frequently used definitions globally
63 using geos::geom::Geometry;
64 using geos::geom::LineString;
65 using geos::geom::Polygon;
66 using geos::geom::CoordinateSequence;
67 using geos::geom::GeometryFactory;
69 using geos::io::WKTReader;
70 using geos::io::WKTWriter;
71 using geos::io::WKBReader;
72 using geos::io::WKBWriter;
73 using geos::io::CLocalizer;
75 using geos::index::strtree::STRtree;
77 using geos::operation::overlay::OverlayOp;
78 using geos::operation::overlay::overlayOp;
79 using geos::operation::geounion::CascadedPolygonUnion;
81 typedef std::auto_ptr<Geometry> GeomAutoPtr;
83 //## GLOBALS ################################################
85 // NOTE: SRID will have to be changed after geometry creation
86 GEOSContextHandle_t handle = NULL;
88 extern "C" {
90 void
91 initGEOS (GEOSMessageHandler nf, GEOSMessageHandler ef)
93 if ( ! handle )
95 handle = initGEOS_r( nf, ef );
97 else
99 GEOSContext_setNoticeHandler_r(handle, nf);
100 GEOSContext_setErrorHandler_r(handle, ef);
104 void
105 finishGEOS ()
107 if (handle != NULL) {
108 finishGEOS_r( handle );
109 handle = NULL;
113 void
114 GEOSFree (void* buffer)
116 GEOSFree_r( handle, buffer );
119 /****************************************************************
120 ** relate()-related functions
121 ** return 0 = false, 1 = true, 2 = error occured
124 char
125 GEOSDisjoint(const Geometry *g1, const Geometry *g2)
127 return GEOSDisjoint_r( handle, g1, g2 );
130 char
131 GEOSTouches(const Geometry *g1, const Geometry *g2)
133 return GEOSTouches_r( handle, g1, g2 );
136 char
137 GEOSIntersects(const Geometry *g1, const Geometry *g2)
139 return GEOSIntersects_r( handle, g1, g2 );
142 char
143 GEOSCrosses(const Geometry *g1, const Geometry *g2)
145 return GEOSCrosses_r( handle, g1, g2 );
148 char
149 GEOSWithin(const Geometry *g1, const Geometry *g2)
151 return GEOSWithin_r( handle, g1, g2 );
154 // call g1->contains(g2)
155 // returns 0 = false
156 // 1 = true
157 // 2 = error was trapped
158 char
159 GEOSContains(const Geometry *g1, const Geometry *g2)
161 return GEOSContains_r( handle, g1, g2 );
164 char
165 GEOSOverlaps(const Geometry *g1, const Geometry *g2)
167 return GEOSOverlaps_r( handle, g1, g2 );
170 char
171 GEOSCovers(const Geometry *g1, const Geometry *g2)
173 return GEOSCovers_r( handle, g1, g2 );
176 char
177 GEOSCoveredBy(const Geometry *g1, const Geometry *g2)
179 return GEOSCoveredBy_r( handle, g1, g2 );
183 //-------------------------------------------------------------------
184 // low-level relate functions
185 //------------------------------------------------------------------
187 char
188 GEOSRelatePattern(const Geometry *g1, const Geometry *g2, const char *pat)
190 return GEOSRelatePattern_r( handle, g1, g2, pat );
193 char
194 GEOSRelatePatternMatch(const char *mat, const char *pat)
196 return GEOSRelatePatternMatch_r( handle, mat, pat );
199 char *
200 GEOSRelate(const Geometry *g1, const Geometry *g2)
202 return GEOSRelate_r( handle, g1, g2 );
205 char *
206 GEOSRelateBoundaryNodeRule(const Geometry *g1, const Geometry *g2, int bnr)
208 return GEOSRelateBoundaryNodeRule_r( handle, g1, g2, bnr );
212 //-----------------------------------------------------------------
213 // isValid
214 //-----------------------------------------------------------------
217 char
218 GEOSisValid(const Geometry *g1)
220 return GEOSisValid_r( handle, g1 );
223 char *
224 GEOSisValidReason(const Geometry *g1)
226 return GEOSisValidReason_r( handle, g1 );
229 char
230 GEOSisValidDetail(const Geometry *g, int flags,
231 char** reason, Geometry ** location)
233 return GEOSisValidDetail_r( handle, g, flags, reason, location );
236 //-----------------------------------------------------------------
237 // general purpose
238 //-----------------------------------------------------------------
240 char
241 GEOSEquals(const Geometry *g1, const Geometry *g2)
243 return GEOSEquals_r( handle, g1, g2 );
246 char
247 GEOSEqualsExact(const Geometry *g1, const Geometry *g2, double tolerance)
249 return GEOSEqualsExact_r( handle, g1, g2, tolerance );
253 GEOSDistance(const Geometry *g1, const Geometry *g2, double *dist)
255 return GEOSDistance_r( handle, g1, g2, dist );
259 GEOSHausdorffDistance(const Geometry *g1, const Geometry *g2, double *dist)
261 return GEOSHausdorffDistance_r( handle, g1, g2, dist );
265 GEOSHausdorffDistanceDensify(const Geometry *g1, const Geometry *g2, double densifyFrac, double *dist)
267 return GEOSHausdorffDistanceDensify_r( handle, g1, g2, densifyFrac, dist );
271 GEOSArea(const Geometry *g, double *area)
273 return GEOSArea_r( handle, g, area );
277 GEOSLength(const Geometry *g, double *length)
279 return GEOSLength_r( handle, g, length );
282 Geometry *
283 GEOSGeomFromWKT(const char *wkt)
285 return GEOSGeomFromWKT_r( handle, wkt );
288 char *
289 GEOSGeomToWKT(const Geometry *g1)
291 return GEOSGeomToWKT_r( handle, g1 );
294 // Remember to free the result!
295 unsigned char *
296 GEOSGeomToWKB_buf(const Geometry *g, size_t *size)
298 return GEOSGeomToWKB_buf_r( handle, g, size );
301 Geometry *
302 GEOSGeomFromWKB_buf(const unsigned char *wkb, size_t size)
304 return GEOSGeomFromWKB_buf_r( handle, wkb, size );
307 /* Read/write wkb hex values. Returned geometries are
308 owned by the caller.*/
309 unsigned char *
310 GEOSGeomToHEX_buf(const Geometry *g, size_t *size)
312 return GEOSGeomToHEX_buf_r( handle, g, size );
315 Geometry *
316 GEOSGeomFromHEX_buf(const unsigned char *hex, size_t size)
318 return GEOSGeomFromHEX_buf_r( handle, hex, size );
321 char
322 GEOSisEmpty(const Geometry *g1)
324 return GEOSisEmpty_r( handle, g1 );
327 char
328 GEOSisSimple(const Geometry *g1)
330 return GEOSisSimple_r( handle, g1 );
333 char
334 GEOSisRing(const Geometry *g)
336 return GEOSisRing_r( handle, g );
341 //free the result of this
342 char *
343 GEOSGeomType(const Geometry *g1)
345 return GEOSGeomType_r( handle, g1 );
348 // Return postgis geometry type index
350 GEOSGeomTypeId(const Geometry *g1)
352 return GEOSGeomTypeId_r( handle, g1 );
358 //-------------------------------------------------------------------
359 // GEOS functions that return geometries
360 //-------------------------------------------------------------------
362 Geometry *
363 GEOSEnvelope(const Geometry *g1)
365 return GEOSEnvelope_r( handle, g1 );
368 Geometry *
369 GEOSIntersection(const Geometry *g1, const Geometry *g2)
371 return GEOSIntersection_r( handle, g1, g2 );
374 Geometry *
375 GEOSBuffer(const Geometry *g1, double width, int quadrantsegments)
377 return GEOSBuffer_r( handle, g1, width, quadrantsegments );
380 Geometry *
381 GEOSBufferWithStyle(const Geometry *g1, double width, int quadsegs,
382 int endCapStyle, int joinStyle, double mitreLimit)
384 return GEOSBufferWithStyle_r( handle, g1, width, quadsegs, endCapStyle,
385 joinStyle, mitreLimit );
388 Geometry *
389 GEOSSingleSidedBuffer(const Geometry *g1, double width, int quadsegs,
390 int joinStyle, double mitreLimit, int leftSide)
392 return GEOSSingleSidedBuffer_r( handle, g1, width, quadsegs,
393 joinStyle, mitreLimit, leftSide );
396 Geometry *
397 GEOSOffsetCurve(const Geometry *g1, double width, int quadsegs,
398 int joinStyle, double mitreLimit)
400 return GEOSOffsetCurve_r( handle, g1, width, quadsegs,
401 joinStyle, mitreLimit );
404 Geometry *
405 GEOSConvexHull(const Geometry *g1)
407 return GEOSConvexHull_r( handle, g1 );
410 Geometry *
411 GEOSDifference(const Geometry *g1, const Geometry *g2)
413 return GEOSDifference_r( handle, g1, g2 );
416 Geometry *
417 GEOSBoundary(const Geometry *g1)
419 return GEOSBoundary_r( handle, g1 );
422 Geometry *
423 GEOSSymDifference(const Geometry *g1, const Geometry *g2)
425 return GEOSSymDifference_r( handle, g1, g2 );
428 Geometry *
429 GEOSUnion(const Geometry *g1, const Geometry *g2)
431 return GEOSUnion_r( handle, g1, g2 );
434 Geometry *
435 GEOSUnaryUnion(const Geometry *g1)
437 return GEOSUnaryUnion_r( handle, g1);
440 Geometry *
441 GEOSUnionCascaded(const Geometry *g1)
443 return GEOSUnionCascaded_r( handle, g1 );
446 Geometry *
447 GEOSPointOnSurface(const Geometry *g1)
449 return GEOSPointOnSurface_r( handle, g1 );
456 //-------------------------------------------------------------------
457 // memory management functions
458 //------------------------------------------------------------------
461 void
462 GEOSGeom_destroy(Geometry *a)
464 return GEOSGeom_destroy_r( handle, a );
469 GEOSGetNumCoordinates(const Geometry *g1)
471 return GEOSGetNumCoordinates_r( handle, g1 );
475 * Return -1 on exception, 0 otherwise.
476 * Converts Geometry to normal form (or canonical form).
479 GEOSNormalize(Geometry *g1)
481 return GEOSNormalize_r( handle, g1 );
485 GEOSGetNumInteriorRings(const Geometry *g1)
487 return GEOSGetNumInteriorRings_r( handle, g1 );
491 // returns -1 on error and 1 for non-multi geometries
493 GEOSGetNumGeometries(const Geometry *g1)
495 return GEOSGetNumGeometries_r( handle, g1 );
500 * Call only on GEOMETRYCOLLECTION or MULTI*.
501 * Return a pointer to the internal Geometry.
503 const Geometry *
504 GEOSGetGeometryN(const Geometry *g1, int n)
506 return GEOSGetGeometryN_r( handle, g1, n );
510 * Call only on LINESTRING
511 * Returns NULL on exception
513 Geometry *
514 GEOSGeomGetPointN(const Geometry *g1, int n)
516 return GEOSGeomGetPointN_r(handle, g1, n);
520 * Call only on LINESTRING
522 Geometry *
523 GEOSGeomGetStartPoint(const Geometry *g1)
525 return GEOSGeomGetStartPoint_r(handle, g1);
529 * Call only on LINESTRING
531 Geometry *
532 GEOSGeomGetEndPoint(const Geometry *g1)
534 return GEOSGeomGetEndPoint_r(handle, g1);
538 * Call only on LINESTRING
539 * return 2 on exception, 1 on true, 0 on false
541 char
542 GEOSisClosed(const Geometry *g1)
544 return GEOSisClosed_r(handle, g1);
548 * Call only on LINESTRING
549 * returns 0 on exception, otherwise 1
552 GEOSGeomGetLength(const Geometry *g1, double *length)
554 return GEOSGeomGetLength_r(handle, g1, length);
558 * Call only on LINESTRING
559 * returns -1 on exception
562 GEOSGeomGetNumPoints(const Geometry *g1)
564 return GEOSGeomGetNumPoints_r(handle, g1);
568 * For POINT
569 * returns 0 on exception, otherwise 1
572 GEOSGeomGetX(const Geometry *g1, double *x)
574 return GEOSGeomGetX_r(handle, g1, x);
578 * For POINT
579 * returns 0 on exception, otherwise 1
582 GEOSGeomGetY(const Geometry *g1, double *y)
584 return GEOSGeomGetY_r(handle, g1, y);
588 * Call only on polygon
589 * Return a copy of the internal Geometry.
591 const Geometry *
592 GEOSGetExteriorRing(const Geometry *g1)
594 return GEOSGetExteriorRing_r( handle, g1 );
598 * Call only on polygon
599 * Return a pointer to internal storage, do not destroy it.
601 const Geometry *
602 GEOSGetInteriorRingN(const Geometry *g1, int n)
604 return GEOSGetInteriorRingN_r( handle, g1, n );
607 Geometry *
608 GEOSGetCentroid(const Geometry *g)
610 return GEOSGetCentroid_r( handle, g );
613 Geometry *
614 GEOSGeom_createCollection(int type, Geometry **geoms, unsigned int ngeoms)
616 return GEOSGeom_createCollection_r( handle, type, geoms, ngeoms );
619 Geometry *
620 GEOSPolygonize(const Geometry * const * g, unsigned int ngeoms)
622 return GEOSPolygonize_r( handle, g, ngeoms );
625 Geometry *
626 GEOSPolygonizer_getCutEdges(const Geometry * const * g, unsigned int ngeoms)
628 return GEOSPolygonizer_getCutEdges_r( handle, g, ngeoms );
631 GEOSGeometry *
632 GEOSPolygonize_full(const GEOSGeometry* input,
633 GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid)
635 return GEOSPolygonize_full_r(handle, input, cuts, dangles, invalid );
638 Geometry *
639 GEOSLineMerge(const Geometry *g)
641 return GEOSLineMerge_r( handle, g );
645 GEOSGetSRID(const Geometry *g)
647 return GEOSGetSRID_r( handle, g );
650 void
651 GEOSSetSRID(Geometry *g, int srid)
653 return GEOSSetSRID_r( handle, g, srid );
656 char
657 GEOSHasZ(const Geometry *g)
659 return GEOSHasZ_r( handle, g );
663 GEOS_getWKBOutputDims()
665 return GEOS_getWKBOutputDims_r( handle );
669 GEOS_setWKBOutputDims(int newdims)
671 return GEOS_setWKBOutputDims_r( handle, newdims );
675 GEOS_getWKBByteOrder()
677 return GEOS_getWKBByteOrder_r( handle );
681 GEOS_setWKBByteOrder(int byteOrder)
683 return GEOS_setWKBByteOrder_r( handle, byteOrder );
687 CoordinateSequence *
688 GEOSCoordSeq_create(unsigned int size, unsigned int dims)
690 return GEOSCoordSeq_create_r( handle, size, dims );
694 GEOSCoordSeq_setOrdinate(CoordinateSequence *s, unsigned int idx, unsigned int dim, double val)
696 return GEOSCoordSeq_setOrdinate_r( handle, s, idx, dim, val );
700 GEOSCoordSeq_setX(CoordinateSequence *s, unsigned int idx, double val)
702 return GEOSCoordSeq_setOrdinate(s, idx, 0, val);
706 GEOSCoordSeq_setY(CoordinateSequence *s, unsigned int idx, double val)
708 return GEOSCoordSeq_setOrdinate(s, idx, 1, val);
712 GEOSCoordSeq_setZ(CoordinateSequence *s, unsigned int idx, double val)
714 return GEOSCoordSeq_setOrdinate(s, idx, 2, val);
717 CoordinateSequence *
718 GEOSCoordSeq_clone(const CoordinateSequence *s)
720 return GEOSCoordSeq_clone_r( handle, s );
724 GEOSCoordSeq_getOrdinate(const CoordinateSequence *s, unsigned int idx, unsigned int dim, double *val)
726 return GEOSCoordSeq_getOrdinate_r( handle, s, idx, dim, val );
730 GEOSCoordSeq_getX(const CoordinateSequence *s, unsigned int idx, double *val)
732 return GEOSCoordSeq_getOrdinate(s, idx, 0, val);
736 GEOSCoordSeq_getY(const CoordinateSequence *s, unsigned int idx, double *val)
738 return GEOSCoordSeq_getOrdinate(s, idx, 1, val);
742 GEOSCoordSeq_getZ(const CoordinateSequence *s, unsigned int idx, double *val)
744 return GEOSCoordSeq_getOrdinate(s, idx, 2, val);
748 GEOSCoordSeq_getSize(const CoordinateSequence *s, unsigned int *size)
750 return GEOSCoordSeq_getSize_r( handle, s, size );
754 GEOSCoordSeq_getDimensions(const CoordinateSequence *s, unsigned int *dims)
756 return GEOSCoordSeq_getDimensions_r( handle, s, dims );
759 void
760 GEOSCoordSeq_destroy(CoordinateSequence *s)
762 return GEOSCoordSeq_destroy_r( handle, s );
765 const CoordinateSequence *
766 GEOSGeom_getCoordSeq(const Geometry *g)
768 return GEOSGeom_getCoordSeq_r( handle, g );
771 Geometry *
772 GEOSGeom_createPoint(CoordinateSequence *cs)
774 return GEOSGeom_createPoint_r( handle, cs );
777 Geometry *
778 GEOSGeom_createLinearRing(CoordinateSequence *cs)
780 return GEOSGeom_createLinearRing_r( handle, cs );
783 Geometry *
784 GEOSGeom_createLineString(CoordinateSequence *cs)
786 return GEOSGeom_createLineString_r( handle, cs );
789 Geometry *
790 GEOSGeom_createPolygon(Geometry *shell, Geometry **holes, unsigned int nholes)
792 return GEOSGeom_createPolygon_r( handle, shell, holes, nholes );
795 Geometry *
796 GEOSGeom_clone(const Geometry *g)
798 return GEOSGeom_clone_r( handle, g );
802 GEOSGeom_getDimensions(const Geometry *g)
804 return GEOSGeom_getDimensions_r( handle, g );
808 GEOSGeom_getCoordinateDimension(const Geometry *g)
810 return GEOSGeom_getCoordinateDimension_r( handle, g );
813 Geometry *
814 GEOSSimplify(const Geometry *g1, double tolerance)
816 return GEOSSimplify_r( handle, g1, tolerance );
819 Geometry *
820 GEOSTopologyPreserveSimplify(const Geometry *g1, double tolerance)
822 return GEOSTopologyPreserveSimplify_r( handle, g1, tolerance );
826 /* WKT Reader */
827 WKTReader *
828 GEOSWKTReader_create()
830 return GEOSWKTReader_create_r( handle );
833 void
834 GEOSWKTReader_destroy(WKTReader *reader)
836 GEOSWKTReader_destroy_r( handle, reader );
840 Geometry*
841 GEOSWKTReader_read(WKTReader *reader, const char *wkt)
843 return GEOSWKTReader_read_r( handle, reader, wkt );
846 /* WKT Writer */
847 WKTWriter *
848 GEOSWKTWriter_create()
850 return GEOSWKTWriter_create_r( handle );
853 void
854 GEOSWKTWriter_destroy(WKTWriter *Writer)
856 GEOSWKTWriter_destroy_r( handle, Writer );
859 char*
860 GEOSWKTWriter_write(WKTWriter *writer, const Geometry *geom)
862 return GEOSWKTWriter_write_r( handle, writer, geom );
865 void
866 GEOSWKTWriter_setTrim(WKTWriter *writer, char trim)
868 GEOSWKTWriter_setTrim_r(handle, writer, trim);
871 void
872 GEOSWKTWriter_setRoundingPrecision(WKTWriter *writer, int precision)
874 return GEOSWKTWriter_setRoundingPrecision_r(handle, writer, precision);
877 void
878 GEOSWKTWriter_setOutputDimension(WKTWriter *writer, int dim)
880 GEOSWKTWriter_setOutputDimension_r(handle, writer, dim);
884 GEOSWKTWriter_getOutputDimension(WKTWriter *writer)
886 return GEOSWKTWriter_getOutputDimension_r(handle, writer);
889 void
890 GEOSWKTWriter_setOld3D(WKTWriter *writer, int useOld3D)
892 GEOSWKTWriter_setOld3D_r(handle, writer, useOld3D);
895 /* WKB Reader */
896 WKBReader *
897 GEOSWKBReader_create()
899 return GEOSWKBReader_create_r( handle );
902 void
903 GEOSWKBReader_destroy(WKBReader *reader)
905 GEOSWKBReader_destroy_r( handle, reader );
909 Geometry*
910 GEOSWKBReader_read(WKBReader *reader, const unsigned char *wkb, size_t size)
912 return GEOSWKBReader_read_r( handle, reader, wkb, size );
915 Geometry*
916 GEOSWKBReader_readHEX(WKBReader *reader, const unsigned char *hex, size_t size)
918 return GEOSWKBReader_readHEX_r( handle, reader, hex, size );
921 /* WKB Writer */
922 WKBWriter *
923 GEOSWKBWriter_create()
925 return GEOSWKBWriter_create_r( handle );
928 void
929 GEOSWKBWriter_destroy(WKBWriter *Writer)
931 GEOSWKBWriter_destroy_r( handle, Writer );
935 /* The caller owns the result */
936 unsigned char*
937 GEOSWKBWriter_write(WKBWriter *writer, const Geometry *geom, size_t *size)
939 return GEOSWKBWriter_write_r( handle, writer, geom, size );
942 /* The caller owns the result */
943 unsigned char*
944 GEOSWKBWriter_writeHEX(WKBWriter *writer, const Geometry *geom, size_t *size)
946 return GEOSWKBWriter_writeHEX_r( handle, writer, geom, size );
950 GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer)
952 return GEOSWKBWriter_getOutputDimension_r( handle, writer );
955 void
956 GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension)
958 GEOSWKBWriter_setOutputDimension_r( handle, writer, newDimension );
962 GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer)
964 return GEOSWKBWriter_getByteOrder_r( handle, writer );
967 void
968 GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int newByteOrder)
970 GEOSWKBWriter_setByteOrder_r( handle, writer, newByteOrder );
973 char
974 GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer)
976 return GEOSWKBWriter_getIncludeSRID_r( handle, writer );
979 void
980 GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char newIncludeSRID)
982 GEOSWKBWriter_setIncludeSRID_r( handle, writer, newIncludeSRID );
986 //-----------------------------------------------------------------
987 // Prepared Geometry
988 //-----------------------------------------------------------------
990 const geos::geom::prep::PreparedGeometry*
991 GEOSPrepare(const Geometry *g)
993 return GEOSPrepare_r( handle, g );
996 void
997 GEOSPreparedGeom_destroy(const geos::geom::prep::PreparedGeometry *a)
999 GEOSPreparedGeom_destroy_r( handle, a );
1002 char
1003 GEOSPreparedContains(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1005 return GEOSPreparedContains_r( handle, pg1, g2 );
1008 char
1009 GEOSPreparedContainsProperly(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1011 return GEOSPreparedContainsProperly_r( handle, pg1, g2 );
1014 char
1015 GEOSPreparedCoveredBy(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1017 return GEOSPreparedCoveredBy_r( handle, pg1, g2 );
1020 char
1021 GEOSPreparedCovers(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1023 return GEOSPreparedCovers_r( handle, pg1, g2 );
1026 char
1027 GEOSPreparedCrosses(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1029 return GEOSPreparedCrosses_r( handle, pg1, g2 );
1032 char
1033 GEOSPreparedDisjoint(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1035 return GEOSPreparedDisjoint_r( handle, pg1, g2 );
1038 char
1039 GEOSPreparedIntersects(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1041 return GEOSPreparedIntersects_r( handle, pg1, g2 );
1044 char
1045 GEOSPreparedOverlaps(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1047 return GEOSPreparedOverlaps_r( handle, pg1, g2 );
1050 char
1051 GEOSPreparedTouches(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1053 return GEOSPreparedTouches_r( handle, pg1, g2 );
1056 char
1057 GEOSPreparedWithin(const geos::geom::prep::PreparedGeometry *pg1, const Geometry *g2)
1059 return GEOSPreparedWithin_r( handle, pg1, g2 );
1062 STRtree *
1063 GEOSSTRtree_create (size_t nodeCapacity)
1065 return GEOSSTRtree_create_r( handle, nodeCapacity );
1068 void
1069 GEOSSTRtree_insert (geos::index::strtree::STRtree *tree,
1070 const geos::geom::Geometry *g,
1071 void *item)
1073 GEOSSTRtree_insert_r( handle, tree, g, item );
1076 void
1077 GEOSSTRtree_query (geos::index::strtree::STRtree *tree,
1078 const geos::geom::Geometry *g,
1079 GEOSQueryCallback cb,
1080 void *userdata)
1082 GEOSSTRtree_query_r( handle, tree, g, cb, userdata );
1085 void
1086 GEOSSTRtree_iterate(geos::index::strtree::STRtree *tree,
1087 GEOSQueryCallback callback,
1088 void *userdata)
1090 GEOSSTRtree_iterate_r( handle, tree, callback, userdata );
1093 char
1094 GEOSSTRtree_remove (geos::index::strtree::STRtree *tree,
1095 const geos::geom::Geometry *g,
1096 void *item)
1098 return GEOSSTRtree_remove_r( handle, tree, g, item );
1101 void
1102 GEOSSTRtree_destroy (geos::index::strtree::STRtree *tree)
1104 GEOSSTRtree_destroy_r( handle, tree );
1107 double
1108 GEOSProject (const geos::geom::Geometry *g,
1109 const geos::geom::Geometry *p)
1111 return GEOSProject_r (handle, g, p);
1114 geos::geom::Geometry *
1115 GEOSInterpolate (const geos::geom::Geometry *g,
1116 double d)
1118 return GEOSInterpolate_r(handle, g, d);
1121 double
1122 GEOSProjectNormalized (const geos::geom::Geometry *g,
1123 const geos::geom::Geometry *p)
1125 return GEOSProjectNormalized_r (handle, g, p);
1128 geos::geom::Geometry *
1129 GEOSInterpolateNormalized (const geos::geom::Geometry *g,
1130 double d)
1132 return GEOSInterpolateNormalized_r(handle, g, d);
1135 geos::geom::Geometry *
1136 GEOSGeom_extractUniquePoints (const geos::geom::Geometry *g)
1138 return GEOSGeom_extractUniquePoints_r(handle, g);
1141 geos::geom::Geometry *
1142 GEOSGeom_createEmptyCollection(int type)
1144 return GEOSGeom_createEmptyCollection_r(handle, type);
1147 geos::geom::Geometry *
1148 GEOSGeom_createEmptyPoint()
1150 return GEOSGeom_createEmptyPoint_r(handle);
1153 geos::geom::Geometry *
1154 GEOSGeom_createEmptyLineString()
1156 return GEOSGeom_createEmptyLineString_r(handle);
1159 geos::geom::Geometry *
1160 GEOSGeom_createEmptyPolygon()
1162 return GEOSGeom_createEmptyPolygon_r(handle);
1166 GEOSOrientationIndex(double Ax, double Ay, double Bx, double By,
1167 double Px, double Py)
1169 return GEOSOrientationIndex_r(handle, Ax, Ay, Bx, By, Px, Py);
1172 GEOSGeometry *
1173 GEOSSharedPaths(const GEOSGeometry* g1, const GEOSGeometry* g2)
1175 return GEOSSharedPaths_r(handle, g1, g2);
1178 GEOSGeometry *
1179 GEOSSnap(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance)
1181 return GEOSSnap_r(handle, g1, g2, tolerance);
1184 GEOSBufferParams*
1185 GEOSBufferParams_create()
1187 return GEOSBufferParams_create_r(handle);
1190 void
1191 GEOSBufferParams_destroy(GEOSBufferParams* p)
1193 return GEOSBufferParams_destroy_r(handle, p);
1197 GEOSBufferParams_setEndCapStyle(GEOSBufferParams* p, int style)
1199 return GEOSBufferParams_setEndCapStyle_r(handle, p, style);
1203 GEOSBufferParams_setJoinStyle(GEOSBufferParams* p, int joinStyle)
1205 return GEOSBufferParams_setJoinStyle_r(handle, p, joinStyle);
1209 GEOSBufferParams_setMitreLimit(GEOSBufferParams* p, double l)
1211 return GEOSBufferParams_setMitreLimit_r(handle, p, l);
1215 GEOSBufferParams_setQuadrantSegments(GEOSBufferParams* p, int joinStyle)
1217 return GEOSBufferParams_setQuadrantSegments_r(handle, p, joinStyle);
1221 GEOSBufferParams_setSingleSided(GEOSBufferParams* p, int singleSided)
1223 return GEOSBufferParams_setSingleSided_r(handle, p, singleSided);
1226 Geometry*
1227 GEOSBufferWithParams(const Geometry* g, const GEOSBufferParams* p, double w)
1229 return GEOSBufferWithParams_r(handle, g, p, w);
1232 } /* extern "C" */