00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef GEOS_C_H_INCLUDED
00031 #define GEOS_C_H_INCLUDED
00032
00033 #ifndef __cplusplus
00034 # include <stddef.h>
00035 #endif
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #if defined(_MSC_VER)
00052 #include <geos/version.h>
00053 #define GEOS_CAPI_VERSION_MAJOR 1
00054 #define GEOS_CAPI_VERSION_MINOR 5
00055 #define GEOS_CAPI_VERSION_PATCH 0
00056 #define GEOS_CAPI_VERSION "3.1.0-CAPI-1.5.0"
00057 #else
00058 #ifndef GEOS_VERSION_MAJOR
00059 #define GEOS_VERSION_MAJOR 3
00060 #endif
00061 #ifndef GEOS_VERSION_MINOR
00062 #define GEOS_VERSION_MINOR 1
00063 #endif
00064 #ifndef GEOS_VERSION_PATCH
00065 #define GEOS_VERSION_PATCH 0
00066 #endif
00067 #ifndef GEOS_VERSION
00068 #define GEOS_VERSION "3.1.0"
00069 #endif
00070 #ifndef GEOS_JTS_PORT
00071 #define GEOS_JTS_PORT "1.7.1"
00072 #endif
00073
00074 #define GEOS_CAPI_VERSION_MAJOR 1
00075 #define GEOS_CAPI_VERSION_MINOR 5
00076 #define GEOS_CAPI_VERSION_PATCH 0
00077 #define GEOS_CAPI_VERSION "3.1.0-CAPI-1.5.0"
00078 #endif
00079
00080 #define GEOS_CAPI_FIRST_INTERFACE GEOS_CAPI_VERSION_MAJOR
00081 #define GEOS_CAPI_LAST_INTERFACE (GEOS_CAPI_VERSION_MAJOR+GEOS_CAPI_VERSION_MINOR)
00082
00083
00084
00085
00086
00087
00088
00089 typedef void (*GEOSMessageHandler)(const char *fmt, ...);
00090
00091
00092
00093
00094
00095
00096
00097 #ifndef GEOSGeometry
00098 typedef struct GEOSGeom_t GEOSGeometry;
00099 typedef struct GEOSPrepGeom_t GEOSPreparedGeometry;
00100 typedef struct GEOSCoordSeq_t GEOSCoordSequence;
00101 #endif
00102
00103
00104
00105
00106 typedef GEOSGeometry* GEOSGeom;
00107 typedef GEOSCoordSequence* GEOSCoordSeq;
00108
00109
00110
00111
00112
00113
00114 enum GEOSGeomTypes {
00115 GEOS_POINT,
00116 GEOS_LINESTRING,
00117 GEOS_LINEARRING,
00118 GEOS_POLYGON,
00119 GEOS_MULTIPOINT,
00120 GEOS_MULTILINESTRING,
00121 GEOS_MULTIPOLYGON,
00122 GEOS_GEOMETRYCOLLECTION
00123 };
00124
00125
00126 enum GEOSByteOrders {
00127 GEOS_WKB_XDR = 0,
00128 GEOS_WKB_NDR = 1
00129 };
00130
00131
00132
00133
00134
00135
00136
00137
00138 #if defined(_MSC_VER)
00139 # define GEOS_DLL __declspec(dllexport)
00140 #else
00141 # define GEOS_DLL
00142 #endif
00143
00144 extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
00145 GEOSMessageHandler error_function);
00146 extern void GEOS_DLL finishGEOS(void);
00147 extern const char GEOS_DLL *GEOSversion();
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT(const char *wkt);
00158 extern char GEOS_DLL *GEOSGeomToWKT(const GEOSGeometry* g);
00159
00160
00161
00162
00163
00164 extern int GEOS_DLL GEOS_getWKBOutputDims();
00165 extern int GEOS_DLL GEOS_setWKBOutputDims(int newDims);
00166
00167
00168
00169
00170
00171 extern int GEOS_DLL GEOS_getWKBByteOrder();
00172 extern int GEOS_DLL GEOS_setWKBByteOrder(int byteOrder);
00173
00174 extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf(const unsigned char *wkb, size_t size);
00175 extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf(const GEOSGeometry* g, size_t *size);
00176
00177 extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf(const unsigned char *hex, size_t size);
00178 extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf(const GEOSGeometry* g, size_t *size);
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_create(unsigned int size, unsigned int dims);
00192
00193
00194
00195
00196
00197 extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_clone(const GEOSCoordSequence* s);
00198
00199
00200
00201
00202 extern void GEOS_DLL GEOSCoordSeq_destroy(GEOSCoordSequence* s);
00203
00204
00205
00206
00207
00208 extern int GEOS_DLL GEOSCoordSeq_setX(GEOSCoordSequence* s,
00209 unsigned int idx, double val);
00210 extern int GEOS_DLL GEOSCoordSeq_setY(GEOSCoordSequence* s,
00211 unsigned int idx, double val);
00212 extern int GEOS_DLL GEOSCoordSeq_setZ(GEOSCoordSequence* s,
00213 unsigned int idx, double val);
00214 extern int GEOS_DLL GEOSCoordSeq_setOrdinate(GEOSCoordSequence* s,
00215 unsigned int idx, unsigned int dim, double val);
00216
00217
00218
00219
00220
00221 extern int GEOS_DLL GEOSCoordSeq_getX(const GEOSCoordSequence* s,
00222 unsigned int idx, double *val);
00223 extern int GEOS_DLL GEOSCoordSeq_getY(const GEOSCoordSequence* s,
00224 unsigned int idx, double *val);
00225 extern int GEOS_DLL GEOSCoordSeq_getZ(const GEOSCoordSequence* s,
00226 unsigned int idx, double *val);
00227 extern int GEOS_DLL GEOSCoordSeq_getOrdinate(const GEOSCoordSequence* s,
00228 unsigned int idx, unsigned int dim, double *val);
00229
00230
00231
00232
00233
00234 extern int GEOS_DLL GEOSCoordSeq_getSize(const GEOSCoordSequence* s,
00235 unsigned int *size);
00236 extern int GEOS_DLL GEOSCoordSeq_getDimensions(const GEOSCoordSequence* s,
00237 unsigned int *dims);
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint(GEOSCoordSequence* s);
00249 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing(GEOSCoordSequence* s);
00250 extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString(GEOSCoordSequence* s);
00251
00252
00253
00254
00255
00256
00257 extern GEOSGeometry GEOS_DLL *GEOSGeom_createPolygon(GEOSGeometry* shell,
00258 GEOSGeometry** holes, unsigned int nholes);
00259 extern GEOSGeometry GEOS_DLL *GEOSGeom_createCollection(int type,
00260 GEOSGeometry* *geoms, unsigned int ngeoms);
00261
00262 extern GEOSGeometry GEOS_DLL *GEOSGeom_clone(const GEOSGeometry* g);
00263
00264
00265
00266
00267
00268
00269
00270 extern void GEOS_DLL GEOSGeom_destroy(GEOSGeometry* g);
00271
00272
00273
00274
00275
00276
00277
00278
00279 extern GEOSGeometry GEOS_DLL *GEOSEnvelope(const GEOSGeometry* g1);
00280 extern GEOSGeometry GEOS_DLL *GEOSIntersection(const GEOSGeometry* g1, const GEOSGeometry* g2);
00281 extern GEOSGeometry GEOS_DLL *GEOSBuffer(const GEOSGeometry* g1,
00282 double width, int quadsegs);
00283 extern GEOSGeometry GEOS_DLL *GEOSConvexHull(const GEOSGeometry* g1);
00284 extern GEOSGeometry GEOS_DLL *GEOSDifference(const GEOSGeometry* g1, const GEOSGeometry* g2);
00285 extern GEOSGeometry GEOS_DLL *GEOSSymDifference(const GEOSGeometry* g1,
00286 const GEOSGeometry* g2);
00287 extern GEOSGeometry GEOS_DLL *GEOSBoundary(const GEOSGeometry* g1);
00288 extern GEOSGeometry GEOS_DLL *GEOSUnion(const GEOSGeometry* g1, const GEOSGeometry* g2);
00289 extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface(const GEOSGeometry* g1);
00290 extern GEOSGeometry GEOS_DLL *GEOSGetCentroid(const GEOSGeometry* g);
00291 extern char GEOS_DLL *GEOSRelate(const GEOSGeometry* g1, const GEOSGeometry* g2);
00292
00293
00294
00295
00296
00297 extern GEOSGeometry GEOS_DLL *GEOSPolygonize(const GEOSGeometry * const geoms[], unsigned int ngeoms);
00298 extern GEOSGeometry GEOS_DLL *GEOSPolygonizer_getCutEdges(const GEOSGeometry * const geoms[], unsigned int ngeoms);
00299
00300 extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g);
00301 extern GEOSGeometry GEOS_DLL *GEOSSimplify(const GEOSGeometry* g1, double tolerance);
00302 extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify(const GEOSGeometry* g1,
00303 double tolerance);
00304
00305
00306
00307
00308
00309
00310
00311 extern char GEOS_DLL GEOSRelatePattern(const GEOSGeometry* g1, const GEOSGeometry* g2,
00312 const char *pat);
00313 extern char GEOS_DLL GEOSDisjoint(const GEOSGeometry* g1, const GEOSGeometry* g2);
00314 extern char GEOS_DLL GEOSTouches(const GEOSGeometry* g1, const GEOSGeometry* g2);
00315 extern char GEOS_DLL GEOSIntersects(const GEOSGeometry* g1, const GEOSGeometry* g2);
00316 extern char GEOS_DLL GEOSCrosses(const GEOSGeometry* g1, const GEOSGeometry* g2);
00317 extern char GEOS_DLL GEOSWithin(const GEOSGeometry* g1, const GEOSGeometry* g2);
00318 extern char GEOS_DLL GEOSContains(const GEOSGeometry* g1, const GEOSGeometry* g2);
00319 extern char GEOS_DLL GEOSOverlaps(const GEOSGeometry* g1, const GEOSGeometry* g2);
00320 extern char GEOS_DLL GEOSEquals(const GEOSGeometry* g1, const GEOSGeometry* g2);
00321 extern char GEOS_DLL GEOSEqualsExact(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance);
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333 extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare(const GEOSGeometry* g);
00334
00335 extern void GEOS_DLL GEOSPreparedGeom_destroy(GEOSPreparedGeometry* g);
00336
00337 extern char GEOS_DLL GEOSPreparedContains(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
00338 extern char GEOS_DLL GEOSPreparedContainsProperly(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
00339 extern char GEOS_DLL GEOSPreparedCovers(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
00340 extern char GEOS_DLL GEOSPreparedIntersects(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2);
00341
00342
00343
00344
00345
00346
00347
00348
00349 extern char GEOS_DLL GEOSisEmpty(const GEOSGeometry* g1);
00350 extern char GEOS_DLL GEOSisValid(const GEOSGeometry* g1);
00351 extern char GEOS_DLL GEOSisSimple(const GEOSGeometry* g1);
00352 extern char GEOS_DLL GEOSisRing(const GEOSGeometry* g1);
00353 extern char GEOS_DLL GEOSHasZ(const GEOSGeometry* g1);
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 extern char GEOS_DLL *GEOSGeomType(const GEOSGeometry* g1);
00364
00365
00366 extern int GEOS_DLL GEOSGeomTypeId(const GEOSGeometry* g1);
00367
00368
00369 extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g1);
00370
00371 extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID);
00372
00373
00374
00375
00376
00377
00378
00379 extern int GEOS_DLL GEOSGetNumGeometries(const GEOSGeometry* g1);
00380
00381
00382
00383
00384
00385
00386 extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN(const GEOSGeometry* g, int n);
00387
00388
00389 extern int GEOS_DLL GEOSNormalize(GEOSGeometry* g1);
00390
00391
00392 extern int GEOS_DLL GEOSGetNumInteriorRings(const GEOSGeometry* g1);
00393
00394
00395
00396
00397
00398
00399 extern const GEOSGeometry GEOS_DLL *GEOSGetInteriorRingN(const GEOSGeometry* g, int n);
00400
00401
00402
00403
00404
00405
00406 extern const GEOSGeometry GEOS_DLL *GEOSGetExteriorRing(const GEOSGeometry* g);
00407
00408
00409 extern int GEOS_DLL GEOSGetNumCoordinates(const GEOSGeometry* g1);
00410
00411
00412
00413
00414
00415 extern const GEOSCoordSequence GEOS_DLL *GEOSGeom_getCoordSeq(const GEOSGeometry* g);
00416
00417
00418
00419
00420 extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g);
00421
00422
00423
00424
00425
00426
00427
00428
00429 extern int GEOS_DLL GEOSArea(const GEOSGeometry* g1, double *area);
00430 extern int GEOS_DLL GEOSLength(const GEOSGeometry* g1, double *length);
00431 extern int GEOS_DLL GEOSDistance(const GEOSGeometry* g1, const GEOSGeometry* g2,
00432 double *dist);
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442 typedef struct GEOSWKTReader_t GEOSWKTReader;
00443 typedef struct GEOSWKTWriter_t GEOSWKTWriter;
00444 typedef struct GEOSWKBReader_t GEOSWKBReader;
00445 typedef struct GEOSWKBWriter_t GEOSWKBWriter;
00446
00447
00448
00449 extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create();
00450 extern void GEOS_DLL GEOSWKTReader_destroy(GEOSWKTReader* reader);
00451 extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read(GEOSWKTReader* reader, const char *wkt);
00452
00453
00454 extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create();
00455 extern void GEOS_DLL GEOSWKTWriter_destroy(GEOSWKTWriter* writer);
00456 extern char GEOS_DLL *GEOSWKTWriter_write(GEOSWKTWriter* reader, const GEOSGeometry* g);
00457
00458
00459 extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create();
00460 extern void GEOS_DLL GEOSWKBReader_destroy(GEOSWKBReader* reader);
00461 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read(GEOSWKBReader* reader, const unsigned char *wkb, size_t size);
00462 extern GEOSGeometry GEOS_DLL *GEOSWKBReader_readHEX(GEOSWKBReader* reader, const unsigned char *hex, size_t size);
00463
00464
00465 extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create();
00466 extern void GEOS_DLL GEOSWKBWriter_destroy(GEOSWKBWriter* writer);
00467
00468
00469 extern unsigned char GEOS_DLL *GEOSWKBWriter_write(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
00470 extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size);
00471
00472
00473
00474
00475
00476 extern int GEOS_DLL GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer);
00477 extern void GEOS_DLL GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension);
00478
00479
00480
00481
00482
00483 extern int GEOS_DLL GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer);
00484 extern void GEOS_DLL GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int byteOrder);
00485
00486
00487
00488
00489 extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer);
00490 extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char writeSRID);
00491
00492
00493
00494
00495 #ifdef __cplusplus
00496 }
00497 #endif
00498
00499 #endif