@@ -22,15 +22,11 @@ email : morb at ozemail dot com dot au
22
22
23
23
#include " qgis.h"
24
24
25
- #include < geos/version.h>
26
- #if GEOS_VERSION_MAJOR < 3
27
- #include < geos/geom.h>
28
- #define GEOS_GEOM geos
29
- #else
30
- #include < geos/geom/CoordinateSequence.h>
31
- #include < geos/geom/Geometry.h>
32
- #include < geos/geom/LineString.h>
33
- #define GEOS_GEOM geos::geom
25
+ #include < geos_c.h>
26
+
27
+ #if GEOS_VERSION_MAJOR<3
28
+ #define GEOSGeometry struct GEOSGeom_t
29
+ #define GEOSCoordSequence struct GEOSCoordSeq_t
34
30
#endif
35
31
36
32
#include " qgspoint.h"
@@ -66,11 +62,9 @@ class QgsRect;
66
62
* @author Brendan Morley
67
63
*/
68
64
69
- class CORE_EXPORT QgsGeometry {
70
-
65
+ class CORE_EXPORT QgsGeometry
66
+ {
71
67
public:
72
-
73
-
74
68
// ! Constructor
75
69
QgsGeometry ();
76
70
@@ -125,7 +119,7 @@ class CORE_EXPORT QgsGeometry {
125
119
Set the geometry, feeding in a geometry in GEOS format.
126
120
This class will take ownership of the buffer.
127
121
*/
128
- void setGeos (GEOS_GEOM::Geometry * geos);
122
+ void setGeos (GEOSGeometry * geos);
129
123
130
124
/* *
131
125
Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length.
@@ -230,8 +224,8 @@ and the indices of the vertices before/after. The vertices before/after are -1 i
230
224
int addRing (const QList<QgsPoint>& ring);
231
225
232
226
/* *Adds a new island polygon to a multipolygon feature
233
- @return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring \
234
- not disjoint with existing polygons of the feature*/
227
+ @return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
228
+ not disjoint with existing polygons of the feature*/
235
229
int addIsland (const QList<QgsPoint>& ring);
236
230
237
231
/* *Translate this geometry by dx, dy
@@ -285,7 +279,6 @@ not disjoint with existing polygons of the feature*/
285
279
*/
286
280
QString exportToWkt ();
287
281
288
-
289
282
/* Accessor functions for getting geometry data */
290
283
291
284
/* * return contents of the geometry as a point
@@ -312,9 +305,7 @@ not disjoint with existing polygons of the feature*/
312
305
if wkbType is WKBPolygon, otherwise an empty list */
313
306
QgsMultiPolygon asMultiPolygon ();
314
307
315
- private:
316
-
317
-
308
+ private:
318
309
// Private variables
319
310
320
311
// All of these are mutable since there may be on-the-fly
@@ -331,7 +322,7 @@ not disjoint with existing polygons of the feature*/
331
322
size_t mGeometrySize ;
332
323
333
324
/* * cached GEOS version of this geometry */
334
- GEOS_GEOM::Geometry * mGeos ;
325
+ GEOSGeometry * mGeos ;
335
326
336
327
/* * If the geometry has been set since the last conversion to WKB **/
337
328
bool mDirtyWkb ;
@@ -360,8 +351,6 @@ not disjoint with existing polygons of the feature*/
360
351
*/
361
352
bool exportGeosToWkb ();
362
353
363
-
364
-
365
354
/* * Insert a new vertex before the given vertex index (first number is index 0)
366
355
* in the given GEOS Coordinate Sequence.
367
356
* If the requested vertex number is greater
@@ -374,8 +363,8 @@ not disjoint with existing polygons of the feature*/
374
363
*/
375
364
bool insertVertexBefore (double x, double y,
376
365
int beforeVertex,
377
- const GEOS_GEOM::CoordinateSequence * old_sequence,
378
- GEOS_GEOM::CoordinateSequence ** new_sequence);
366
+ const GEOSCoordSequence * old_sequence,
367
+ GEOSCoordSequence ** new_sequence);
379
368
380
369
/* *Converts single type geometry into multitype geometry
381
370
e.g. a polygon into a multipolygon geometry with one polygon
@@ -396,18 +385,18 @@ not disjoint with existing polygons of the feature*/
396
385
@splitLine the line that splits the feature
397
386
@newGeometry new geometry if splitting was successful
398
387
@return 0 in case of success, 1 if geometry has not been split, error else*/
399
- int splitLinearGeometry (GEOS_GEOM::LineString* splitLine, QList<QgsGeometry*>& newGeometries);
388
+ int splitLinearGeometry (GEOSGeometry * splitLine, QList<QgsGeometry*>& newGeometries);
400
389
/* *Splits polygon/multipolygon geometries
401
390
@return 0 in case of success, 1 if geometry has not been split, error else*/
402
- int splitPolygonGeometry (GEOS_GEOM::LineString* splitLine, QList<QgsGeometry*>& newGeometries);
391
+ int splitPolygonGeometry (GEOSGeometry * splitLine, QList<QgsGeometry*>& newGeometries);
403
392
/* *Finds the vertices next to point where the line is split. If it is split at a vertex, beforeVertex
404
393
and afterVertex are the same*/
405
394
406
395
/* *Nodes together a split line and a (multi-) polygon geometry in a multilinestring
407
396
@return the noded multiline geometry or 0 in case of error. The calling function takes ownership of the node geometry*/
408
- GEOS_GEOM::Geometry * nodeGeometries (const GEOS_GEOM::LineString* splitLine, const GEOS_GEOM::Geometry* poly) const ;
397
+ GEOSGeometry * nodeGeometries (const GEOSGeometry * splitLine, GEOSGeometry * poly) const ;
409
398
410
- int mergeGeometriesMultiTypeSplit (QList<GEOS_GEOM::Geometry *>& splitResult);
399
+ int mergeGeometriesMultiTypeSplit (QVector<GEOSGeometry *>& splitResult);
411
400
412
401
/* * return point from wkb */
413
402
QgsPoint asPoint (unsigned char *& ptr, bool hasZValue);
@@ -418,6 +407,7 @@ not disjoint with existing polygons of the feature*/
418
407
/* * return polygon from wkb */
419
408
QgsPolygon asPolygon (unsigned char *& ptr, bool hasZValue);
420
409
410
+ static int refcount;
421
411
}; // class QgsGeometry
422
412
423
413
#endif
0 commit comments