27 #if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3)
28 #define GEOSGeometry struct GEOSGeom_t
29 #define GEOSCoordSequence struct GEOSCoordSeq_t
103 void fromGeos( GEOSGeometry* geos );
108 void fromWkb(
unsigned char * wkb,
size_t length );
114 unsigned char * asWkb();
123 GEOSGeometry* asGeos();
165 QgsPoint closestVertex(
const QgsPoint& point,
int& atVertex,
int& beforeVertex,
int& afterVertex,
double& sqrDist );
180 void adjacentVertices(
int atVertex,
int& beforeVertex,
int& afterVertex );
194 bool insertVertex(
double x,
double y,
int beforeVertex );
202 bool moveVertex(
double x,
double y,
int atVertex );
214 bool deleteVertex(
int atVertex );
229 double sqrDistToVertexAt(
QgsPoint& point,
int atVertex );
237 double closestVertexWithContext(
const QgsPoint& point,
int& atVertex );
247 double closestSegmentWithContext(
const QgsPoint& point,
QgsPoint& minDistPoint,
int& beforeVertex );
252 int addRing(
const QList<QgsPoint>& ring );
257 int addIsland(
const QList<QgsPoint>& ring );
261 int translate(
double dx,
double dy );
274 int splitGeometry(
const QList<QgsPoint>& splitLine,
275 QList<QgsGeometry*>&newGeometries,
277 QList<QgsPoint> &topologyTestPoints );
282 int reshapeGeometry(
const QList<QgsPoint>& reshapeWithLine );
331 QgsGeometry* buffer(
double distance,
int segments );
361 QString exportToWkt();
391 QList<QgsGeometry*> asGeometryCollection();
397 bool deleteRing(
int ringNum,
int partNum = 0 );
402 bool deletePart(
int partNum );
407 bool convertToMultiType();
416 int avoidIntersections();
425 Error( QString m ) : message( m ), hasLocation( false ) {}
426 Error( QString m,
QgsPoint p ) : message( m ), location( p ), hasLocation( true ) {}
428 QString
what() {
return message; };
436 void validateGeometry( QList<Error> &errors );
438 static void validatePolyline( QList<Error> &errors,
int i,
QgsPolyline polyline,
bool ring =
false );
439 static void validatePolygon( QList<Error> &errors,
int i,
const QgsPolygon &polygon );
472 bool exportWkbToGeos();
477 bool exportGeosToWkb();
492 bool insertVertex(
double x,
double y,
494 const GEOSCoordSequence* old_sequence,
495 GEOSCoordSequence** new_sequence );
502 void translateVertex(
int& wkbPosition,
double dx,
double dy,
bool hasZValue );
516 int splitLinearGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>& newGeometries );
519 int splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>& newGeometries );
522 int topologicalTestPointsSplit(
const GEOSGeometry* splitLine, QList<QgsPoint>& testPoints )
const;
529 static GEOSGeometry* reshapeLine(
const GEOSGeometry* origLine,
const GEOSGeometry* reshapeLineGeos );
536 static GEOSGeometry* reshapePolygon(
const GEOSGeometry* polygon,
const GEOSGeometry* reshapeLineGeos );
540 static GEOSGeometry* nodeGeometries(
const GEOSGeometry *splitLine,
const GEOSGeometry *poly );
544 static int lineContainedInLine(
const GEOSGeometry* line1,
const GEOSGeometry* line2 );
550 static int pointContainedInLine(
const GEOSGeometry* point,
const GEOSGeometry* line );
553 static bool geomInDegrees(
const GEOSGeometry* geom );
556 int numberOfGeometries( GEOSGeometry* g )
const;
558 int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult );
561 QgsPoint asPoint(
unsigned char*& ptr,
bool hasZValue );
564 QgsPolyline asPolyline(
unsigned char*& ptr,
bool hasZValue );
567 QgsPolygon asPolygon(
unsigned char*& ptr,
bool hasZValue );
569 static void checkRingIntersections( QList<Error> &errors,
573 static bool geosRelOp(
char( *op )(
const GEOSGeometry*,
const GEOSGeometry * ),