QGIS API Documentation  2.12.0-Lyon
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 QGSVECTORTOPOLOGY_H
17 #define QGSVECTORTOPOLOGY_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 = 0 ) const = 0;
42  virtual QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
43  virtual QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
44  virtual QgsAbstractGeometryV2* combine( const QList< const QgsAbstractGeometryV2* >&, QString* errorMsg = 0 ) const = 0;
45  virtual QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
46  virtual QgsAbstractGeometryV2* buffer( double distance, int segments, QString* errorMsg = 0 ) const = 0;
47  virtual QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString* errorMsg = 0 ) const = 0;
48  virtual QgsAbstractGeometryV2* simplify( double tolerance, QString* errorMsg = 0 ) const = 0;
49  virtual QgsAbstractGeometryV2* interpolate( double distance, QString* errorMsg = 0 ) const = 0;
50  virtual QgsAbstractGeometryV2* envelope( QString* errorMsg = 0 ) const = 0;
51  virtual bool centroid( QgsPointV2& pt, QString* errorMsg = 0 ) const = 0;
52  virtual bool pointOnSurface( QgsPointV2& pt, QString* errorMsg = 0 ) const = 0;
53  virtual QgsAbstractGeometryV2* convexHull( QString* errorMsg = 0 ) const = 0;
54  virtual double distance( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
55  virtual bool intersects( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
56  virtual bool touches( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
57  virtual bool crosses( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
58  virtual bool within( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
59  virtual bool overlaps( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
60  virtual bool contains( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
61  virtual bool disjoint( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
62 
70  virtual QString relate( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
71 
72  virtual double area( QString* errorMsg = 0 ) const = 0;
73  virtual double length( QString* errorMsg = 0 ) const = 0;
74  virtual bool isValid( QString* errorMsg = 0 ) const = 0;
75  virtual bool isEqual( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0;
76  virtual bool isEmpty( QString* errorMsg ) const = 0;
77 
78  virtual int splitGeometry( const QgsLineStringV2& splitLine,
79  QList<QgsAbstractGeometryV2*>& newGeometries,
80  bool topological,
81  QList<QgsPointV2> &topologyTestPoints, QString* errorMsg = 0 ) const
82  {
83  Q_UNUSED( splitLine );
84  Q_UNUSED( newGeometries );
85  Q_UNUSED( topological );
86  Q_UNUSED( topologyTestPoints );
87  Q_UNUSED( errorMsg );
88  return 2;
89  }
90 
91  virtual QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg = 0 ) const = 0;
92 
93  protected:
95 
97 };
98 
99 #endif // QGSVECTORTOPOLOGY_H
QgsGeometryEngine(const QgsAbstractGeometryV2 *geometry)
virtual int splitGeometry(const QgsLineStringV2 &splitLine, QList< QgsAbstractGeometryV2 * > &newGeometries, bool topological, QList< QgsPointV2 > &topologyTestPoints, QString *errorMsg=0) const
Abstract base class for all geometries.
virtual ~QgsGeometryEngine()
Line string geometry type.
Point geometry type.
Definition: qgspointv2.h:29
const QgsAbstractGeometryV2 * mGeometry
Contains geometry relation and modification algorithms.