QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsgeometryengine.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometryengine.h
3  -------------------------------------------------------------------
4 Date : 22 Sept 2014
5 Copyright : (C) 2014 by Marco Hugentobler
6 email : marco.hugentobler at sourcepole dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSGEOMETRYENGINE_H
17 #define QGSGEOMETRYENGINE_H
18 
19 #include "qgis_core.h"
20 #include "qgslinestring.h"
21 #include "qgsgeometry.h"
22 
23 #include <QVector>
24 
26 
33 class CORE_EXPORT QgsGeometryEngine
34 {
35  public:
36 
42  {
43  Success = 0,
44  NothingHappened = 1000,
50  /* split */
52  };
53 
54  virtual ~QgsGeometryEngine() = default;
55 
60  virtual void geometryChanged() = 0;
61 
71  virtual void prepareGeometry() = 0;
72 
78  virtual QgsAbstractGeometry *intersection( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
79 
85  virtual QgsAbstractGeometry *difference( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
86 
92  virtual QgsAbstractGeometry *combine( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
93 
99  virtual QgsAbstractGeometry *combine( const QVector<QgsAbstractGeometry *> &geomList, QString *errorMsg ) const = 0 SIP_FACTORY;
100 
106  virtual QgsAbstractGeometry *combine( const QVector< QgsGeometry > &geometries, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
107 
113  virtual QgsAbstractGeometry *symDifference( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
114  virtual QgsAbstractGeometry *buffer( double distance, int segments, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
115  virtual QgsAbstractGeometry *buffer( double distance, int segments, int endCapStyle, int joinStyle, double miterLimit, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
116  virtual QgsAbstractGeometry *simplify( double tolerance, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
117  virtual QgsAbstractGeometry *interpolate( double distance, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
118  virtual QgsAbstractGeometry *envelope( QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
119 
126  virtual QgsPoint *centroid( QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
127 
134  virtual QgsPoint *pointOnSurface( QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
135 
139  virtual QgsAbstractGeometry *convexHull( QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
140 
146  virtual double distance( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
147 
153  virtual bool intersects( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
154 
160  virtual bool touches( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
161 
167  virtual bool crosses( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
168 
174  virtual bool within( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
175 
181  virtual bool overlaps( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
182 
188  virtual bool contains( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
189 
195  virtual bool disjoint( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
196 
205  virtual QString relate( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
206 
216  virtual bool relatePattern( const QgsAbstractGeometry *geom, const QString &pattern, QString *errorMsg = nullptr ) const = 0;
217 
218  virtual double area( QString *errorMsg = nullptr ) const = 0;
219  virtual double length( QString *errorMsg = nullptr ) const = 0;
220 
232  virtual bool isValid( QString *errorMsg = nullptr, bool allowSelfTouchingHoles = false, QgsGeometry *errorLoc = nullptr ) const = 0;
233 
240  virtual bool isEqual( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
241  virtual bool isEmpty( QString *errorMsg ) const = 0;
242 
247  virtual bool isSimple( QString *errorMsg = nullptr ) const = 0;
248 
259  QVector<QgsGeometry > &newGeometries SIP_OUT,
260  bool topological,
261  QgsPointSequence &topologyTestPoints, QString *errorMsg = nullptr ) const
262  {
263  Q_UNUSED( splitLine )
264  Q_UNUSED( newGeometries )
265  Q_UNUSED( topological )
266  Q_UNUSED( topologyTestPoints )
267  Q_UNUSED( errorMsg )
268  return MethodNotImplemented;
269  }
270 
271  virtual QgsAbstractGeometry *offsetCurve( double distance, int segments, int joinStyle, double miterLimit, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
272 
273  protected:
274  const QgsAbstractGeometry *mGeometry = nullptr;
275 
277  : mGeometry( geometry )
278  {}
279 };
280 
281 #endif // QGSGEOMETRYENGINE_H
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
virtual QgsGeometryEngine::EngineOperationResult splitGeometry(const QgsLineString &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg=nullptr) const
Splits this geometry according to a given line.
Method not implemented in geometry engine.
#define SIP_FACTORY
Definition: qgis_sip.h:69
Abstract base class for all geometries.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
Error occurred while creating a noded geometry.
Error occurred in the geometry engine.
QVector< QgsPoint > QgsPointSequence
QgsGeometryEngine(const QgsAbstractGeometry *geometry)
#define SIP_OUT
Definition: qgis_sip.h:51
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:43
The input is not valid.
Contains geometry relation and modification algorithms.
EngineOperationResult
Success or failure of a geometry operation.
The geometry on which the operation occurs is not valid.