21 #include <QDomDocument> 90 static GEOSContextHandle_t getGEOSHandler();
113 static QgsGeometry* fromQPointF(
const QPointF& point );
121 static QgsGeometry* fromQPolygonF(
const QPolygonF& polygon );
128 void fromGeos( GEOSGeometry* geos );
133 void fromWkb(
unsigned char * wkb,
size_t length );
139 const unsigned char* asWkb()
const;
144 size_t wkbSize()
const;
149 const GEOSGeometry* asGeos()
const;
158 bool isMultipart()
const;
181 QgsPoint closestVertex(
const QgsPoint& point,
int& atVertex,
int& beforeVertex,
int& afterVertex,
double& sqrDist );
195 void adjacentVertices(
int atVertex,
int& beforeVertex,
int& afterVertex );
208 bool insertVertex(
double x,
double y,
int beforeVertex );
216 bool moveVertex(
double x,
double y,
int atVertex );
228 bool deleteVertex(
int atVertex );
242 double sqrDistToVertexAt(
QgsPoint& point,
int atVertex );
250 double closestVertexWithContext(
const QgsPoint& point,
int& atVertex );
267 int addRing(
const QList<QgsPoint>& ring );
279 int addPart( GEOSGeometry *newPart );
290 int translate(
double dx,
double dy );
299 int transform(
const QTransform& ct );
306 int rotate(
double rotation,
const QgsPoint& center );
315 int splitGeometry(
const QList<QgsPoint>& splitLine,
316 QList<QgsGeometry*>&newGeometries,
318 QList<QgsPoint> &topologyTestPoints );
322 int reshapeGeometry(
const QList<QgsPoint>& reshapeWithLine );
336 bool intersects(
const QgsGeometry* geometry )
const;
339 bool contains(
const QgsPoint* p )
const;
342 bool contains(
const QgsGeometry* geometry )
const;
345 bool disjoint(
const QgsGeometry* geometry )
const;
354 bool overlaps(
const QgsGeometry* geometry )
const;
364 QgsGeometry* buffer(
double distance,
int segments );
375 QgsGeometry* buffer(
double distance,
int segments,
int endCapStyle,
int joinStyle,
double mitreLimit );
382 QgsGeometry* offsetCurve(
double distance,
int segments,
int joinStyle,
double mitreLimit );
419 QString exportToWkt(
const int &precision = 17 )
const;
425 QString exportToGeoJSON(
const int &precision = 17 )
const;
462 QList<QgsGeometry*> asGeometryCollection()
const;
468 QPointF asQPointF()
const;
475 QPolygonF asQPolygonF()
const;
480 bool deleteRing(
int ringNum,
int partNum = 0 );
484 bool deletePart(
int partNum );
489 bool convertToMultiType();
506 Error() : message(
"none" ), hasLocation( false ) {}
507 Error( QString m ) : message( m ), hasLocation( false ) {}
508 Error( QString m,
QgsPoint p ) : message( m ), location( p ), hasLocation( true ) {}
510 QString
what() {
return message; };
516 void validateGeometry( QList<Error> &errors );
522 static QgsGeometry *unaryUnion(
const QList<QgsGeometry*>& geometryList );
535 mutable unsigned char * mGeometry;
538 mutable size_t mGeometrySize;
541 mutable GEOSGeometry* mGeos;
544 mutable bool mDirtyWkb;
547 mutable bool mDirtyGeos;
555 bool exportWkbToGeos()
const;
560 bool exportGeosToWkb()
const;
575 bool insertVertex(
double x,
double y,
577 const GEOSCoordSequence* old_sequence,
578 GEOSCoordSequence** new_sequence );
584 void transformVertex(
QgsWkbPtr &wkbPtr,
const QTransform& trans,
bool hasZValue );
598 int splitLinearGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>& newGeometries );
601 int splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>& newGeometries );
603 GEOSGeometry* linePointDifference( GEOSGeometry* GEOSsplitPoint );
607 int topologicalTestPointsSplit(
const GEOSGeometry* splitLine, QList<QgsPoint>& testPoints )
const;
614 static GEOSGeometry* reshapeLine(
const GEOSGeometry* origLine,
const GEOSGeometry* reshapeLineGeos );
621 static GEOSGeometry* reshapePolygon(
const GEOSGeometry* polygon,
const GEOSGeometry* reshapeLineGeos );
625 static GEOSGeometry* nodeGeometries(
const GEOSGeometry *splitLine,
const GEOSGeometry *poly );
629 static int lineContainedInLine(
const GEOSGeometry* line1,
const GEOSGeometry* line2 );
635 static int pointContainedInLine(
const GEOSGeometry* point,
const GEOSGeometry* line );
638 static int geomDigits(
const GEOSGeometry* geom );
641 int numberOfGeometries( GEOSGeometry* g )
const;
643 int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult );
654 static bool geosRelOp(
char( *op )( GEOSContextHandle_t handle,
const GEOSGeometry*,
const GEOSGeometry * ),
658 double leftOf(
double x,
double y,
double& x1,
double& y1,
double& x2,
double& y2 );
660 static inline bool moveVertex(
QgsWkbPtr &wkbPtr,
const double &x,
const double &y,
int atVertex,
bool hasZValue,
int &pointIndex,
bool isRing );
661 static inline int deleteVertex(
QgsConstWkbPtr &srcPtr,
QgsWkbPtr &dstPtr,
int atVertex,
bool hasZValue,
int &pointIndex,
bool isRing,
bool lastItem );
662 static inline bool insertVertex(
QgsConstWkbPtr &srcPtr,
QgsWkbPtr &dstPtr,
int beforeVertex,
const double &x,
const double &y,
bool hasZValue,
int &pointIndex,
bool isRing );
669 QgsGeometry* convertToPolygon(
bool destMultipart );
671 static QgsPolyline createPolylineFromQPolygonF(
const QPolygonF &polygon );
672 static QgsPolygon createPolygonFromQPolygonF(
const QPolygonF &polygon );
679 mutable unsigned char *mP;
684 inline const QgsWkbPtr &
operator>>(
double &v )
const { memcpy( &v, mP,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
685 inline const QgsWkbPtr &
operator>>(
int &v )
const { memcpy( &v, mP,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
686 inline const QgsWkbPtr &
operator>>(
unsigned int &v )
const { memcpy( &v, mP,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
687 inline const QgsWkbPtr &
operator>>(
char &v )
const { memcpy( &v, mP,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
690 inline const QgsWkbPtr &operator>>( qreal &v )
const {
double d; memcpy( &d, mP,
sizeof( d ) ); mP +=
sizeof( d ); v=d;
return *
this; }
693 inline QgsWkbPtr &
operator<<(
const double &v ) { memcpy( mP, &v,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
694 inline QgsWkbPtr &
operator<<(
const int &v ) { memcpy( mP, &v,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
695 inline QgsWkbPtr &
operator<<(
const unsigned int &v ) { memcpy( mP, &v,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
696 inline QgsWkbPtr &
operator<<(
const char &v ) { memcpy( mP, &v,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
699 inline QgsWkbPtr &
operator<<(
const qreal &v ) {
double d = v; memcpy( mP, &d,
sizeof( d ) ); mP +=
sizeof( d );
return *
this; }
704 inline operator unsigned char *()
const {
return mP; }
709 mutable unsigned char *mP;
716 inline const QgsConstWkbPtr &
operator>>(
unsigned int &v )
const { memcpy( &v, mP,
sizeof( v ) ); mP +=
sizeof( v );
return *
this; }
720 inline const QgsConstWkbPtr &operator>>( qreal &v )
const {
double d; memcpy( &d, mP,
sizeof( d ) ); mP +=
sizeof( d ); v=d;
return *
this; }
725 inline operator const unsigned char *()
const {
return mP; }
A rectangle specified with double values.
QgsWkbPtr(unsigned char *p)
const QgsConstWkbPtr & operator>>(char &v) const
QVector< QgsPoint > QgsPolyline
polyline is represented as a vector of points
const QgsConstWkbPtr & operator>>(double &v) const
const QgsWkbPtr & operator>>(int &v) const
WkbType
Used for symbology operations.
const QgsConstWkbPtr & operator>>(unsigned int &v) const
QgsWkbPtr & operator<<(const int &v)
const double DEFAULT_SEGMENT_EPSILON
default snapping tolerance for segments
const QgsConstWkbPtr & operator>>(QGis::WkbType &v) const
QgsWkbPtr & operator<<(const double &v)
QVector< QgsPolygon > QgsMultiPolygon
a collection of QgsPolygons that share a common collection of attributes
QVector< QgsPoint > QgsMultiPoint
a collection of QgsPoints that share a common collection of attributes
QgsWkbPtr & operator<<(const QGis::WkbType &v)
const QgsWkbPtr & operator>>(double &v) const
std::ostream & operator<<(std::ostream &os, const QgsCoordinateReferenceSystem &r)
Output stream operator.
QVector< QgsPolyline > QgsPolygon
polygon: first item of the list is outer ring, inner rings (if any) start from second item ...
A class to represent a point.
const QgsWkbPtr & operator>>(char &v) const
QVector< QgsPolyline > QgsMultiPolyline
a collection of QgsPolylines that share a common collection of attributes
const QgsWkbPtr & operator>>(QGis::WkbType &v) const
const QgsConstWkbPtr & operator>>(int &v) const
QgsWkbPtr & operator<<(const unsigned int &v)
const QgsWkbPtr & operator>>(unsigned int &v) const
double ANALYSIS_EXPORT leftOf(Point3D *thepoint, Point3D *p1, Point3D *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'.
int convexHull(int *id, const double *const x, const double *const y, int n)
Represents a vector layer which manages a vector based data sets.
Q_DECLARE_METATYPE(QgsGeometry)
QgsWkbPtr & operator<<(const char &v)
QgsConstWkbPtr(const unsigned char *p)
Error(QString m, QgsPoint p)