GEOS  3.6.2
geos_c.h
00001 /************************************************************************
00002  *
00003  *
00004  * C-Wrapper for GEOS library
00005  *
00006  * Copyright (C) 2010 2011 Sandro Santilli <strk@keybit.net>
00007  * Copyright (C) 2005 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation.
00012  * See the COPYING file for more information.
00013  *
00014  * Author: Sandro Santilli <strk@keybit.net>
00015  *
00016  ***********************************************************************
00017  *
00018  * GENERAL NOTES:
00019  *
00020  *      - Remember to call initGEOS() before any use of this library's
00021  *        functions, and call finishGEOS() when done.
00022  *
00023  *      - Currently you have to explicitly GEOSGeom_destroy() all
00024  *        GEOSGeom objects to avoid memory leaks, and to GEOSFree()
00025  *        all returned char * (unless const).
00026  *
00027  *      - Functions ending with _r are thread safe; see details in RFC 3
00028  *        http://trac.osgeo.org/geos/wiki/RFC3.
00029  *        To avoid using by accident non _r functions,
00030  *        define GEOS_USE_ONLY_R_API before including geos_c.h
00031  *
00032  ***********************************************************************/
00033 
00034 #ifndef GEOS_C_H_INCLUDED
00035 #define GEOS_C_H_INCLUDED
00036 
00037 #ifndef __cplusplus
00038 # include <stddef.h> /* for size_t definition */
00039 #else
00040 # include <cstddef>
00041 using std::size_t;
00042 #endif
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00048 /************************************************************************
00049  *
00050  * Version
00051  *
00052  ***********************************************************************/
00053 
00054 /*
00055  * Following 'ifdef' hack fixes problem with generating geos_c.h on Windows,
00056  * when building with Visual C++ compiler.
00057  *
00058  */
00059 #if defined(_MSC_VER)
00060 #include <geos/version.h>
00061 #define GEOS_CAPI_VERSION_MAJOR 1
00062 #define GEOS_CAPI_VERSION_MINOR 10
00063 #define GEOS_CAPI_VERSION_PATCH 2
00064 #define GEOS_CAPI_VERSION "3.6.2-CAPI-1.10.2"
00065 #else
00066 #ifndef GEOS_VERSION_MAJOR
00067 #define GEOS_VERSION_MAJOR 3
00068 #endif
00069 #ifndef GEOS_VERSION_MINOR
00070 #define GEOS_VERSION_MINOR 6
00071 #endif
00072 #ifndef GEOS_VERSION_PATCH
00073 #define GEOS_VERSION_PATCH 2
00074 #endif
00075 #ifndef GEOS_VERSION
00076 #define GEOS_VERSION "3.6.2"
00077 #endif
00078 #ifndef GEOS_JTS_PORT
00079 #define GEOS_JTS_PORT "1.13.0"
00080 #endif
00081 
00082 #define GEOS_CAPI_VERSION_MAJOR 1
00083 #define GEOS_CAPI_VERSION_MINOR 10
00084 #define GEOS_CAPI_VERSION_PATCH 2
00085 #define GEOS_CAPI_VERSION "3.6.2-CAPI-1.10.2"
00086 #endif
00087 
00088 #define GEOS_CAPI_FIRST_INTERFACE GEOS_CAPI_VERSION_MAJOR
00089 #define GEOS_CAPI_LAST_INTERFACE (GEOS_CAPI_VERSION_MAJOR+GEOS_CAPI_VERSION_MINOR)
00090 
00091 /************************************************************************
00092  *
00093  * (Abstract) type definitions
00094  *
00095  ************************************************************************/
00096 
00097 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
00098 
00099 typedef void (*GEOSMessageHandler)(const char *fmt, ...);
00100 
00101 /*
00102  * A GEOS message handler function.
00103  *
00104  * @param message the message contents
00105  * @param userdata the user data pointer that was passed to GEOS when registering this message handler.
00106  *
00107  *
00108  * @see GEOSContext_setErrorMessageHandler
00109  * @see GEOSContext_setNoticeMessageHandler
00110  */
00111 typedef void (*GEOSMessageHandler_r)(const char *message, void *userdata);
00112 
00113 /* When we're included by geos_c.cpp, those are #defined to the original
00114  * JTS definitions via preprocessor. We don't touch them to allow the
00115  * compiler to cross-check the declarations. However, for all "normal"
00116  * C-API users, we need to define them as "opaque" struct pointers, as
00117  * those clients don't have access to the original C++ headers, by design.
00118  */
00119 #ifndef GEOSGeometry
00120 typedef struct GEOSGeom_t GEOSGeometry;
00121 typedef struct GEOSPrepGeom_t GEOSPreparedGeometry;
00122 typedef struct GEOSCoordSeq_t GEOSCoordSequence;
00123 typedef struct GEOSSTRtree_t GEOSSTRtree;
00124 typedef struct GEOSBufParams_t GEOSBufferParams;
00125 #endif
00126 
00127 /* Those are compatibility definitions for source compatibility
00128  * with GEOS 2.X clients relying on that type.
00129  */
00130 typedef GEOSGeometry* GEOSGeom;
00131 typedef GEOSCoordSequence* GEOSCoordSeq;
00132 
00133 /* Supported geometry types
00134  * This was renamed from GEOSGeomTypeId in GEOS 2.2.X, which might
00135  * break compatibility, this issue is still under investigation.
00136  */
00137 
00138 enum GEOSGeomTypes {
00139     GEOS_POINT,
00140     GEOS_LINESTRING,
00141     GEOS_LINEARRING,
00142     GEOS_POLYGON,
00143     GEOS_MULTIPOINT,
00144     GEOS_MULTILINESTRING,
00145     GEOS_MULTIPOLYGON,
00146     GEOS_GEOMETRYCOLLECTION
00147 };
00148 
00149 /* Byte oders exposed via the c api */
00150 enum GEOSByteOrders {
00151     GEOS_WKB_XDR = 0, /* Big Endian */
00152     GEOS_WKB_NDR = 1 /* Little Endian */
00153 };
00154 
00155 typedef void (*GEOSQueryCallback)(void *item, void *userdata);
00156 typedef int (*GEOSDistanceCallback)(const void *item1, const void* item2, double* distance, void* userdata);
00157 
00158 /************************************************************************
00159  *
00160  * Initialization, cleanup, version
00161  *
00162  ***********************************************************************/
00163 
00164 #include <geos/export.h>
00165 
00166 /*
00167  * Register an interruption checking callback
00168  *
00169  * The callback will be invoked _before_ checking for
00170  * interruption, so can be used to request it.
00171  */
00172 typedef void (GEOSInterruptCallback)();
00173 extern GEOSInterruptCallback GEOS_DLL *GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb);
00174 /* Request safe interruption of operations */
00175 extern void GEOS_DLL GEOS_interruptRequest();
00176 /* Cancel a pending interruption request */
00177 extern void GEOS_DLL GEOS_interruptCancel();
00178 
00179 /*
00180  * @deprecated in 3.5.0
00181  *     initialize using GEOS_init_r() and set the message handlers using
00182  *     GEOSContext_setNoticeHandler_r and/or GEOSContext_setErrorHandler_r
00183  */
00184 extern GEOSContextHandle_t GEOS_DLL initGEOS_r(
00185                                     GEOSMessageHandler notice_function,
00186                                     GEOSMessageHandler error_function);
00187 /*
00188  * @deprecated in 3.5.0 replaced by GEOS_finish_r.
00189  */
00190 extern void GEOS_DLL finishGEOS_r(GEOSContextHandle_t handle);
00191 
00192 extern GEOSContextHandle_t GEOS_DLL GEOS_init_r();
00193 extern void GEOS_DLL GEOS_finish_r(GEOSContextHandle_t handle);
00194 
00195 
00196 extern GEOSMessageHandler GEOS_DLL GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle,
00197                                                                   GEOSMessageHandler nf);
00198 extern GEOSMessageHandler GEOS_DLL GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle,
00199                                                                  GEOSMessageHandler ef);
00200 
00201 /*
00202  * Sets a notice message handler on the given GEOS context.
00203  *
00204  * @param extHandle the GEOS context
00205  * @param nf the message handler
00206  * @param userData optional user data pointer that will be passed to the message handler
00207  *
00208  * @return the previously configured message handler or NULL if no message handler was configured
00209  */
00210 extern GEOSMessageHandler_r GEOS_DLL GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t extHandle,
00211                                                                            GEOSMessageHandler_r nf,
00212                                                                            void *userData);
00213 
00214 /*
00215  * Sets an error message handler on the given GEOS context.
00216  *
00217  * @param extHandle the GEOS context
00218  * @param ef the message handler
00219  * @param userData optional user data pointer that will be passed to the message handler
00220  *
00221  * @return the previously configured message handler or NULL if no message handler was configured
00222  */
00223 extern GEOSMessageHandler_r GEOS_DLL GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t extHandle,
00224                                                                           GEOSMessageHandler_r ef,
00225                                                                           void *userData);
00226 
00227 extern const char GEOS_DLL *GEOSversion();
00228 
00229 
00230 /************************************************************************
00231  *
00232  * NOTE - These functions are DEPRECATED.  Please use the new Reader and
00233  * writer APIS!
00234  *
00235  ***********************************************************************/
00236 
00237 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT_r(GEOSContextHandle_t handle,
00238                                                 const char *wkt);
00239 extern char GEOS_DLL *GEOSGeomToWKT_r(GEOSContextHandle_t handle,
00240                                       const GEOSGeometry* g);
00241 
00242 /*
00243  * Specify whether output WKB should be 2d or 3d.
00244  * Return previously set number of dimensions.
00245  */
00246 
00247 extern int GEOS_DLL GEOS_getWKBOutputDims_r(GEOSContextHandle_t handle);
00248 extern int GEOS_DLL GEOS_setWKBOutputDims_r(GEOSContextHandle_t handle,
00249                                             int newDims);
00250 
00251 /*
00252  * Specify whether the WKB byte order is big or little endian.
00253  * The return value is the previous byte order.
00254  */
00255 
00256 extern int GEOS_DLL GEOS_getWKBByteOrder_r(GEOSContextHandle_t handle);
00257 extern int GEOS_DLL GEOS_setWKBByteOrder_r(GEOSContextHandle_t handle,
00258                                            int byteOrder);
00259 
00260 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf_r(GEOSContextHandle_t handle,
00261                                                     const unsigned char *wkb,
00262                                                     size_t size);
00263 extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf_r(GEOSContextHandle_t handle,
00264                                                    const GEOSGeometry* g,
00265                                                    size_t *size);
00266 
00267 extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf_r(GEOSContextHandle_t handle,
00268                                                     const unsigned char *hex,
00269                                                     size_t size);
00270 extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf_r(GEOSContextHandle_t handle,
00271                                                    const GEOSGeometry* g,
00272                                                    size_t *size);
00273 
00274 /************************************************************************
00275  *
00276  * Coordinate Sequence functions
00277  *
00278  ***********************************************************************/
00279 
00280 /*
00281  * Create a Coordinate sequence with ``size'' coordinates
00282  * of ``dims'' dimensions.
00283  * Return NULL on exception.
00284  */
00285 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_create_r(
00286                                                 GEOSContextHandle_t handle,
00287                                                 unsigned int size,
00288                                                 unsigned int dims);
00289 
00290 /*
00291  * Clone a Coordinate Sequence.
00292  * Return NULL on exception.
00293  */
00294 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_clone_r(
00295                                                 GEOSContextHandle_t handle,
00296                                                 const GEOSCoordSequence* s);
00297 
00298 /*
00299  * Destroy a Coordinate Sequence.
00300  */
00301 extern void GEOS_DLL GEOSCoordSeq_destroy_r(GEOSContextHandle_t handle,
00302                                             GEOSCoordSequence* s);
00303 
00304 /*
00305  * Set ordinate values in a Coordinate Sequence.
00306  * Return 0 on exception.
00307  */
00308 extern int GEOS_DLL GEOSCoordSeq_setX_r(GEOSContextHandle_t handle,
00309                                         GEOSCoordSequence* s, unsigned int idx,
00310                                         double val);
00311 extern int GEOS_DLL GEOSCoordSeq_setY_r(GEOSContextHandle_t handle,
00312                                         GEOSCoordSequence* s, unsigned int idx,
00313                                         double val);
00314 extern int GEOS_DLL GEOSCoordSeq_setZ_r(GEOSContextHandle_t handle,
00315                                         GEOSCoordSequence* s, unsigned int idx,
00316                                         double val);
00317 extern int GEOS_DLL GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t handle,
00318                                                GEOSCoordSequence* s,
00319                                                unsigned int idx,
00320                                                unsigned int dim, double val);
00321 
00322 /*
00323  * Get ordinate values from a Coordinate Sequence.
00324  * Return 0 on exception.
00325  */
00326 extern int GEOS_DLL GEOSCoordSeq_getX_r(GEOSContextHandle_t handle,
00327                                         const GEOSCoordSequence* s,
00328                                         unsigned int idx, double *val);
00329 extern int GEOS_DLL GEOSCoordSeq_getY_r(GEOSContextHandle_t handle,
00330                                         const GEOSCoordSequence* s,
00331                                         unsigned int idx, double *val);
00332 extern int GEOS_DLL GEOSCoordSeq_getZ_r(GEOSContextHandle_t handle,
00333                                         const GEOSCoordSequence* s,
00334                                         unsigned int idx, double *val);
00335 extern int GEOS_DLL GEOSCoordSeq_getOrdinate_r(GEOSContextHandle_t handle,
00336                                                const GEOSCoordSequence* s,
00337                                                unsigned int idx,
00338                                                unsigned int dim, double *val);
00339 /*
00340  * Get size and dimensions info from a Coordinate Sequence.
00341  * Return 0 on exception.
00342  */
00343 extern int GEOS_DLL GEOSCoordSeq_getSize_r(GEOSContextHandle_t handle,
00344                                            const GEOSCoordSequence* s,
00345                                            unsigned int *size);
00346 extern int GEOS_DLL GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t handle,
00347                                                  const GEOSCoordSequence* s,
00348                                                  unsigned int *dims);
00349 
00350 /************************************************************************
00351  *
00352  *  Linear referencing functions -- there are more, but these are
00353  *  probably sufficient for most purposes
00354  *
00355  ***********************************************************************/
00356 
00357 /*
00358  * GEOSGeometry ownership is retained by caller
00359  */
00360 
00361 
00362 /* Return distance of point 'p' projected on 'g' from origin
00363  * of 'g'. Geometry 'g' must be a lineal geometry */
00364 extern double GEOS_DLL GEOSProject_r(GEOSContextHandle_t handle,
00365                                      const GEOSGeometry *g,
00366                                      const GEOSGeometry *p);
00367 
00368 /* Return closest point to given distance within geometry
00369  * Geometry must be a LineString */
00370 extern GEOSGeometry GEOS_DLL *GEOSInterpolate_r(GEOSContextHandle_t handle,
00371                                                 const GEOSGeometry *g,
00372                                                 double d);
00373 
00374 extern double GEOS_DLL GEOSProjectNormalized_r(GEOSContextHandle_t handle,
00375                                                const GEOSGeometry *g,
00376                                                const GEOSGeometry *p);
00377 
00378 extern GEOSGeometry GEOS_DLL *GEOSInterpolateNormalized_r(
00379                                                 GEOSContextHandle_t handle,
00380                                                 const GEOSGeometry *g,
00381                                                 double d);
00382 
00383 /************************************************************************
00384  *
00385  * Buffer related functions
00386  *
00387  ***********************************************************************/
00388 
00389 
00390 /* @return NULL on exception */
00391 extern GEOSGeometry GEOS_DLL *GEOSBuffer_r(GEOSContextHandle_t handle,
00392                                            const GEOSGeometry* g,
00393                                            double width, int quadsegs);
00394 
00395 enum GEOSBufCapStyles {
00396         GEOSBUF_CAP_ROUND=1,
00397         GEOSBUF_CAP_FLAT=2,
00398         GEOSBUF_CAP_SQUARE=3
00399 };
00400 
00401 enum GEOSBufJoinStyles {
00402         GEOSBUF_JOIN_ROUND=1,
00403         GEOSBUF_JOIN_MITRE=2,
00404         GEOSBUF_JOIN_BEVEL=3
00405 };
00406 
00407 /* @return 0 on exception */
00408 extern GEOSBufferParams GEOS_DLL *GEOSBufferParams_create_r(
00409                                               GEOSContextHandle_t handle);
00410 extern void GEOS_DLL GEOSBufferParams_destroy_r(
00411                                               GEOSContextHandle_t handle,
00412                                               GEOSBufferParams* parms);
00413 
00414 /* @return 0 on exception */
00415 extern int GEOS_DLL GEOSBufferParams_setEndCapStyle_r(
00416                                               GEOSContextHandle_t handle,
00417                                               GEOSBufferParams* p,
00418                                               int style);
00419 
00420 /* @return 0 on exception */
00421 extern int GEOS_DLL GEOSBufferParams_setJoinStyle_r(
00422                                               GEOSContextHandle_t handle,
00423                                               GEOSBufferParams* p,
00424                                               int joinStyle);
00425 
00426 /* @return 0 on exception */
00427 extern int GEOS_DLL GEOSBufferParams_setMitreLimit_r(
00428                                               GEOSContextHandle_t handle,
00429                                               GEOSBufferParams* p,
00430                                               double mitreLimit);
00431 
00432 /* @return 0 on exception */
00433 extern int GEOS_DLL GEOSBufferParams_setQuadrantSegments_r(
00434                                               GEOSContextHandle_t handle,
00435                                               GEOSBufferParams* p,
00436                                               int quadSegs);
00437 
00438 /* @param singleSided: 1 for single sided, 0 otherwise */
00439 /* @return 0 on exception */
00440 extern int GEOS_DLL GEOSBufferParams_setSingleSided_r(
00441                                               GEOSContextHandle_t handle,
00442                                               GEOSBufferParams* p,
00443                                               int singleSided);
00444 
00445 /* @return NULL on exception */
00446 extern GEOSGeometry GEOS_DLL *GEOSBufferWithParams_r(
00447                                               GEOSContextHandle_t handle,
00448                                               const GEOSGeometry* g,
00449                                               const GEOSBufferParams* p,
00450                                               double width);
00451 
00452 /* These functions return NULL on exception. */
00453 extern GEOSGeometry GEOS_DLL *GEOSBufferWithStyle_r(GEOSContextHandle_t handle,
00454         const GEOSGeometry* g, double width, int quadsegs, int endCapStyle,
00455         int joinStyle, double mitreLimit);
00456 
00457 /* These functions return NULL on exception. Only LINESTRINGs are accepted. */
00458 /* @deprecated in 3.3.0: use GEOSOffsetCurve instead */
00459 extern GEOSGeometry GEOS_DLL *GEOSSingleSidedBuffer_r(
00460         GEOSContextHandle_t handle,
00461         const GEOSGeometry* g, double width, int quadsegs,
00462         int joinStyle, double mitreLimit, int leftSide);
00463 
00464 /*
00465  * Only LINESTRINGs are accepted.
00466  * @param width : offset distance.
00467  *                negative for right side offset.
00468  *                positive for left side offset.
00469  * @return NULL on exception
00470  */
00471 extern GEOSGeometry GEOS_DLL *GEOSOffsetCurve_r(GEOSContextHandle_t handle,
00472         const GEOSGeometry* g, double width, int quadsegs,
00473         int joinStyle, double mitreLimit);
00474 
00475 
00476 /************************************************************************
00477  *
00478  * Geometry Constructors.
00479  * GEOSCoordSequence* arguments will become ownership of the returned object.
00480  * All functions return NULL on exception.
00481  *
00482  ***********************************************************************/
00483 
00484 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint_r(
00485                                        GEOSContextHandle_t handle,
00486                                        GEOSCoordSequence* s);
00487 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPoint_r(
00488                                        GEOSContextHandle_t handle);
00489 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing_r(
00490                                        GEOSContextHandle_t handle,
00491                                        GEOSCoordSequence* s);
00492 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString_r(
00493                                        GEOSContextHandle_t handle,
00494                                        GEOSCoordSequence* s);
00495 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyLineString_r(
00496                                        GEOSContextHandle_t handle);
00497 
00498 /*
00499  * Second argument is an array of GEOSGeometry* objects.
00500  * The caller remains owner of the array, but pointed-to
00501  * objects become ownership of the returned GEOSGeometry.
00502  */
00503 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPolygon_r(
00504                                        GEOSContextHandle_t handle);
00505 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPolygon_r(
00506                                        GEOSContextHandle_t handle,
00507                                        GEOSGeometry* shell,
00508                                        GEOSGeometry** holes,
00509                                        unsigned int nholes);
00510 extern GEOSGeometry GEOS_DLL *GEOSGeom_createCollection_r(
00511                                        GEOSContextHandle_t handle, int type,
00512                                        GEOSGeometry* *geoms,
00513                                        unsigned int ngeoms);
00514 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCollection_r(
00515                                        GEOSContextHandle_t handle, int type);
00516 
00517 extern GEOSGeometry GEOS_DLL *GEOSGeom_clone_r(GEOSContextHandle_t handle,
00518                                                const GEOSGeometry* g);
00519 
00520 /************************************************************************
00521  *
00522  * Memory management
00523  *
00524  ***********************************************************************/
00525 
00526 extern void GEOS_DLL GEOSGeom_destroy_r(GEOSContextHandle_t handle,
00527                                         GEOSGeometry* g);
00528 
00529 /************************************************************************
00530  *
00531  * Topology operations - return NULL on exception.
00532  *
00533  ***********************************************************************/
00534 
00535 extern GEOSGeometry GEOS_DLL *GEOSEnvelope_r(GEOSContextHandle_t handle,
00536                                              const GEOSGeometry* g);
00537 extern GEOSGeometry GEOS_DLL *GEOSIntersection_r(GEOSContextHandle_t handle,
00538                                                  const GEOSGeometry* g1,
00539                                                  const GEOSGeometry* g2);
00540 extern GEOSGeometry GEOS_DLL *GEOSConvexHull_r(GEOSContextHandle_t handle,
00541                                                const GEOSGeometry* g);
00542 
00543 /* Returns the minimum rotated rectangular POLYGON which encloses the input geometry. The rectangle
00544  * has width equal to the minimum diameter, and a longer length. If the convex hill of the input is
00545  * degenerate (a line or point) a LINESTRING or POINT is returned. The minimum rotated rectangle can
00546  * be used as an extremely generalized representation for the given geometry.
00547  */
00548 extern GEOSGeometry GEOS_DLL *GEOSMinimumRotatedRectangle_r(GEOSContextHandle_t handle,
00549                                                const GEOSGeometry* g);
00550 
00551 /* Returns a LINESTRING geometry which represents the minimum diameter of the geometry.
00552  * The minimum diameter is defined to be the width of the smallest band that
00553  * contains the geometry, where a band is a strip of the plane defined
00554  * by two parallel lines. This can be thought of as the smallest hole that the geometry
00555  * can be moved through, with a single rotation.
00556  */
00557 extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth_r(GEOSContextHandle_t handle,
00558                                                const GEOSGeometry* g);
00559 
00560 extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine_r(GEOSContextHandle_t handle,
00561                                                      const GEOSGeometry* g);
00562 
00563 extern int GEOS_DLL GEOSMinimumClearance_r(GEOSContextHandle_t handle,
00564                                            const GEOSGeometry* g,
00565                                            double* distance);
00566 
00567 extern GEOSGeometry GEOS_DLL *GEOSDifference_r(GEOSContextHandle_t handle,
00568                                                const GEOSGeometry* g1,
00569                                                const GEOSGeometry* g2);
00570 extern GEOSGeometry GEOS_DLL *GEOSSymDifference_r(GEOSContextHandle_t handle,
00571                                                   const GEOSGeometry* g1,
00572                                                   const GEOSGeometry* g2);
00573 extern GEOSGeometry GEOS_DLL *GEOSBoundary_r(GEOSContextHandle_t handle,
00574                                              const GEOSGeometry* g);
00575 extern GEOSGeometry GEOS_DLL *GEOSUnion_r(GEOSContextHandle_t handle,
00576                                           const GEOSGeometry* g1,
00577                                           const GEOSGeometry* g2);
00578 extern GEOSGeometry GEOS_DLL *GEOSUnaryUnion_r(GEOSContextHandle_t handle,
00579                                           const GEOSGeometry* g);
00580 /* @deprecated in 3.3.0: use GEOSUnaryUnion_r instead */
00581 extern GEOSGeometry GEOS_DLL *GEOSUnionCascaded_r(GEOSContextHandle_t handle,
00582                                                   const GEOSGeometry* g);
00583 extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface_r(GEOSContextHandle_t handle,
00584                                                    const GEOSGeometry* g);
00585 extern GEOSGeometry GEOS_DLL *GEOSGetCentroid_r(GEOSContextHandle_t handle,
00586                                                 const GEOSGeometry* g);
00587 extern GEOSGeometry GEOS_DLL *GEOSNode_r(GEOSContextHandle_t handle,
00588                                          const GEOSGeometry* g);
00589 /* Fast, non-robust intersection between an arbitrary geometry and
00590  * a rectangle. The returned geometry may be invalid. */
00591 extern GEOSGeometry GEOS_DLL *GEOSClipByRect_r(GEOSContextHandle_t handle,
00592                                                  const GEOSGeometry* g,
00593                                                  double xmin, double ymin,
00594                                                  double xmax, double ymax);
00595 
00596 /*
00597  * all arguments remain ownership of the caller
00598  * (both Geometries and pointers)
00599  */
00600 /*
00601  * Polygonizes a set of Geometries which contain linework that
00602  * represents the edges of a planar graph.
00603  *
00604  * Any dimension of Geometry is handled - the constituent linework
00605  * is extracted to form the edges.
00606  *
00607  * The edges must be correctly noded; that is, they must only meet
00608  * at their endpoints.
00609  * The Polygonizer will still run on incorrectly noded input
00610  * but will not form polygons from incorrectly noded edges.
00611  *
00612  * The Polygonizer reports the follow kinds of errors:
00613  *
00614  * - Dangles - edges which have one or both ends which are
00615  *   not incident on another edge endpoint
00616  * - Cut Edges - edges which are connected at both ends but
00617  *   which do not form part of polygon
00618  * - Invalid Ring Lines - edges which form rings which are invalid
00619  *   (e.g. the component lines contain a self-intersection)
00620  *
00621  * Errors are reported to output parameters "cuts", "dangles" and
00622  * "invalid" (if not-null). Formed polygons are returned as a
00623  * collection. NULL is returned on exception. All returned
00624  * geometries must be destroyed by caller.
00625  *
00626  */
00627 
00628 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_r(GEOSContextHandle_t handle,
00629                               const GEOSGeometry *const geoms[],
00630                               unsigned int ngeoms);
00631 extern GEOSGeometry GEOS_DLL *GEOSPolygonizer_getCutEdges_r(
00632                               GEOSContextHandle_t handle,
00633                               const GEOSGeometry * const geoms[],
00634                               unsigned int ngeoms);
00635 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full_r(GEOSContextHandle_t handle,
00636                               const GEOSGeometry* input, GEOSGeometry** cuts,
00637                               GEOSGeometry** dangles, GEOSGeometry** invalidRings);
00638 
00639 extern GEOSGeometry GEOS_DLL *GEOSLineMerge_r(GEOSContextHandle_t handle,
00640                                               const GEOSGeometry* g);
00641 extern GEOSGeometry GEOS_DLL *GEOSSimplify_r(GEOSContextHandle_t handle,
00642                                              const GEOSGeometry* g,
00643                                              double tolerance);
00644 extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify_r(
00645                               GEOSContextHandle_t handle,
00646                               const GEOSGeometry* g, double tolerance);
00647 
00648 /*
00649  * Return all distinct vertices of input geometry as a MULTIPOINT.
00650  * Note that only 2 dimensions of the vertices are considered when
00651  * testing for equality.
00652  */
00653 extern GEOSGeometry GEOS_DLL *GEOSGeom_extractUniquePoints_r(
00654                               GEOSContextHandle_t handle,
00655                               const GEOSGeometry* g);
00656 
00657 /*
00658  * Find paths shared between the two given lineal geometries.
00659  *
00660  * Returns a GEOMETRYCOLLECTION having two elements:
00661  * - first element is a MULTILINESTRING containing shared paths
00662  *   having the _same_ direction on both inputs
00663  * - second element is a MULTILINESTRING containing shared paths
00664  *   having the _opposite_ direction on the two inputs
00665  *
00666  * Returns NULL on exception
00667  */
00668 extern GEOSGeometry GEOS_DLL *GEOSSharedPaths_r(GEOSContextHandle_t handle,
00669   const GEOSGeometry* g1, const GEOSGeometry* g2);
00670 
00671 /*
00672  * Snap first geometry on to second with given tolerance
00673  * Returns a newly allocated geometry, or NULL on exception
00674  */
00675 extern GEOSGeometry GEOS_DLL *GEOSSnap_r(GEOSContextHandle_t handle,
00676   const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance);
00677 
00678 /*
00679  * Return a Delaunay triangulation of the vertex of the given geometry
00680  *
00681  * @param g the input geometry whose vertex will be used as "sites"
00682  * @param tolerance optional snapping tolerance to use for improved robustness
00683  * @param onlyEdges if non-zero will return a MULTILINESTRING, otherwise it will
00684  *                  return a GEOMETRYCOLLECTION containing triangular POLYGONs.
00685  *
00686  * @return  a newly allocated geometry, or NULL on exception
00687  */
00688 extern GEOSGeometry GEOS_DLL * GEOSDelaunayTriangulation_r(
00689                                   GEOSContextHandle_t handle,
00690                                   const GEOSGeometry *g,
00691                                   double tolerance,
00692                                   int onlyEdges);
00693 
00694 /*
00695  * Returns the Voronoi polygons of a set of Vertices given as input
00696  *
00697  * @param g the input geometry whose vertex will be used as sites.
00698  * @param tolerance snapping tolerance to use for improved robustness
00699  * @param onlyEdges whether to return only edges of the voronoi cells
00700  * @param env clipping envelope for the returned diagram, automatically
00701  *            determined if NULL.
00702  *            The diagram will be clipped to the larger
00703  *            of this envelope or an envelope surrounding the sites.
00704  *
00705  * @return a newly allocated geometry, or NULL on exception.
00706  */
00707 extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram_r(
00708                                 GEOSContextHandle_t extHandle,
00709                                 const GEOSGeometry *g,
00710                                 const GEOSGeometry *env,
00711                                 double tolerance,
00712                                 int onlyEdges);
00713 
00714 
00715 /************************************************************************
00716  *
00717  *  Binary predicates - return 2 on exception, 1 on true, 0 on false
00718  *
00719  ***********************************************************************/
00720 
00721 extern char GEOS_DLL GEOSDisjoint_r(GEOSContextHandle_t handle,
00722                                     const GEOSGeometry* g1,
00723                                     const GEOSGeometry* g2);
00724 extern char GEOS_DLL GEOSTouches_r(GEOSContextHandle_t handle,
00725                                    const GEOSGeometry* g1,
00726                                    const GEOSGeometry* g2);
00727 extern char GEOS_DLL GEOSIntersects_r(GEOSContextHandle_t handle,
00728                                       const GEOSGeometry* g1,
00729                                       const GEOSGeometry* g2);
00730 extern char GEOS_DLL GEOSCrosses_r(GEOSContextHandle_t handle,
00731                                    const GEOSGeometry* g1,
00732                                    const GEOSGeometry* g2);
00733 extern char GEOS_DLL GEOSWithin_r(GEOSContextHandle_t handle,
00734                                   const GEOSGeometry* g1,
00735                                   const GEOSGeometry* g2);
00736 extern char GEOS_DLL GEOSContains_r(GEOSContextHandle_t handle,
00737                                     const GEOSGeometry* g1,
00738                                     const GEOSGeometry* g2);
00739 extern char GEOS_DLL GEOSOverlaps_r(GEOSContextHandle_t handle,
00740                                     const GEOSGeometry* g1,
00741                                     const GEOSGeometry* g2);
00742 extern char GEOS_DLL GEOSEquals_r(GEOSContextHandle_t handle,
00743                                   const GEOSGeometry* g1,
00744                                   const GEOSGeometry* g2);
00745 extern char GEOS_DLL GEOSEqualsExact_r(GEOSContextHandle_t handle,
00746                                        const GEOSGeometry* g1,
00747                                        const GEOSGeometry* g2,
00748                                        double tolerance);
00749 extern char GEOS_DLL GEOSCovers_r(GEOSContextHandle_t handle,
00750                                   const GEOSGeometry* g1,
00751                                   const GEOSGeometry* g2);
00752 extern char GEOS_DLL GEOSCoveredBy_r(GEOSContextHandle_t handle,
00753                                   const GEOSGeometry* g1,
00754                                   const GEOSGeometry* g2);
00755 
00756 /************************************************************************
00757  *
00758  *  Prepared Geometry Binary predicates - return 2 on exception, 1 on true, 0 on false
00759  *
00760  ***********************************************************************/
00761 
00762 /*
00763  * GEOSGeometry ownership is retained by caller
00764  */
00765 extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare_r(
00766                                             GEOSContextHandle_t handle,
00767                                             const GEOSGeometry* g);
00768 
00769 extern void GEOS_DLL GEOSPreparedGeom_destroy_r(GEOSContextHandle_t handle,
00770                                                 const GEOSPreparedGeometry* g);
00771 
00772 extern char GEOS_DLL GEOSPreparedContains_r(GEOSContextHandle_t handle,
00773                                             const GEOSPreparedGeometry* pg1,
00774                                             const GEOSGeometry* g2);
00775 extern char GEOS_DLL GEOSPreparedContainsProperly_r(GEOSContextHandle_t handle,
00776                                          const GEOSPreparedGeometry* pg1,
00777                                          const GEOSGeometry* g2);
00778 extern char GEOS_DLL GEOSPreparedCoveredBy_r(GEOSContextHandle_t handle,
00779                                           const GEOSPreparedGeometry* pg1,
00780                                           const GEOSGeometry* g2);
00781 extern char GEOS_DLL GEOSPreparedCovers_r(GEOSContextHandle_t handle,
00782                                           const GEOSPreparedGeometry* pg1,
00783                                           const GEOSGeometry* g2);
00784 extern char GEOS_DLL GEOSPreparedCrosses_r(GEOSContextHandle_t handle,
00785                                           const GEOSPreparedGeometry* pg1,
00786                                           const GEOSGeometry* g2);
00787 extern char GEOS_DLL GEOSPreparedDisjoint_r(GEOSContextHandle_t handle,
00788                                           const GEOSPreparedGeometry* pg1,
00789                                           const GEOSGeometry* g2);
00790 extern char GEOS_DLL GEOSPreparedIntersects_r(GEOSContextHandle_t handle,
00791                                               const GEOSPreparedGeometry* pg1,
00792                                               const GEOSGeometry* g2);
00793 extern char GEOS_DLL GEOSPreparedOverlaps_r(GEOSContextHandle_t handle,
00794                                           const GEOSPreparedGeometry* pg1,
00795                                           const GEOSGeometry* g2);
00796 extern char GEOS_DLL GEOSPreparedTouches_r(GEOSContextHandle_t handle,
00797                                           const GEOSPreparedGeometry* pg1,
00798                                           const GEOSGeometry* g2);
00799 extern char GEOS_DLL GEOSPreparedWithin_r(GEOSContextHandle_t handle,
00800                                           const GEOSPreparedGeometry* pg1,
00801                                           const GEOSGeometry* g2);
00802 
00803 /************************************************************************
00804  *
00805  *  STRtree functions
00806  *
00807  ***********************************************************************/
00808 
00809 /*
00810  * GEOSGeometry ownership is retained by caller
00811  */
00812 
00813 extern GEOSSTRtree GEOS_DLL *GEOSSTRtree_create_r(
00814                                     GEOSContextHandle_t handle,
00815                                     size_t nodeCapacity);
00816 extern void GEOS_DLL GEOSSTRtree_insert_r(GEOSContextHandle_t handle,
00817                                           GEOSSTRtree *tree,
00818                                           const GEOSGeometry *g,
00819                                           void *item);
00820 extern void GEOS_DLL GEOSSTRtree_query_r(GEOSContextHandle_t handle,
00821                                          GEOSSTRtree *tree,
00822                                          const GEOSGeometry *g,
00823                                          GEOSQueryCallback callback,
00824                                          void *userdata);
00825 
00826 extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest_r(GEOSContextHandle_t handle,
00827                                                   GEOSSTRtree *tree,
00828                                                   const GEOSGeometry* geom);
00829 
00830 
00831 extern const void GEOS_DLL *GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t handle,
00832                                                           GEOSSTRtree *tree,
00833                                                           const void* item,
00834                                                           const GEOSGeometry* itemEnvelope,
00835                                                           GEOSDistanceCallback distancefn,
00836                                                           void* userdata);
00837 
00838 extern void GEOS_DLL GEOSSTRtree_iterate_r(GEOSContextHandle_t handle,
00839                                        GEOSSTRtree *tree,
00840                                        GEOSQueryCallback callback,
00841                                        void *userdata);
00842 extern char GEOS_DLL GEOSSTRtree_remove_r(GEOSContextHandle_t handle,
00843                                           GEOSSTRtree *tree,
00844                                           const GEOSGeometry *g,
00845                                           void *item);
00846 extern void GEOS_DLL GEOSSTRtree_destroy_r(GEOSContextHandle_t handle,
00847                                            GEOSSTRtree *tree);
00848 
00849 
00850 /************************************************************************
00851  *
00852  *  Unary predicate - return 2 on exception, 1 on true, 0 on false
00853  *
00854  ***********************************************************************/
00855 
00856 extern char GEOS_DLL GEOSisEmpty_r(GEOSContextHandle_t handle,
00857                                    const GEOSGeometry* g);
00858 extern char GEOS_DLL GEOSisSimple_r(GEOSContextHandle_t handle,
00859                                     const GEOSGeometry* g);
00860 extern char GEOS_DLL GEOSisRing_r(GEOSContextHandle_t handle,
00861                                   const GEOSGeometry* g);
00862 extern char GEOS_DLL GEOSHasZ_r(GEOSContextHandle_t handle,
00863                                 const GEOSGeometry* g);
00864 extern char GEOS_DLL GEOSisClosed_r(GEOSContextHandle_t handle,
00865                                 const GEOSGeometry *g);
00866 
00867 /************************************************************************
00868  *
00869  *  Dimensionally Extended 9 Intersection Model related
00870  *
00871  ***********************************************************************/
00872 
00873 /* These are for use with GEOSRelateBoundaryNodeRule (flags param) */
00874 enum GEOSRelateBoundaryNodeRules {
00875         /* MOD2 and OGC are the same rule, and is the default
00876          * used by GEOSRelatePattern
00877          */
00878         GEOSRELATE_BNR_MOD2=1,
00879         GEOSRELATE_BNR_OGC=1,
00880         GEOSRELATE_BNR_ENDPOINT=2,
00881         GEOSRELATE_BNR_MULTIVALENT_ENDPOINT=3,
00882         GEOSRELATE_BNR_MONOVALENT_ENDPOINT=4
00883 };
00884 
00885 /* return 2 on exception, 1 on true, 0 on false */
00886 extern char GEOS_DLL GEOSRelatePattern_r(GEOSContextHandle_t handle,
00887                                          const GEOSGeometry* g1,
00888                                          const GEOSGeometry* g2,
00889                                          const char *pat);
00890 
00891 /* return NULL on exception, a string to GEOSFree otherwise */
00892 extern char GEOS_DLL *GEOSRelate_r(GEOSContextHandle_t handle,
00893                                    const GEOSGeometry* g1,
00894                                    const GEOSGeometry* g2);
00895 
00896 /* return 2 on exception, 1 on true, 0 on false */
00897 extern char GEOS_DLL GEOSRelatePatternMatch_r(GEOSContextHandle_t handle,
00898                                          const char *mat,
00899                                          const char *pat);
00900 
00901 /* return NULL on exception, a string to GEOSFree otherwise */
00902 extern char GEOS_DLL *GEOSRelateBoundaryNodeRule_r(GEOSContextHandle_t handle,
00903                                                    const GEOSGeometry* g1,
00904                                                    const GEOSGeometry* g2,
00905                                                    int bnr);
00906 
00907 /************************************************************************
00908  *
00909  *  Validity checking
00910  *
00911  ***********************************************************************/
00912 
00913 /* These are for use with GEOSisValidDetail (flags param) */
00914 enum GEOSValidFlags {
00915         GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE=1
00916 };
00917 
00918 /* return 2 on exception, 1 on true, 0 on false */
00919 extern char GEOS_DLL GEOSisValid_r(GEOSContextHandle_t handle,
00920                                    const GEOSGeometry* g);
00921 
00922 /* return NULL on exception, a string to GEOSFree otherwise */
00923 extern char GEOS_DLL *GEOSisValidReason_r(GEOSContextHandle_t handle,
00924                                          const GEOSGeometry* g);
00925 
00926 /*
00927  * Caller has the responsibility to destroy 'reason' (GEOSFree)
00928  * and 'location' (GEOSGeom_destroy) params
00929  * return 2 on exception, 1 when valid, 0 when invalid
00930  */
00931 extern char GEOS_DLL GEOSisValidDetail_r(GEOSContextHandle_t handle,
00932                                          const GEOSGeometry* g,
00933                                          int flags,
00934                                          char** reason,
00935                                          GEOSGeometry** location);
00936 
00937 /************************************************************************
00938  *
00939  *  Geometry info
00940  *
00941  ***********************************************************************/
00942 
00943 /* Return NULL on exception, result must be freed by caller. */
00944 extern char GEOS_DLL *GEOSGeomType_r(GEOSContextHandle_t handle,
00945                                      const GEOSGeometry* g);
00946 
00947 /* Return -1 on exception */
00948 extern int GEOS_DLL GEOSGeomTypeId_r(GEOSContextHandle_t handle,
00949                                      const GEOSGeometry* g);
00950 
00951 /* Return 0 on exception */
00952 extern int GEOS_DLL GEOSGetSRID_r(GEOSContextHandle_t handle,
00953                                   const GEOSGeometry* g);
00954 
00955 extern void GEOS_DLL GEOSSetSRID_r(GEOSContextHandle_t handle,
00956                                    GEOSGeometry* g, int SRID);
00957 
00958 extern void GEOS_DLL *GEOSGeom_getUserData_r(GEOSContextHandle_t handle,
00959 const GEOSGeometry* g);
00960 
00961 extern void GEOS_DLL GEOSGeom_setUserData_r(GEOSContextHandle_t handle,
00962                                    GEOSGeometry* g, void* userData);
00963 
00964 /* May be called on all geometries in GEOS 3.x, returns -1 on error and 1
00965  * for non-multi geometries. Older GEOS versions only accept
00966  * GeometryCollections or Multi* geometries here, and are likely to crash
00967  * when fed simple geometries, so beware if you need compatibility with
00968  * old GEOS versions.
00969  */
00970 extern int GEOS_DLL GEOSGetNumGeometries_r(GEOSContextHandle_t handle,
00971                                            const GEOSGeometry* g);
00972 
00973 /*
00974  * Return NULL on exception.
00975  * Returned object is a pointer to internal storage:
00976  * it must NOT be destroyed directly.
00977  * Up to GEOS 3.2.0 the input geometry must be a Collection, in
00978  * later version it doesn't matter (getGeometryN(0) for a single will
00979  * return the input).
00980  */
00981 extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN_r(
00982                                     GEOSContextHandle_t handle,
00983                                     const GEOSGeometry* g, int n);
00984 
00985 /* Return -1 on exception */
00986 extern int GEOS_DLL GEOSNormalize_r(GEOSContextHandle_t handle,
00987                                     GEOSGeometry* g);
00988 
00991 #define GEOS_PREC_NO_TOPO         (1<<0)
00992 
00995 #define GEOS_PREC_KEEP_COLLAPSED  (1<<1)
00996 
01012 extern GEOSGeometry GEOS_DLL *GEOSGeom_setPrecision_r(
01013                                        GEOSContextHandle_t handle,
01014                                        const GEOSGeometry *g,
01015                                        double gridSize, int flags);
01016 
01023 extern double GEOS_DLL GEOSGeom_getPrecision_r(
01024                                        GEOSContextHandle_t handle,
01025                                        const GEOSGeometry *g);
01026 
01027 /* Return -1 on exception */
01028 extern int GEOS_DLL GEOSGetNumInteriorRings_r(GEOSContextHandle_t handle,
01029                                               const GEOSGeometry* g);
01030 
01031 /* Return -1 on exception, Geometry must be a LineString. */
01032 extern int GEOS_DLL GEOSGeomGetNumPoints_r(GEOSContextHandle_t handle,
01033                                        const GEOSGeometry* g);
01034 
01035 /* Return -1 on exception, Geometry must be a Point. */
01036 extern int GEOS_DLL GEOSGeomGetX_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *x);
01037 extern int GEOS_DLL GEOSGeomGetY_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *y);
01038 
01039 /*
01040  * Return NULL on exception, Geometry must be a Polygon.
01041  * Returned object is a pointer to internal storage:
01042  * it must NOT be destroyed directly.
01043  */
01044 extern const GEOSGeometry GEOS_DLL *GEOSGetInteriorRingN_r(
01045                                     GEOSContextHandle_t handle,
01046                                     const GEOSGeometry* g, int n);
01047 
01048 /*
01049  * Return NULL on exception, Geometry must be a Polygon.
01050  * Returned object is a pointer to internal storage:
01051  * it must NOT be destroyed directly.
01052  */
01053 extern const GEOSGeometry GEOS_DLL *GEOSGetExteriorRing_r(
01054                                     GEOSContextHandle_t handle,
01055                                     const GEOSGeometry* g);
01056 
01057 /* Return -1 on exception */
01058 extern int GEOS_DLL GEOSGetNumCoordinates_r(GEOSContextHandle_t handle,
01059                                             const GEOSGeometry* g);
01060 
01061 /*
01062  * Return NULL on exception.
01063  * Geometry must be a LineString, LinearRing or Point.
01064  */
01065 extern const GEOSCoordSequence GEOS_DLL *GEOSGeom_getCoordSeq_r(
01066                                          GEOSContextHandle_t handle,
01067                                          const GEOSGeometry* g);
01068 
01069 /*
01070  * Return 0 on exception (or empty geometry)
01071  */
01072 extern int GEOS_DLL GEOSGeom_getDimensions_r(GEOSContextHandle_t handle,
01073                                              const GEOSGeometry* g);
01074 
01075 /*
01076  * Return 2 or 3.
01077  */
01078 extern int GEOS_DLL GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t handle,
01079                                                       const GEOSGeometry* g);
01080 
01081 /*
01082  * Return NULL on exception.
01083  * Must be LineString and must be freed by called.
01084  */
01085 extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int n);
01086 extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g);
01087 extern GEOSGeometry GEOS_DLL *GEOSGeomGetEndPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g);
01088 
01089 /************************************************************************
01090  *
01091  *  Misc functions
01092  *
01093  ***********************************************************************/
01094 
01095 /* Return 0 on exception, 1 otherwise */
01096 extern int GEOS_DLL GEOSArea_r(GEOSContextHandle_t handle,
01097                                const GEOSGeometry* g, double *area);
01098 extern int GEOS_DLL GEOSLength_r(GEOSContextHandle_t handle,
01099                                  const GEOSGeometry* g, double *length);
01100 extern int GEOS_DLL GEOSDistance_r(GEOSContextHandle_t handle,
01101                                    const GEOSGeometry* g1,
01102                                    const GEOSGeometry* g2, double *dist);
01103 extern int GEOS_DLL GEOSHausdorffDistance_r(GEOSContextHandle_t handle,
01104                                    const GEOSGeometry *g1,
01105                                    const GEOSGeometry *g2,
01106                                    double *dist);
01107 extern int GEOS_DLL GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t handle,
01108                                    const GEOSGeometry *g1,
01109                                    const GEOSGeometry *g2,
01110                                    double densifyFrac, double *dist);
01111 extern int GEOS_DLL GEOSGeomGetLength_r(GEOSContextHandle_t handle,
01112                                    const GEOSGeometry *g, double *length);
01113 
01114 /* Return 0 on exception, the closest points of the two geometries otherwise.
01115  * The first point comes from g1 geometry and the second point comes from g2.
01116  */
01117 extern GEOSCoordSequence GEOS_DLL *GEOSNearestPoints_r(
01118   GEOSContextHandle_t handle, const GEOSGeometry* g1, const GEOSGeometry* g2);
01119 
01120 
01121 /************************************************************************
01122  *
01123  * Algorithms
01124  *
01125  ***********************************************************************/
01126 
01127 /* Walking from A to B:
01128  *  return -1 if reaching P takes a counter-clockwise (left) turn
01129  *  return  1 if reaching P takes a clockwise (right) turn
01130  *  return  0 if P is collinear with A-B
01131  *
01132  * On exceptions, return 2.
01133  *
01134  */
01135 extern int GEOS_DLL GEOSOrientationIndex_r(GEOSContextHandle_t handle,
01136         double Ax, double Ay, double Bx, double By, double Px, double Py);
01137 
01138 
01139 /************************************************************************
01140  *
01141  * Reader and Writer APIs
01142  *
01143  ***********************************************************************/
01144 
01145 typedef struct GEOSWKTReader_t GEOSWKTReader;
01146 typedef struct GEOSWKTWriter_t GEOSWKTWriter;
01147 typedef struct GEOSWKBReader_t GEOSWKBReader;
01148 typedef struct GEOSWKBWriter_t GEOSWKBWriter;
01149 
01150 
01151 /* WKT Reader */
01152 extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create_r(
01153                                              GEOSContextHandle_t handle);
01154 extern void GEOS_DLL GEOSWKTReader_destroy_r(GEOSContextHandle_t handle,
01155                                              GEOSWKTReader* reader);
01156 extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read_r(GEOSContextHandle_t handle,
01157                                                    GEOSWKTReader* reader,
01158                                                    const char *wkt);
01159 
01160 /* WKT Writer */
01161 extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create_r(
01162                                              GEOSContextHandle_t handle);
01163 extern void GEOS_DLL GEOSWKTWriter_destroy_r(GEOSContextHandle_t handle,
01164                                              GEOSWKTWriter* writer);
01165 extern char GEOS_DLL *GEOSWKTWriter_write_r(GEOSContextHandle_t handle,
01166                                             GEOSWKTWriter* writer,
01167                                             const GEOSGeometry* g);
01168 extern void GEOS_DLL GEOSWKTWriter_setTrim_r(GEOSContextHandle_t handle,
01169                                             GEOSWKTWriter *writer,
01170                                             char trim);
01171 extern void GEOS_DLL GEOSWKTWriter_setRoundingPrecision_r(GEOSContextHandle_t handle,
01172                                             GEOSWKTWriter *writer,
01173                                             int precision);
01174 extern void GEOS_DLL GEOSWKTWriter_setOutputDimension_r(GEOSContextHandle_t handle,
01175                                                         GEOSWKTWriter *writer,
01176                                                         int dim);
01177 extern int  GEOS_DLL GEOSWKTWriter_getOutputDimension_r(GEOSContextHandle_t handle,
01178                                                         GEOSWKTWriter *writer);
01179 extern void GEOS_DLL GEOSWKTWriter_setOld3D_r(GEOSContextHandle_t handle,
01180                                               GEOSWKTWriter *writer,
01181                                               int useOld3D);
01182 
01183 /* WKB Reader */
01184 extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create_r(
01185                                              GEOSContextHandle_t handle);
01186 extern void GEOS_DLL GEOSWKBReader_destroy_r(GEOSContextHandle_t handle,
01187                                              GEOSWKBReader* reader);
01188 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read_r(GEOSContextHandle_t handle,
01189                                                    GEOSWKBReader* reader,
01190                                                    const unsigned char *wkb,
01191                                                    size_t size);
01192 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_readHEX_r(
01193                                             GEOSContextHandle_t handle,
01194                                             GEOSWKBReader* reader,
01195                                             const unsigned char *hex,
01196                                             size_t size);
01197 
01198 /* WKB Writer */
01199 extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create_r(
01200                                              GEOSContextHandle_t handle);
01201 extern void GEOS_DLL GEOSWKBWriter_destroy_r(GEOSContextHandle_t handle,
01202                                              GEOSWKBWriter* writer);
01203 
01204 /* The caller owns the results for these two methods! */
01205 extern unsigned char GEOS_DLL *GEOSWKBWriter_write_r(
01206                                              GEOSContextHandle_t handle,
01207                                              GEOSWKBWriter* writer,
01208                                              const GEOSGeometry* g,
01209                                              size_t *size);
01210 extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX_r(
01211                                              GEOSContextHandle_t handle,
01212                                              GEOSWKBWriter* writer,
01213                                              const GEOSGeometry* g,
01214                                              size_t *size);
01215 
01216 /*
01217  * Specify whether output WKB should be 2d or 3d.
01218  * Return previously set number of dimensions.
01219  */
01220 extern int GEOS_DLL GEOSWKBWriter_getOutputDimension_r(
01221                                   GEOSContextHandle_t handle,
01222                                   const GEOSWKBWriter* writer);
01223 extern void GEOS_DLL GEOSWKBWriter_setOutputDimension_r(
01224                                    GEOSContextHandle_t handle,
01225                                    GEOSWKBWriter* writer, int newDimension);
01226 
01227 /*
01228  * Specify whether the WKB byte order is big or little endian.
01229  * The return value is the previous byte order.
01230  */
01231 extern int GEOS_DLL GEOSWKBWriter_getByteOrder_r(GEOSContextHandle_t handle,
01232                                                  const GEOSWKBWriter* writer);
01233 extern void GEOS_DLL GEOSWKBWriter_setByteOrder_r(GEOSContextHandle_t handle,
01234                                                   GEOSWKBWriter* writer,
01235                                                   int byteOrder);
01236 
01237 /*
01238  * Specify whether SRID values should be output.
01239  */
01240 extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID_r(GEOSContextHandle_t handle,
01241                                    const GEOSWKBWriter* writer);
01242 extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID_r(GEOSContextHandle_t handle,
01243                                    GEOSWKBWriter* writer, const char writeSRID);
01244 
01245 
01246 /*
01247  * Free buffers returned by stuff like GEOSWKBWriter_write(),
01248  * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write().
01249  */
01250 extern void GEOS_DLL GEOSFree_r(GEOSContextHandle_t handle, void *buffer);
01251 
01252 
01253 /* External code to GEOS can define GEOS_USE_ONLY_R_API to avoid the */
01254 /* non _r API to be available */
01255 #ifndef GEOS_USE_ONLY_R_API
01256 
01257 /************************************************************************
01258  *
01259  * Initialization, cleanup, version
01260  *
01261  ***********************************************************************/
01262 
01263 extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
01264     GEOSMessageHandler error_function);
01265 extern void GEOS_DLL finishGEOS(void);
01266 
01267 /************************************************************************
01268  *
01269  * NOTE - These functions are DEPRECATED.  Please use the new Reader and
01270  * writer APIS!
01271  *
01272  ***********************************************************************/
01273 
01274 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT(const char *wkt);
01275 extern char GEOS_DLL *GEOSGeomToWKT(const GEOSGeometry* g);
01276 
01277 /*
01278  * Specify whether output WKB should be 2d or 3d.
01279  * Return previously set number of dimensions.
01280  */
01281 extern int GEOS_DLL GEOS_getWKBOutputDims();
01282 extern int GEOS_DLL GEOS_setWKBOutputDims(int newDims);
01283 
01284 /*
01285  * Specify whether the WKB byte order is big or little endian.
01286  * The return value is the previous byte order.
01287  */
01288 extern int GEOS_DLL GEOS_getWKBByteOrder();
01289 extern int GEOS_DLL GEOS_setWKBByteOrder(int byteOrder);
01290 
01291 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf(const unsigned char *wkb, size_t size);
01292 extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf(const GEOSGeometry* g, size_t *size);
01293 
01294 extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf(const unsigned char *hex, size_t size);
01295 extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf(const GEOSGeometry* g, size_t *size);
01296 
01297 /************************************************************************
01298  *
01299  * Coordinate Sequence functions
01300  *
01301  ***********************************************************************/
01302 
01303 /*
01304  * Create a Coordinate sequence with ``size'' coordinates
01305  * of ``dims'' dimensions.
01306  * Return NULL on exception.
01307  */
01308 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_create(unsigned int size, unsigned int dims);
01309 
01310 /*
01311  * Clone a Coordinate Sequence.
01312  * Return NULL on exception.
01313  */
01314 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_clone(const GEOSCoordSequence* s);
01315 
01316 /*
01317  * Destroy a Coordinate Sequence.
01318  */
01319 extern void GEOS_DLL GEOSCoordSeq_destroy(GEOSCoordSequence* s);
01320 
01321 /*
01322  * Set ordinate values in a Coordinate Sequence.
01323  * Return 0 on exception.
01324  */
01325 extern int GEOS_DLL GEOSCoordSeq_setX(GEOSCoordSequence* s,
01326     unsigned int idx, double val);
01327 extern int GEOS_DLL GEOSCoordSeq_setY(GEOSCoordSequence* s,
01328     unsigned int idx, double val);
01329 extern int GEOS_DLL GEOSCoordSeq_setZ(GEOSCoordSequence* s,
01330     unsigned int idx, double val);
01331 extern int GEOS_DLL GEOSCoordSeq_setOrdinate(GEOSCoordSequence* s,
01332     unsigned int idx, unsigned int dim, double val);
01333 
01334 /*
01335  * Get ordinate values from a Coordinate Sequence.
01336  * Return 0 on exception.
01337  */
01338 extern int GEOS_DLL GEOSCoordSeq_getX(const GEOSCoordSequence* s,
01339     unsigned int idx, double *val);
01340 extern int GEOS_DLL GEOSCoordSeq_getY(const GEOSCoordSequence* s,
01341     unsigned int idx, double *val);
01342 extern int GEOS_DLL GEOSCoordSeq_getZ(const GEOSCoordSequence* s,
01343     unsigned int idx, double *val);
01344 extern int GEOS_DLL GEOSCoordSeq_getOrdinate(const GEOSCoordSequence* s,
01345     unsigned int idx, unsigned int dim, double *val);
01346 /*
01347  * Get size and dimensions info from a Coordinate Sequence.
01348  * Return 0 on exception.
01349  */
01350 extern int GEOS_DLL GEOSCoordSeq_getSize(const GEOSCoordSequence* s,
01351     unsigned int *size);
01352 extern int GEOS_DLL GEOSCoordSeq_getDimensions(const GEOSCoordSequence* s,
01353     unsigned int *dims);
01354 
01355 /************************************************************************
01356  *
01357  *  Linear referencing functions -- there are more, but these are
01358  *  probably sufficient for most purposes
01359  *
01360  ***********************************************************************/
01361 
01362 /*
01363  * GEOSGeometry ownership is retained by caller
01364  */
01365 
01366 
01367 /* Return distance of point 'p' projected on 'g' from origin
01368  * of 'g'. Geometry 'g' must be a lineal geometry */
01369 extern double GEOS_DLL GEOSProject(const GEOSGeometry *g,
01370                                    const GEOSGeometry* p);
01371 
01372 /* Return closest point to given distance within geometry
01373  * Geometry must be a LineString */
01374 extern GEOSGeometry GEOS_DLL *GEOSInterpolate(const GEOSGeometry *g,
01375                                               double d);
01376 
01377 extern double GEOS_DLL GEOSProjectNormalized(const GEOSGeometry *g,
01378                                              const GEOSGeometry* p);
01379 
01380 extern GEOSGeometry GEOS_DLL *GEOSInterpolateNormalized(const GEOSGeometry *g,
01381                                                         double d);
01382 
01383 /************************************************************************
01384  *
01385  * Buffer related functions
01386  *
01387  ***********************************************************************/
01388 
01389 
01390 /* @return NULL on exception */
01391 extern GEOSGeometry GEOS_DLL *GEOSBuffer(const GEOSGeometry* g,
01392     double width, int quadsegs);
01393 
01394 /* @return 0 on exception */
01395 extern GEOSBufferParams GEOS_DLL *GEOSBufferParams_create();
01396 extern void GEOS_DLL GEOSBufferParams_destroy(GEOSBufferParams* parms);
01397 
01398 /* @return 0 on exception */
01399 extern int GEOS_DLL GEOSBufferParams_setEndCapStyle(
01400                                               GEOSBufferParams* p,
01401                                               int style);
01402 
01403 /* @return 0 on exception */
01404 extern int GEOS_DLL GEOSBufferParams_setJoinStyle(
01405                                               GEOSBufferParams* p,
01406                                               int joinStyle);
01407 
01408 /* @return 0 on exception */
01409 extern int GEOS_DLL GEOSBufferParams_setMitreLimit(
01410                                               GEOSBufferParams* p,
01411                                               double mitreLimit);
01412 
01413 /* @return 0 on exception */
01414 extern int GEOS_DLL GEOSBufferParams_setQuadrantSegments(
01415                                               GEOSBufferParams* p,
01416                                               int quadSegs);
01417 
01418 /* @param singleSided: 1 for single sided, 0 otherwise */
01419 /* @return 0 on exception */
01420 extern int GEOS_DLL GEOSBufferParams_setSingleSided(
01421                                               GEOSBufferParams* p,
01422                                               int singleSided);
01423 
01424 /* @return NULL on exception */
01425 extern GEOSGeometry GEOS_DLL *GEOSBufferWithParams(
01426                                               const GEOSGeometry* g,
01427                                               const GEOSBufferParams* p,
01428                                               double width);
01429 
01430 /* These functions return NULL on exception. */
01431 extern GEOSGeometry GEOS_DLL *GEOSBufferWithStyle(const GEOSGeometry* g,
01432     double width, int quadsegs, int endCapStyle, int joinStyle,
01433     double mitreLimit);
01434 
01435 /* These functions return NULL on exception. Only LINESTRINGs are accepted. */
01436 /* @deprecated in 3.3.0: use GEOSOffsetCurve instead */
01437 extern GEOSGeometry GEOS_DLL *GEOSSingleSidedBuffer(const GEOSGeometry* g,
01438     double width, int quadsegs, int joinStyle, double mitreLimit,
01439     int leftSide);
01440 
01441 /*
01442  * Only LINESTRINGs are accepted.
01443  * @param width : offset distance.
01444  *                negative for right side offset.
01445  *                positive for left side offset.
01446  * @return NULL on exception
01447  */
01448 extern GEOSGeometry GEOS_DLL *GEOSOffsetCurve(const GEOSGeometry* g,
01449     double width, int quadsegs, int joinStyle, double mitreLimit);
01450 
01451 /************************************************************************
01452  *
01453  * Geometry Constructors.
01454  * GEOSCoordSequence* arguments will become ownership of the returned object.
01455  * All functions return NULL on exception.
01456  *
01457  ***********************************************************************/
01458 
01459 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint(GEOSCoordSequence* s);
01460 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPoint();
01461 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing(GEOSCoordSequence* s);
01462 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString(GEOSCoordSequence* s);
01463 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyLineString();
01464 
01465 /*
01466  * Second argument is an array of GEOSGeometry* objects.
01467  * The caller remains owner of the array, but pointed-to
01468  * objects become ownership of the returned GEOSGeometry.
01469  */
01470 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPolygon();
01471 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPolygon(GEOSGeometry* shell,
01472     GEOSGeometry** holes, unsigned int nholes);
01473 extern GEOSGeometry GEOS_DLL *GEOSGeom_createCollection(int type,
01474     GEOSGeometry* *geoms, unsigned int ngeoms);
01475 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCollection(int type);
01476 
01477 extern GEOSGeometry GEOS_DLL *GEOSGeom_clone(const GEOSGeometry* g);
01478 
01479 /************************************************************************
01480  *
01481  * Memory management
01482  *
01483  ***********************************************************************/
01484 
01485 extern void GEOS_DLL GEOSGeom_destroy(GEOSGeometry* g);
01486 
01487 /************************************************************************
01488  *
01489  * Topology operations - return NULL on exception.
01490  *
01491  ***********************************************************************/
01492 
01493 extern GEOSGeometry GEOS_DLL *GEOSEnvelope(const GEOSGeometry* g);
01494 extern GEOSGeometry GEOS_DLL *GEOSIntersection(const GEOSGeometry* g1, const GEOSGeometry* g2);
01495 extern GEOSGeometry GEOS_DLL *GEOSConvexHull(const GEOSGeometry* g);
01496 
01497 /* Returns the minimum rotated rectangular POLYGON which encloses the input geometry. The rectangle
01498  * has width equal to the minimum diameter, and a longer length. If the convex hill of the input is
01499  * degenerate (a line or point) a LINESTRING or POINT is returned. The minimum rotated rectangle can
01500  * be used as an extremely generalized representation for the given geometry.
01501  */
01502 extern GEOSGeometry GEOS_DLL *GEOSMinimumRotatedRectangle(const GEOSGeometry* g);
01503 
01504 /* Returns a LINESTRING geometry which represents the minimum diameter of the geometry.
01505  * The minimum diameter is defined to be the width of the smallest band that
01506  * contains the geometry, where a band is a strip of the plane defined
01507  * by two parallel lines. This can be thought of as the smallest hole that the geometry
01508  * can be moved through, with a single rotation.
01509  */
01510 extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth(const GEOSGeometry* g);
01511 
01512 /* Computes the minimum clearance of a geometry.  The minimum clearance is the smallest amount by which
01513  * a vertex could be move to produce an invalid polygon, a non-simple linestring, or a multipoint with
01514  * repeated points.  If a geometry has a minimum clearance of 'eps', it can be said that:
01515  *
01516  * -  No two distinct vertices in the geometry are separated by less than 'eps'
01517  * -  No vertex is closer than 'eps' to a line segment of which it is not an endpoint.
01518  *
01519  * If the minimum clearance cannot be defined for a geometry (such as with a single point, or a multipoint
01520  * whose points are identical, a value of Infinity will be calculated.
01521  *
01522  * @param g the input geometry
01523  * @param d a double to which the result can be stored
01524  *
01525  * @return 0 if no exception occurred
01526  *         2 if an exception occurred
01527  */
01528 extern int GEOS_DLL GEOSMinimumClearance(const GEOSGeometry* g, double* d);
01529 
01530 /* Returns a LineString whose endpoints define the minimum clearance of a geometry.
01531  * If the geometry has no minimum clearance, an empty LineString will be returned.
01532  *
01533  * @param g the input geometry
01534  * @return a LineString, or NULL if an exception occurred.
01535  */
01536 extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine(const GEOSGeometry* g);
01537 
01538 extern GEOSGeometry GEOS_DLL *GEOSDifference(const GEOSGeometry* g1, const GEOSGeometry* g2);
01539 extern GEOSGeometry GEOS_DLL *GEOSSymDifference(const GEOSGeometry* g1, const GEOSGeometry* g2);
01540 extern GEOSGeometry GEOS_DLL *GEOSBoundary(const GEOSGeometry* g);
01541 extern GEOSGeometry GEOS_DLL *GEOSUnion(const GEOSGeometry* g1, const GEOSGeometry* g2);
01542 extern GEOSGeometry GEOS_DLL *GEOSUnaryUnion(const GEOSGeometry* g);
01543 
01544 /* @deprecated in 3.3.0: use GEOSUnaryUnion instead */
01545 extern GEOSGeometry GEOS_DLL *GEOSUnionCascaded(const GEOSGeometry* g);
01546 extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface(const GEOSGeometry* g);
01547 extern GEOSGeometry GEOS_DLL *GEOSGetCentroid(const GEOSGeometry* g);
01548 extern GEOSGeometry GEOS_DLL *GEOSNode(const GEOSGeometry* g);
01549 extern GEOSGeometry GEOS_DLL *GEOSClipByRect(const GEOSGeometry* g, double xmin, double ymin, double xmax, double ymax);
01550 
01551 /*
01552  * all arguments remain ownership of the caller
01553  * (both Geometries and pointers)
01554  */
01555 extern GEOSGeometry GEOS_DLL *GEOSPolygonize(const GEOSGeometry * const geoms[], unsigned int ngeoms);
01556 extern GEOSGeometry GEOS_DLL *GEOSPolygonizer_getCutEdges(const GEOSGeometry * const geoms[], unsigned int ngeoms);
01557 /*
01558  * Polygonizes a set of Geometries which contain linework that
01559  * represents the edges of a planar graph.
01560  *
01561  * Any dimension of Geometry is handled - the constituent linework
01562  * is extracted to form the edges.
01563  *
01564  * The edges must be correctly noded; that is, they must only meet
01565  * at their endpoints.
01566  * The Polygonizer will still run on incorrectly noded input
01567  * but will not form polygons from incorrectly noded edges.
01568  *
01569  * The Polygonizer reports the follow kinds of errors:
01570  *
01571  * - Dangles - edges which have one or both ends which are
01572  *   not incident on another edge endpoint
01573  * - Cut Edges - edges which are connected at both ends but
01574  *   which do not form part of polygon
01575  * - Invalid Ring Lines - edges which form rings which are invalid
01576  *   (e.g. the component lines contain a self-intersection)
01577  *
01578  * Errors are reported to output parameters "cuts", "dangles" and
01579  * "invalid" (if not-null). Formed polygons are returned as a
01580  * collection. NULL is returned on exception. All returned
01581  * geometries must be destroyed by caller.
01582  *
01583  */
01584 extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full(const GEOSGeometry* input,
01585     GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid);
01586 
01587 extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g);
01588 extern GEOSGeometry GEOS_DLL *GEOSSimplify(const GEOSGeometry* g, double tolerance);
01589 extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify(const GEOSGeometry* g,
01590     double tolerance);
01591 
01592 /*
01593  * Return all distinct vertices of input geometry as a MULTIPOINT.
01594  * Note that only 2 dimensions of the vertices are considered when
01595  * testing for equality.
01596  */
01597 extern GEOSGeometry GEOS_DLL *GEOSGeom_extractUniquePoints(
01598                               const GEOSGeometry* g);
01599 
01600 /*
01601  * Find paths shared between the two given lineal geometries.
01602  *
01603  * Returns a GEOMETRYCOLLECTION having two elements:
01604  * - first element is a MULTILINESTRING containing shared paths
01605  *   having the _same_ direction on both inputs
01606  * - second element is a MULTILINESTRING containing shared paths
01607  *   having the _opposite_ direction on the two inputs
01608  *
01609  * Returns NULL on exception
01610  */
01611 extern GEOSGeometry GEOS_DLL *GEOSSharedPaths(const GEOSGeometry* g1,
01612   const GEOSGeometry* g2);
01613 
01614 /*
01615  * Snap first geometry on to second with given tolerance
01616  * Returns a newly allocated geometry, or NULL on exception
01617  */
01618 extern GEOSGeometry GEOS_DLL *GEOSSnap(const GEOSGeometry* g1,
01619   const GEOSGeometry* g2, double tolerance);
01620 
01621 /*
01622  * Return a Delaunay triangulation of the vertex of the given geometry
01623  *
01624  * @param g the input geometry whose vertex will be used as "sites"
01625  * @param tolerance optional snapping tolerance to use for improved robustness
01626  * @param onlyEdges if non-zero will return a MULTILINESTRING, otherwise it will
01627  *                  return a GEOMETRYCOLLECTION containing triangular POLYGONs.
01628  *
01629  * @return  a newly allocated geometry, or NULL on exception
01630  */
01631 extern GEOSGeometry GEOS_DLL * GEOSDelaunayTriangulation(
01632                                   const GEOSGeometry *g,
01633                                   double tolerance,
01634                                   int onlyEdges);
01635 
01636 /*
01637  * Returns the Voronoi polygons of a set of Vertices given as input
01638  *
01639  * @param g the input geometry whose vertex will be used as sites.
01640  * @param tolerance snapping tolerance to use for improved robustness
01641  * @param onlyEdges whether to return only edges of the voronoi cells
01642  * @param env clipping envelope for the returned diagram, automatically
01643  *            determined if NULL.
01644  *            The diagram will be clipped to the larger
01645  *            of this envelope or an envelope surrounding the sites.
01646  *
01647  * @return a newly allocated geometry, or NULL on exception.
01648  */
01649 extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram(
01650                 const GEOSGeometry *g,
01651                 const GEOSGeometry *env,
01652                 double tolerance,
01653                 int onlyEdges);
01654 
01655 /************************************************************************
01656  *
01657  *  Binary predicates - return 2 on exception, 1 on true, 0 on false
01658  *
01659  ***********************************************************************/
01660 
01661 extern char GEOS_DLL GEOSDisjoint(const GEOSGeometry* g1, const GEOSGeometry* g2);
01662 extern char GEOS_DLL GEOSTouches(const GEOSGeometry* g1, const GEOSGeometry* g2);
01663 extern char GEOS_DLL GEOSIntersects(const GEOSGeometry* g1, const GEOSGeometry* g2);
01664 extern char GEOS_DLL GEOSCrosses(const GEOSGeometry* g1, const GEOSGeometry* g2);
01665 extern char GEOS_DLL GEOSWithin(const GEOSGeometry* g1, const GEOSGeometry* g2);
01666 extern char GEOS_DLL GEOSContains(const GEOSGeometry* g1, const GEOSGeometry* g2);
01667 extern char GEOS_DLL GEOSOverlaps(const GEOSGeometry* g1, const GEOSGeometry* g2);
01668 extern char GEOS_DLL GEOSEquals(const GEOSGeometry* g1, const GEOSGeometry* g2);
01669 extern char GEOS_DLL GEOSEqualsExact(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance);
01670 extern char GEOS_DLL GEOSCovers(const GEOSGeometry* g1, const GEOSGeometry* g2);
01671 extern char GEOS_DLL GEOSCoveredBy(const GEOSGeometry* g1, const GEOSGeometry* g2);
01672 
01673 /************************************************************************
01674  *
01675  *  Prepared Geometry Binary predicates - return 2 on exception, 1 on true, 0 on false
01676  *
01677  ***********************************************************************/
01678 
01679 /*
01680  * GEOSGeometry ownership is retained by caller
01681  */
01682 extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare(const GEOSGeometry* g);
01683 
01684 extern void GEOS_DLL GEOSPreparedGeom_destroy(const GEOSPreparedGeometry* g);
01685 
01686 extern char GEOS_DLL GEOSPreparedContains(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01687 extern char GEOS_DLL GEOSPreparedContainsProperly(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01688 extern char GEOS_DLL GEOSPreparedCoveredBy(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01689 extern char GEOS_DLL GEOSPreparedCovers(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01690 extern char GEOS_DLL GEOSPreparedCrosses(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01691 extern char GEOS_DLL GEOSPreparedDisjoint(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01692 extern char GEOS_DLL GEOSPreparedIntersects(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01693 extern char GEOS_DLL GEOSPreparedOverlaps(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01694 extern char GEOS_DLL GEOSPreparedTouches(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01695 extern char GEOS_DLL GEOSPreparedWithin(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
01696 
01697 /************************************************************************
01698  *
01699  *  STRtree functions
01700  *
01701  ***********************************************************************/
01702 
01703 /*
01704  * GEOSGeometry ownership is retained by caller
01705  */
01706 
01707 /*
01708  * Create a new R-tree using the Sort-Tile-Recursive algorithm (STRtree) for two-dimensional
01709  * spatial data.
01710  *
01711  * @param nodeCapacity the maximum number of child nodes that a node may have.  The minimum
01712  *            recommended capacity value is 4.  If unsure, use a default node capacity of 10.
01713  * @return a pointer to the created tree
01714  */
01715 extern GEOSSTRtree GEOS_DLL *GEOSSTRtree_create(size_t nodeCapacity);
01716 
01717 /*
01718  * Insert an item into an STRtree
01719  *
01720  * @param tree the STRtree in which the item should be inserted
01721  * @param g a GEOSGeometry whose envelope corresponds to the extent of 'item'
01722  * @param item the item to insert into the tree
01723  */
01724 extern void GEOS_DLL GEOSSTRtree_insert(GEOSSTRtree *tree,
01725                                         const GEOSGeometry *g,
01726                                         void *item);
01727 
01728 /*
01729  * Query an STRtree for items intersecting a specified envelope
01730  *
01731  * @param tree the STRtree to search
01732  * @param g a GEOSGeomety from which a query envelope will be extracted
01733  * @param callback a function to be executed for each item in the tree whose envelope intersects
01734  *            the envelope of 'g'.  The callback function should take two parameters: a void
01735  *            pointer representing the located item in the tree, and a void userdata pointer.
01736  * @param userdata an optional pointer to pe passed to 'callback' as an argument
01737  */
01738 extern void GEOS_DLL GEOSSTRtree_query(GEOSSTRtree *tree,
01739                                        const GEOSGeometry *g,
01740                                        GEOSQueryCallback callback,
01741                                        void *userdata);
01742 /*
01743  * Returns the nearest item in the STRtree to the supplied GEOSGeometry.
01744  * All items in the tree MUST be of type GEOSGeometry.  If this is not the case, use
01745  * GEOSSTRtree_nearest_generic instead.
01746 *
01747  * @param tree the STRtree to search
01748  * @param geom the geometry with which the tree should be queried
01749  * @return a const pointer to the nearest GEOSGeometry in the tree to 'geom', or NULL in
01750  *            case of exception
01751  */
01752 extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest(GEOSSTRtree *tree, const GEOSGeometry* geom);
01753 
01754 /*
01755  * Returns the nearest item in the STRtree to the supplied item
01756  *
01757  * @param tree the STRtree to search
01758  * @param item the item with which the tree should be queried
01759  * @param itemEnvelope a GEOSGeometry having the bounding box of 'item'
01760  * @param distancefn a function that can compute the distance between two items
01761  *            in the STRtree.  The function should return zero in case of error,
01762  *            and should store the computed distance to the location pointed to by
01763  *            the 'distance' argument.  The computed distance between two items
01764  *            must not exceed the Cartesian distance between their envelopes.
01765  * @param userdata optional pointer to arbitrary data; will be passed to distancefn
01766  *            each time it is called.
01767  * @return a const pointer to the nearest item in the tree to 'item', or NULL in
01768  *            case of exception
01769  */
01770 extern const void GEOS_DLL *GEOSSTRtree_nearest_generic(GEOSSTRtree *tree,
01771                                                         const void* item,
01772                                                         const GEOSGeometry* itemEnvelope,
01773                                                         GEOSDistanceCallback distancefn,
01774                                                         void* userdata);
01775 /*
01776  * Iterates over all items in the STRtree
01777  *
01778  * @param tree the STRtree over which to iterate
01779  * @param callback a function to be executed for each item in the tree.
01780  */
01781 extern void GEOS_DLL GEOSSTRtree_iterate(GEOSSTRtree *tree,
01782                                        GEOSQueryCallback callback,
01783                                        void *userdata);
01784 
01785 /*
01786  * Removes an item from the STRtree
01787  *
01788  * @param tree the STRtree from which to remove an item
01789  * @param g the envelope of the item to remove
01790  * @param the item to remove
01791  * @return 0 if the item was not removed;
01792  *         1 if the item was removed;
01793  *         2 if an exception occurred
01794  */
01795 extern char GEOS_DLL GEOSSTRtree_remove(GEOSSTRtree *tree,
01796                                         const GEOSGeometry *g,
01797                                         void *item);
01798 extern void GEOS_DLL GEOSSTRtree_destroy(GEOSSTRtree *tree);
01799 
01800 
01801 /************************************************************************
01802  *
01803  *  Unary predicate - return 2 on exception, 1 on true, 0 on false
01804  *
01805  ***********************************************************************/
01806 
01807 extern char GEOS_DLL GEOSisEmpty(const GEOSGeometry* g);
01808 extern char GEOS_DLL GEOSisSimple(const GEOSGeometry* g);
01809 extern char GEOS_DLL GEOSisRing(const GEOSGeometry* g);
01810 extern char GEOS_DLL GEOSHasZ(const GEOSGeometry* g);
01811 extern char GEOS_DLL GEOSisClosed(const GEOSGeometry *g);
01812 
01813 /************************************************************************
01814  *
01815  *  Dimensionally Extended 9 Intersection Model related
01816  *
01817  ***********************************************************************/
01818 
01819 /* return 2 on exception, 1 on true, 0 on false */
01820 extern char GEOS_DLL GEOSRelatePattern(const GEOSGeometry* g1, const GEOSGeometry* g2, const char *pat);
01821 
01822 /* return NULL on exception, a string to GEOSFree otherwise */
01823 extern char GEOS_DLL *GEOSRelate(const GEOSGeometry* g1, const GEOSGeometry* g2);
01824 
01825 /* return 2 on exception, 1 on true, 0 on false */
01826 extern char GEOS_DLL GEOSRelatePatternMatch(const char *mat, const char *pat);
01827 
01828 /* return NULL on exception, a string to GEOSFree otherwise */
01829 extern char GEOS_DLL *GEOSRelateBoundaryNodeRule(const GEOSGeometry* g1,
01830                                                  const GEOSGeometry* g2,
01831                                                  int bnr);
01832 
01833 /************************************************************************
01834  *
01835  *  Validity checking
01836  *
01837  ***********************************************************************/
01838 
01839 /* return 2 on exception, 1 on true, 0 on false */
01840 extern char GEOS_DLL GEOSisValid(const GEOSGeometry* g);
01841 
01842 /* return NULL on exception, a string to GEOSFree otherwise */
01843 extern char GEOS_DLL *GEOSisValidReason(const GEOSGeometry *g);
01844 /*
01845  * Caller has the responsibility to destroy 'reason' (GEOSFree)
01846  * and 'location' (GEOSGeom_destroy) params
01847  * return 2 on exception, 1 when valid, 0 when invalid
01848  * Use enum GEOSValidFlags values for the flags param.
01849  */
01850 extern char GEOS_DLL GEOSisValidDetail(const GEOSGeometry* g,
01851                                        int flags,
01852                                        char** reason, GEOSGeometry** location);
01853 
01854 /************************************************************************
01855  *
01856  *  Geometry info
01857  *
01858  ***********************************************************************/
01859 
01860 /* Return NULL on exception, result must be freed by caller. */
01861 extern char GEOS_DLL *GEOSGeomType(const GEOSGeometry* g);
01862 
01863 /* Return -1 on exception */
01864 extern int GEOS_DLL GEOSGeomTypeId(const GEOSGeometry* g);
01865 
01866 /* Return 0 on exception */
01867 extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g);
01868 
01869 extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
01870 
01871 extern void GEOS_DLL *GEOSGeom_getUserData(const GEOSGeometry* g);
01872 
01873 extern void GEOS_DLL GEOSGeom_setUserData(GEOSGeometry* g, void* userData);
01874 
01875 
01876 /* May be called on all geometries in GEOS 3.x, returns -1 on error and 1
01877  * for non-multi geometries. Older GEOS versions only accept
01878  * GeometryCollections or Multi* geometries here, and are likely to crash
01879  * when fed simple geometries, so beware if you need compatibility with
01880  * old GEOS versions.
01881  */
01882 extern int GEOS_DLL GEOSGetNumGeometries(const GEOSGeometry* g);
01883 
01884 /*
01885  * Return NULL on exception.
01886  * Returned object is a pointer to internal storage:
01887  * it must NOT be destroyed directly.
01888  * Up to GEOS 3.2.0 the input geometry must be a Collection, in
01889  * later version it doesn't matter (getGeometryN(0) for a single will
01890  * return the input).
01891  */
01892 extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN(const GEOSGeometry* g, int n);
01893 
01894 /* Return -1 on exception */
01895 extern int GEOS_DLL GEOSNormalize(GEOSGeometry* g);
01896 
01897 /* Return NULL on exception */
01898 extern GEOSGeometry GEOS_DLL *GEOSGeom_setPrecision(
01899         const GEOSGeometry *g, double gridSize, int flags);
01900 
01901 /* Return -1 on exception */
01902 extern double GEOS_DLL GEOSGeom_getPrecision(const GEOSGeometry *g);
01903 
01904 /* Return -1 on exception */
01905 extern int GEOS_DLL GEOSGetNumInteriorRings(const GEOSGeometry* g);
01906 
01907 /* Return -1 on exception, Geometry must be a LineString. */
01908 extern int GEOS_DLL GEOSGeomGetNumPoints(const GEOSGeometry* g);
01909 
01910 /* Return -1 on exception, Geometry must be a Point. */
01911 extern int GEOS_DLL GEOSGeomGetX(const GEOSGeometry *g, double *x);
01912 extern int GEOS_DLL GEOSGeomGetY(const GEOSGeometry *g, double *y);
01913 
01914 /*
01915  * Return NULL on exception, Geometry must be a Polygon.
01916  * Returned object is a pointer to internal storage:
01917  * it must NOT be destroyed directly.
01918  */
01919 extern const GEOSGeometry GEOS_DLL *GEOSGetInteriorRingN(const GEOSGeometry* g, int n);
01920 
01921 /*
01922  * Return NULL on exception, Geometry must be a Polygon.
01923  * Returned object is a pointer to internal storage:
01924  * it must NOT be destroyed directly.
01925  */
01926 extern const GEOSGeometry GEOS_DLL *GEOSGetExteriorRing(const GEOSGeometry* g);
01927 
01928 /* Return -1 on exception */
01929 extern int GEOS_DLL GEOSGetNumCoordinates(const GEOSGeometry* g);
01930 
01931 /*
01932  * Return NULL on exception.
01933  * Geometry must be a LineString, LinearRing or Point.
01934  */
01935 extern const GEOSCoordSequence GEOS_DLL *GEOSGeom_getCoordSeq(const GEOSGeometry* g);
01936 
01937 /*
01938  * Return 0 on exception (or empty geometry)
01939  */
01940 extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g);
01941 
01942 /*
01943  * Return 2 or 3.
01944  */
01945 extern int GEOS_DLL GEOSGeom_getCoordinateDimension(const GEOSGeometry* g);
01946 
01947 /*
01948  * Return NULL on exception.
01949  * Must be LineString and must be freed by called.
01950  */
01951 extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN(const GEOSGeometry *g, int n);
01952 extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint(const GEOSGeometry *g);
01953 extern GEOSGeometry GEOS_DLL *GEOSGeomGetEndPoint(const GEOSGeometry *g);
01954 
01955 /************************************************************************
01956  *
01957  *  Misc functions
01958  *
01959  ***********************************************************************/
01960 
01961 /* Return 0 on exception, 1 otherwise */
01962 extern int GEOS_DLL GEOSArea(const GEOSGeometry* g, double *area);
01963 extern int GEOS_DLL GEOSLength(const GEOSGeometry* g, double *length);
01964 extern int GEOS_DLL GEOSDistance(const GEOSGeometry* g1, const GEOSGeometry* g2,
01965     double *dist);
01966 extern int GEOS_DLL GEOSHausdorffDistance(const GEOSGeometry *g1,
01967         const GEOSGeometry *g2, double *dist);
01968 extern int GEOS_DLL GEOSHausdorffDistanceDensify(const GEOSGeometry *g1,
01969         const GEOSGeometry *g2, double densifyFrac, double *dist);
01970 extern int GEOS_DLL GEOSGeomGetLength(const GEOSGeometry *g, double *length);
01971 
01972 /* Return 0 on exception, the closest points of the two geometries otherwise.
01973  * The first point comes from g1 geometry and the second point comes from g2.
01974  */
01975 extern GEOSCoordSequence GEOS_DLL *GEOSNearestPoints(
01976   const GEOSGeometry* g1, const GEOSGeometry* g2);
01977 
01978 
01979 /************************************************************************
01980  *
01981  * Algorithms
01982  *
01983  ***********************************************************************/
01984 
01985 /* Walking from A to B:
01986  *  return -1 if reaching P takes a counter-clockwise (left) turn
01987  *  return  1 if reaching P takes a clockwise (right) turn
01988  *  return  0 if P is collinear with A-B
01989  *
01990  * On exceptions, return 2.
01991  *
01992  */
01993 extern int GEOS_DLL GEOSOrientationIndex(double Ax, double Ay, double Bx, double By,
01994     double Px, double Py);
01995 
01996 /************************************************************************
01997  *
01998  * Reader and Writer APIs
01999  *
02000  ***********************************************************************/
02001 
02002 /* WKT Reader */
02003 extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create();
02004 extern void GEOS_DLL GEOSWKTReader_destroy(GEOSWKTReader* reader);
02005 extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read(GEOSWKTReader* reader, const char *wkt);
02006 
02007 /* WKT Writer */
02008 extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create();
02009 extern void GEOS_DLL GEOSWKTWriter_destroy(GEOSWKTWriter* writer);
02010 extern char GEOS_DLL *GEOSWKTWriter_write(GEOSWKTWriter* writer, const GEOSGeometry* g);
02011 extern void GEOS_DLL GEOSWKTWriter_setTrim(GEOSWKTWriter *writer, char trim);
02012 extern void GEOS_DLL GEOSWKTWriter_setRoundingPrecision(GEOSWKTWriter *writer, int precision);
02013 extern void GEOS_DLL GEOSWKTWriter_setOutputDimension(GEOSWKTWriter *writer, int dim);
02014 extern int  GEOS_DLL GEOSWKTWriter_getOutputDimension(GEOSWKTWriter *writer);
02015 extern void GEOS_DLL GEOSWKTWriter_setOld3D(GEOSWKTWriter *writer, int useOld3D);
02016 
02017 /* WKB Reader */
02018 extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create();
02019 extern void GEOS_DLL GEOSWKBReader_destroy(GEOSWKBReader* reader);
02020 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read(GEOSWKBReader* reader, const unsigned char *wkb, size_t size);
02021 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_readHEX(GEOSWKBReader* reader, const unsigned char *hex, size_t size);
02022 
02023 /* WKB Writer */
02024 extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create();
02025 extern void GEOS_DLL GEOSWKBWriter_destroy(GEOSWKBWriter* writer);
02026 
02027 /* The caller owns the results for these two methods! */
02028 extern unsigned char GEOS_DLL *GEOSWKBWriter_write(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
02029 extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
02030 
02031 /*
02032  * Specify whether output WKB should be 2d or 3d.
02033  * Return previously set number of dimensions.
02034  */
02035 extern int GEOS_DLL GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer);
02036 extern void GEOS_DLL GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension);
02037 
02038 /*
02039  * Specify whether the WKB byte order is big or little endian.
02040  * The return value is the previous byte order.
02041  */
02042 extern int GEOS_DLL GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer);
02043 extern void GEOS_DLL GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int byteOrder);
02044 
02045 /*
02046  * Specify whether SRID values should be output.
02047  */
02048 extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer);
02049 extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char writeSRID);
02050 
02051 /*
02052  * Free buffers returned by stuff like GEOSWKBWriter_write(),
02053  * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write().
02054  */
02055 extern void GEOS_DLL GEOSFree(void *buffer);
02056 
02057 #endif /* #ifndef GEOS_USE_ONLY_R_API */
02058 
02059 
02060 #ifdef __cplusplus
02061 } // extern "C"
02062 #endif
02063 
02064 #endif /* #ifndef GEOS_C_H_INCLUDED */