@@ -27,15 +27,23 @@ email : morb at ozemail dot com dot au
27
27
#if GEOS_VERSION_MAJOR < 3
28
28
#define GEOS_GEOM geos
29
29
#define GEOS_IO geos
30
+ #define GEOS_LINEMERGE geos
31
+ #define GEOS_POLYGONIZE geos
30
32
#define GEOS_UTIL geos
31
33
#define GEOS_SIZE_T int
32
34
#define COORD_SEQ_FACTORY DefaultCoordinateSequenceFactory
35
+ #include " geos/opPolygonize.h"
36
+ #include " geos/opLinemerge.h"
33
37
#else
34
38
#define GEOS_GEOM geos::geom
35
39
#define GEOS_IO geos::io
40
+ #define GEOS_LINEMERGE geos::operation::linemerge
41
+ #define GEOS_POLYGONIZE geos::operation::polygonize
36
42
#define GEOS_UTIL geos::util
37
43
#define GEOS_SIZE_T size_t
38
44
#define COORD_SEQ_FACTORY CoordinateArraySequenceFactory
45
+ #include " geos/operation/polygonize/Polygonizer.h"
46
+ #include " geos/operation/linemerge/LineMerger.h"
39
47
#endif
40
48
41
49
#include " qgspoint.h"
@@ -256,10 +264,7 @@ not disjoint with existing polygons of the feature*/
256
264
between geometry and splitLine, only the first one is considered.
257
265
@param splitLine the line that splits the geometry
258
266
@param newGeometrys OUT: list of new geometries that have been created with the split
259
- @return 0 in case of success, which means the geometry has been split in two parts, \
260
- 1 if line intersects multiple times but only one split could be done, \
261
- 2 if intersection too complicated to proceed (several polygon intersections), \ \
262
- else other error*/
267
+ @return 0 in case of success, 1 if geometry has not been split, error else*/
263
268
int splitGeometry (const QList<QgsPoint>& splitLine, QList<QgsGeometry*>& newGeometries);
264
269
265
270
/* *Changes this geometry such that it does not intersect the other geometry
@@ -412,44 +417,19 @@ not disjoint with existing polygons of the feature*/
412
417
/* *Splits line/multiline geometries
413
418
@splitLine the line that splits the feature
414
419
@newGeometry new geometry if splitting was successful
415
- @return 0 in case of success, 1: splitLine intersects several times but only one split \
416
- can be done, else other errors*/
417
- int splitLinearGeometry (GEOS_GEOM::LineString* splitLine, QgsGeometry** newGeometry);
420
+ @return 0 in case of success, 1 if geometry has not been split, error else*/
421
+ int splitLinearGeometry (GEOS_GEOM::LineString* splitLine, QList<QgsGeometry*>& newGeometries);
418
422
/* *Splits polygon/multipolygon geometries
419
- @return 0 in case of success, 1 no split because of too complicated intersection, \
420
- else other errors*/
421
- int splitPolygonGeometry (GEOS_GEOM::LineString* splitLine, QgsGeometry** newGeometry);
423
+ @return 0 in case of success, 1 if geometry has not been split, error else*/
424
+ int splitPolygonGeometry (GEOS_GEOM::LineString* splitLine, QList<QgsGeometry*>& newGeometries);
422
425
/* *Finds the vertices next to point where the line is split. If it is split at a vertex, beforeVertex
423
426
and afterVertex are the same*/
424
- int findVerticesNextToSplit (const QgsPoint& splitPoint, int & beforeVertex, int & afterVertex);
425
- /* *Test if a point is a geometry vertex
426
- @param p point to test
427
- @param vertexNr vertex number (if point is a vertex)
428
- @return true if p is vertex of this geometry*/
429
- bool vertexContainedInGeometry (const QgsPoint& p, int & vertexNr);
430
- /* *Splits this geometry into two lines*/
431
- int splitThisLine (const QgsPoint& splitPoint, int beforeVertex, int afterVertex, QgsGeometry** newGeometry);
432
- /* *Splits this geometry into two multilines*/
433
- int splitThisMultiline (const QgsPoint& splitPoint, int beforeVertex, int afterVertex, QgsGeometry** newGeometry);
434
- /* *Splits this geometry into two polygons
435
- @return 0 in case of success, 1 error because split intersects inner ring, else other error*/
436
- int splitThisPolygon (const GEOS_GEOM::CoordinateSequence* splitLine, int beforeVertex1, int afterVertex1, \
437
- int beforeVertex2, int afterVertex2, QgsGeometry** newGeometry);
438
- /* *Splits this geometry into two multipolygons
439
- @return 0 in case of success, 1 error because split intersects inner ring, else other error*/
440
- int splitThisMultiPolygon (const GEOS_GEOM::CoordinateSequence* splitLine, int beforeVertex1, int afterVertex1, \
441
- int beforeVertex2, int afterVertex2, QgsGeometry** newGeometry);
442
- /* *splits a QgsPolyline object. Used by 'splitThisLine' and 'splitThisMultiLine'*/
443
- int splitQgsPolyline (const QgsPoint& splitPoint, int beforeVertex, int afterVertex, const QgsPolyline* origLine, QgsPolyline** changedLine, QgsPolyline** newLine) const ;
444
- /* *split a QgsPolygon object. Used by 'splitThisPolygon' and 'splitThisMultiPolygon'
445
- @return 0 in case of success, 1 error because split intersects inner ring, else other error*/
446
- int splitQgsPolygon (const GEOS_GEOM::CoordinateSequence* splitLine, int beforeVertex1, int afterVertex1, \
447
- int beforeVertex2, int afterVertex2, const QgsPolygon* origPoly, QgsPolygon** changedPoly, QgsPolygon** newPoly) const ;
448
-
449
- /* *Converts a polyline (that represents a polygon boundary or a ring) to geos polygon.
450
- The caller function takes ownership of the created object.
451
- @return the converted polygon or 0 in case of error*/
452
- GEOS_GEOM::Polygon* polylineToGeosPolygon (const QgsPolyline& line) const ;
427
+
428
+ /* *Nodes together a split line and a (multi-) polygon geometry in a multilinestring
429
+ @return the noded multiline geometry or 0 in case of error. The calling function takes ownership of the node geometry*/
430
+ GEOS_GEOM::Geometry* nodeGeometries (const GEOS_GEOM::LineString* splitLine, const GEOS_GEOM::Geometry* poly) const ;
431
+
432
+ int mergeGeometriesMultiTypeSplit (QList<GEOS_GEOM::Geometry*>& splitResult);
453
433
454
434
/* * return point from wkb */
455
435
QgsPoint asPoint (unsigned char *& ptr, bool hasZValue);
0 commit comments