QGIS API Documentation  3.6.0-Noosa (5873452)
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  virtual bool isValid( QString *errorMsg = nullptr ) const = 0;
221 
228  virtual bool isEqual( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const = 0;
229  virtual bool isEmpty( QString *errorMsg ) const = 0;
230 
235  virtual bool isSimple( QString *errorMsg = nullptr ) const = 0;
236 
247  QVector<QgsGeometry > &newGeometries SIP_OUT,
248  bool topological,
249  QgsPointSequence &topologyTestPoints, QString *errorMsg = nullptr ) const
250  {
251  Q_UNUSED( splitLine );
252  Q_UNUSED( newGeometries );
253  Q_UNUSED( topological );
254  Q_UNUSED( topologyTestPoints );
255  Q_UNUSED( errorMsg );
256  return MethodNotImplemented;
257  }
258 
259  virtual QgsAbstractGeometry *offsetCurve( double distance, int segments, int joinStyle, double miterLimit, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY;
260 
261  protected:
262  const QgsAbstractGeometry *mGeometry = nullptr;
263 
265  : mGeometry( geometry )
266  {}
267 };
268 
269 #endif // QGSGEOMETRYENGINE_H
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.