QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
interpolation
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 "
qgis.h
"
22
#include "qgis_analysis.h"
23
#include "
qgis_sip.h
"
24
#include "
qgscoordinatetransformcontext.h
"
25
26
#include <QList>
27
#include <QVector>
28
29
class
QgsFeatureSource
;
30
class
QgsGeometry
;
31
class
QgsFeedback
;
32
33
#ifdef SIP_RUN
34
//%ModuleHeaderCode
35
#include "
qgsinterpolator.h
"
36
//%End
37
#endif
38
42
struct
ANALYSIS_EXPORT
QgsInterpolatorVertexData
43
{
48
QgsInterpolatorVertexData
(
double
x
,
double
y
,
double
z
)
49
:
x
(
x
)
50
,
y
(
y
)
51
,
z
(
z
)
52
{}
53
54
QgsInterpolatorVertexData
() =
default
;
55
57
double
x
= 0.0;
59
double
y
= 0.0;
61
double
z
= 0.0;
62
};
63
72
class
ANALYSIS_EXPORT
QgsInterpolator
73
{
74
public
:
76
enum class
Result
:
int
77
{
78
Success = 0,
79
Canceled,
80
InvalidSource,
81
FeatureGeometryError,
82
};
83
85
struct
LayerData
86
{
88
QgsFeatureSource
*
source
=
nullptr
;
90
Qgis::InterpolationValueSource
valueSource
=
Qgis::InterpolationValueSource::Attribute
;
92
int
interpolationAttribute
= -1;
94
Qgis::InterpolationSourceType
sourceType
=
Qgis::InterpolationSourceType::Points
;
95
101
QgsCoordinateTransformContext
transformContext
;
102
};
103
104
QgsInterpolator
(
const
QList<QgsInterpolator::LayerData> &
layerData
);
105
106
virtual
~QgsInterpolator
() =
default
;
107
116
virtual
int
interpolatePoint
(
double
x,
double
y,
double
&result
SIP_OUT
,
QgsFeedback
*feedback =
nullptr
) = 0;
117
119
QList<LayerData>
layerData
() const
SIP_SKIP
{
return
mLayerData
; }
120
121
protected
:
131
Result cacheBaseData(
QgsFeedback
*feedback =
nullptr
);
132
134
QVector<QgsInterpolatorVertexData>
mCachedBaseData
;
135
137
bool
mDataIsCached
=
false
;
138
140
QList<LayerData>
mLayerData
;
141
142
private
:
143
QgsInterpolator
() =
delete
;
144
152
bool
addVerticesToCache(
const
QgsGeometry
&geom,
Qgis::InterpolationValueSource
source,
double
attributeValue );
153
};
154
155
#endif
Qgis::InterpolationSourceType
InterpolationSourceType
Interpolation source types.
Definition
qgis.h:6788
Qgis::InterpolationSourceType::Points
@ Points
Point source.
Definition
qgis.h:6789
Qgis::InterpolationValueSource
InterpolationValueSource
Source for interpolated values from features.
Definition
qgis.h:6801
Qgis::InterpolationValueSource::Attribute
@ Attribute
Take value from feature's attribute.
Definition
qgis.h:6802
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsFeatureSource
An interface for objects which provide features via a getFeatures method.
Definition
qgsfeaturesource.h:37
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition
qgsfeedback.h:44
QgsGeometry
A geometry is the spatial representation of a feature.
Definition
qgsgeometry.h:267
QgsInterpolator::mCachedBaseData
QVector< QgsInterpolatorVertexData > mCachedBaseData
Cached vertex data for input sources.
Definition
qgsinterpolator.h:134
QgsInterpolator::interpolatePoint
virtual int interpolatePoint(double x, double y, double &result, QgsFeedback *feedback=nullptr)=0
Calculates interpolation value for map coordinates x, y.
QgsInterpolator::QgsInterpolator
QgsInterpolator(const QList< QgsInterpolator::LayerData > &layerData)
Definition
qgsinterpolator.cpp:27
QgsInterpolator::mDataIsCached
bool mDataIsCached
Flag that tells if the cache already has been filled.
Definition
qgsinterpolator.h:137
QgsInterpolator::layerData
QList< LayerData > layerData() const
Definition
qgsinterpolator.h:119
QgsInterpolator::mLayerData
QList< LayerData > mLayerData
Information about the input vector layers and the attributes (or z-values) that are used for interpol...
Definition
qgsinterpolator.h:140
QgsInterpolator::~QgsInterpolator
virtual ~QgsInterpolator()=default
QgsInterpolator::Result
Result
Result of an interpolation operation.
Definition
qgsinterpolator.h:77
qgis.h
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_OUT
#define SIP_OUT
Definition
qgis_sip.h:57
qgscoordinatetransformcontext.h
qgsinterpolator.h
QgsInterpolatorVertexData::QgsInterpolatorVertexData
QgsInterpolatorVertexData()=default
QgsInterpolatorVertexData::y
double y
Y-coordinate.
Definition
qgsinterpolator.h:59
QgsInterpolatorVertexData::QgsInterpolatorVertexData
QgsInterpolatorVertexData(double x, double y, double z)
Constructor for QgsInterpolatorVertexData with the specified x, y, and z coordinate.
Definition
qgsinterpolator.h:48
QgsInterpolatorVertexData::z
double z
Z-coordinate.
Definition
qgsinterpolator.h:61
QgsInterpolatorVertexData::x
double x
X-coordinate.
Definition
qgsinterpolator.h:57
QgsInterpolator::LayerData
A source together with the information about interpolation attribute / z-coordinate interpolation and...
Definition
qgsinterpolator.h:86
QgsInterpolator::LayerData::source
QgsFeatureSource * source
Feature source.
Definition
qgsinterpolator.h:88
QgsInterpolator::LayerData::sourceType
Qgis::InterpolationSourceType sourceType
Source type.
Definition
qgsinterpolator.h:94
QgsInterpolator::LayerData::transformContext
QgsCoordinateTransformContext transformContext
Coordinate transform context.
Definition
qgsinterpolator.h:101
QgsInterpolator::LayerData::interpolationAttribute
int interpolationAttribute
Index of feature attribute to use for interpolation.
Definition
qgsinterpolator.h:92
QgsInterpolator::LayerData::valueSource
Qgis::InterpolationValueSource valueSource
Source for feature values to interpolate.
Definition
qgsinterpolator.h:90
Generated on
for QGIS API Documentation by
1.17.0