QGIS API Documentation  2.99.0-Master (b8fd1fd)
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_analysis.h"
23 
24 class QgsVectorLayer;
25 class QgsGeometry;
26 
27 struct ANALYSIS_EXPORT vertexData
28 {
29  double x;
30  double y;
31  double z;
32 };
33 
38 class ANALYSIS_EXPORT QgsInterpolator
39 {
40  public:
42  enum InputType
43  {
46  BREAK_LINES
47  };
48 
50  struct LayerData
51  {
52  QgsVectorLayer *vectorLayer = nullptr;
56  };
57 
58  QgsInterpolator( const QList<LayerData> &layerData );
59 
60  virtual ~QgsInterpolator() = default;
61 
67  virtual int interpolatePoint( double x, double y, double &result ) = 0;
68 
70  QList<LayerData> layerData() const { return mLayerData; }
71 
72  protected:
73 
77  int cacheBaseData();
78 
79  QVector<vertexData> mCachedBaseData;
80 
83 
84  //Information about the input vector layers and the attributes (or z-values) that are used for interpolation
85  QList<LayerData> mLayerData;
86 
87  private:
88  QgsInterpolator(); //forbidden
89 
95  int addVerticesToCache( const QgsGeometry &geom, bool zCoord, double attributeValue );
96 };
97 
98 #endif
QList< LayerData > mLayerData
QVector< vertexData > mCachedBaseData
Interface class for interpolations.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:79
InputType
Describes the type of input data.
QList< LayerData > layerData() const
bool mDataIsCached
Flag that tells if the cache already has been filled.
A layer together with the information about interpolation attribute / z-coordinate interpolation and ...
Represents a vector layer which manages a vector based data sets.