27 QgsIDWInterpolator::QgsIDWInterpolator():
QgsInterpolator(
QList<LayerData>() ), mDistanceCoefficient( 2.0 )
47 double sumCounter = 0;
48 double sumDenominator = 0;
54 distance = sqrt(( vertex_it->x - x ) * ( vertex_it->x - x ) + ( vertex_it->y - y ) * ( vertex_it->y - y ) );
57 result = vertex_it->z;
60 currentWeight = 1 / ( pow( distance, mDistanceCoefficient ) );
61 sumCounter += ( currentWeight * vertex_it->z );
62 sumDenominator += currentWeight;
65 if ( sumDenominator == 0.0 )
70 result = sumCounter / sumDenominator;
QVector< vertexData > mCachedBaseData
Interface class for interpolations.
int interpolatePoint(double x, double y, double &result) override
Calculates interpolation value for map coordinates x, y.
bool mDataIsCached
Flag that tells if the cache already has been filled.
QgsIDWInterpolator(const QList< LayerData > &layerData)
int cacheBaseData()
Caches the vertex and value data from the provider.