21 #include <QDomDocument>
27 #if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3)
28 #define GEOSGeometry struct GEOSGeom_t
29 #define GEOSCoordSequence struct GEOSCoordSeq_t
111 void fromGeos( GEOSGeometry* geos );
116 void fromWkb(
unsigned char * wkb,
size_t length );
122 const unsigned char* asWkb()
const;
127 size_t wkbSize()
const;
133 const GEOSGeometry* asGeos()
const;
175 QgsPoint closestVertex(
const QgsPoint& point,
int& atVertex,
int& beforeVertex,
int& afterVertex,
double& sqrDist );
190 void adjacentVertices(
int atVertex,
int& beforeVertex,
int& afterVertex );
204 bool insertVertex(
double x,
double y,
int beforeVertex );
212 bool moveVertex(
double x,
double y,
int atVertex );
224 bool deleteVertex(
int atVertex );
238 double sqrDistToVertexAt(
QgsPoint& point,
int atVertex );
246 double closestVertexWithContext(
const QgsPoint& point,
int& atVertex );
263 int addRing(
const QList<QgsPoint>& ring );
268 int addPart(
const QList<QgsPoint> &points );
272 int translate(
double dx,
double dy );
285 int splitGeometry(
const QList<QgsPoint>& splitLine,
286 QList<QgsGeometry*>&newGeometries,
288 QList<QgsPoint> &topologyTestPoints );
293 int reshapeGeometry(
const QList<QgsPoint>& reshapeWithLine );
307 bool intersects(
const QgsGeometry* geometry )
const;
310 bool contains(
const QgsPoint* p )
const;
314 bool contains(
const QgsGeometry* geometry )
const;
318 bool disjoint(
const QgsGeometry* geometry )
const;
330 bool overlaps(
const QgsGeometry* geometry )
const;
342 QgsGeometry* buffer(
double distance,
int segments );
377 QString exportToWkt()
const;
384 QString exportToGeoJSON()
const;
414 QList<QgsGeometry*> asGeometryCollection()
const;
420 bool deleteRing(
int ringNum,
int partNum = 0 );
425 bool deletePart(
int partNum );
430 bool convertToMultiType();
448 Error() : message(
"none" ), hasLocation( false ) {}
449 Error( QString m ) : message( m ), hasLocation( false ) {}
450 Error( QString m,
QgsPoint p ) : message( m ), location( p ), hasLocation( true ) {}
452 QString
what() {
return message; };
461 void validateGeometry( QList<Error> &errors );
494 bool exportWkbToGeos()
const;
499 bool exportGeosToWkb()
const;
514 bool insertVertex(
double x,
double y,
516 const GEOSCoordSequence* old_sequence,
517 GEOSCoordSequence** new_sequence );
524 void translateVertex(
int& wkbPosition,
double dx,
double dy,
bool hasZValue );
538 int splitLinearGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>& newGeometries );
541 int splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>& newGeometries );
544 int topologicalTestPointsSplit(
const GEOSGeometry* splitLine, QList<QgsPoint>& testPoints )
const;
551 static GEOSGeometry* reshapeLine(
const GEOSGeometry* origLine,
const GEOSGeometry* reshapeLineGeos );
558 static GEOSGeometry* reshapePolygon(
const GEOSGeometry* polygon,
const GEOSGeometry* reshapeLineGeos );
562 static GEOSGeometry* nodeGeometries(
const GEOSGeometry *splitLine,
const GEOSGeometry *poly );
566 static int lineContainedInLine(
const GEOSGeometry* line1,
const GEOSGeometry* line2 );
572 static int pointContainedInLine(
const GEOSGeometry* point,
const GEOSGeometry* line );
575 static bool geomInDegrees(
const GEOSGeometry* geom );
578 int numberOfGeometries( GEOSGeometry* g )
const;
580 int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult );
583 QgsPoint asPoint(
unsigned char*& ptr,
bool hasZValue )
const;
586 QgsPolyline asPolyline(
unsigned char*& ptr,
bool hasZValue )
const;
589 QgsPolygon asPolygon(
unsigned char*& ptr,
bool hasZValue )
const;
591 static bool geosRelOp(
char( *op )(
const GEOSGeometry*,
const GEOSGeometry * ),
595 double leftOf(
double x,
double y,
double& x1,
double& y1,
double& x2,
double& y2 );