QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
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 "qgspointv2.h"
20 #include "qgslinestringv2.h"
21 
22 #include <QList>
23 
25 
32 class CORE_EXPORT QgsGeometryEngine
33 {
34  public:
35  QgsGeometryEngine( const QgsAbstractGeometryV2* geometry ): mGeometry( geometry ) {}
36  virtual ~QgsGeometryEngine() {}
37 
38  virtual void geometryChanged() = 0;
39  virtual void prepareGeometry() = 0;
40 
41  virtual QgsAbstractGeometryV2* intersection( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
42  virtual QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
43  virtual QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
44  virtual QgsAbstractGeometryV2* combine( const QList< QgsAbstractGeometryV2* >&, QString* errorMsg = nullptr ) const = 0;
45  virtual QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
46  virtual QgsAbstractGeometryV2* buffer( double distance, int segments, QString* errorMsg = nullptr ) const = 0;
47  virtual QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString* errorMsg = nullptr ) const = 0;
48  virtual QgsAbstractGeometryV2* simplify( double tolerance, QString* errorMsg = nullptr ) const = 0;
49  virtual QgsAbstractGeometryV2* interpolate( double distance, QString* errorMsg = nullptr ) const = 0;
50  virtual QgsAbstractGeometryV2* envelope( QString* errorMsg = nullptr ) const = 0;
51  virtual bool centroid( QgsPointV2& pt, QString* errorMsg = nullptr ) const = 0;
52  virtual bool pointOnSurface( QgsPointV2& pt, QString* errorMsg = nullptr ) const = 0;
53  virtual QgsAbstractGeometryV2* convexHull( QString* errorMsg = nullptr ) const = 0;
54  virtual double distance( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
55  virtual bool intersects( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
56  virtual bool touches( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
57  virtual bool crosses( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
58  virtual bool within( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
59  virtual bool overlaps( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
60  virtual bool contains( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
61  virtual bool disjoint( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
62 
70  virtual QString relate( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
71 
80  virtual bool relatePattern( const QgsAbstractGeometryV2& geom, const QString& pattern, QString* errorMsg = nullptr ) const = 0;
81 
82  virtual double area( QString* errorMsg = nullptr ) const = 0;
83  virtual double length( QString* errorMsg = nullptr ) const = 0;
84  virtual bool isValid( QString* errorMsg = nullptr ) const = 0;
85  virtual bool isEqual( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0;
86  virtual bool isEmpty( QString* errorMsg ) const = 0;
87 
88  virtual int splitGeometry( const QgsLineStringV2& splitLine,
89  QList<QgsAbstractGeometryV2*>& newGeometries,
90  bool topological,
91  QgsPointSequenceV2 &topologyTestPoints, QString* errorMsg = nullptr ) const
92  {
93  Q_UNUSED( splitLine );
94  Q_UNUSED( newGeometries );
95  Q_UNUSED( topological );
96  Q_UNUSED( topologyTestPoints );
97  Q_UNUSED( errorMsg );
98  return 2;
99  }
100 
101  virtual QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg = nullptr ) const = 0;
102 
103  protected:
105 
107 };
108 
109 #endif // QGSGEOMETRYENGINE_H
QgsGeometryEngine(const QgsAbstractGeometryV2 *geometry)
virtual int splitGeometry(const QgsLineStringV2 &splitLine, QList< QgsAbstractGeometryV2 * > &newGeometries, bool topological, QgsPointSequenceV2 &topologyTestPoints, QString *errorMsg=nullptr) const
Abstract base class for all geometries.
virtual ~QgsGeometryEngine()
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspointv2.h:34
const QgsAbstractGeometryV2 * mGeometry
Contains geometry relation and modification algorithms.