QGIS API Documentation  2.99.0-Master (25b0421)
qgsinterpolator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsinterpolator.h
3  ------------------------
4  begin : March 10, 2008
5  copyright : (C) 2008 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSINTERPOLATOR_H
19 #define QGSINTERPOLATOR_H
20 
21 #include <QVector>
22 #include "qgis_sip.h"
23 #include "qgis_analysis.h"
24 
25 class QgsVectorLayer;
26 class QgsGeometry;
27 
28 struct ANALYSIS_EXPORT vertexData
29 {
30  double x;
31  double y;
32  double z;
33 };
34 
40 class ANALYSIS_EXPORT QgsInterpolator
41 {
42  public:
44  enum InputType
45  {
48  BREAK_LINES
49  };
50 
52  struct LayerData
53  {
54  QgsVectorLayer *vectorLayer = nullptr;
58  };
59 
60  QgsInterpolator( const QList<QgsInterpolator::LayerData> &layerData );
61 
62  virtual ~QgsInterpolator() = default;
63 
70  virtual int interpolatePoint( double x, double y, double &result ) = 0;
71 
73  QList<LayerData> layerData() const { return mLayerData; } SIP_SKIP
74 
75  protected:
76 
81  int cacheBaseData();
82 
83  QVector<vertexData> mCachedBaseData;
84 
86  bool mDataIsCached = false;
87 
88  //Information about the input vector layers and the attributes (or z-values) that are used for interpolation
89  QList<LayerData> mLayerData;
90 
91  private:
92  QgsInterpolator() = delete;
93 
100  int addVerticesToCache( const QgsGeometry &geom, bool zCoord, double attributeValue );
101 };
102 
103 #endif
QList< LayerData > mLayerData
QVector< vertexData > mCachedBaseData
Interface class for interpolations.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:94
InputType
Describes the type of input data.
#define SIP_SKIP
Definition: qgis_sip.h:119
QList< LayerData > layerData() const
QgsInterpolator::InputType mInputType
A layer together with the information about interpolation attribute / z-coordinate interpolation and ...
Represents a vector layer which manages a vector based data sets.