QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
QgsInterpolator Class Reference

Interface class for interpolations. More...

#include <qgsinterpolator.h>

Inheritance diagram for QgsInterpolator:
Inheritance graph


struct  LayerData
 A layer together with the information about interpolation attribute / z-coordinate interpolation and the type (point, structure line, breakline) More...

Public Types

 Describes the type of input data. More...

Public Member Functions

 QgsInterpolator (const QList< LayerData > &layerData)
virtual ~QgsInterpolator ()
virtual int interpolatePoint (double x, double y, double &result)=0
 Calculates interpolation value for map coordinates x, y.

Protected Member Functions

int cacheBaseData ()
 Caches the vertex and value data from the provider.

Protected Attributes

QVector< vertexDatamCachedBaseData
bool mDataIsCached
 Flag that tells if the cache already has been filled.
QList< LayerDatamLayerData

Private Member Functions

 QgsInterpolator ()
int addVerticesToCache (QgsGeometry *geom, bool zCoord, double attributeValue)
 Helper method that adds the vertices of a geometry to the mCachedBaseData.

Detailed Description

Interface class for interpolations.

Interpolators take the vertices of a vector layer as base data. The z-Value can be an attribute or the z-coordinates in case of 25D types

Definition at line 36 of file qgsinterpolator.h.

Member Enumeration Documentation

Describes the type of input data.


Definition at line 40 of file qgsinterpolator.h.

Constructor & Destructor Documentation

QgsInterpolator::QgsInterpolator ( const QList< LayerData > &  layerData)

Definition at line 23 of file qgsinterpolator.cpp.

QgsInterpolator::~QgsInterpolator ( )

Definition at line 33 of file qgsinterpolator.cpp.

QgsInterpolator::QgsInterpolator ( )

Definition at line 28 of file qgsinterpolator.cpp.

Member Function Documentation

int QgsInterpolator::addVerticesToCache ( QgsGeometry geom,
bool  zCoord,
double  attributeValue 

Helper method that adds the vertices of a geometry to the mCachedBaseData.

geomthe geometry
zCoordtrue if the z-coordinate of the geometry is to be interpolated
attributeValuethe attribute value for interpolation (if not interpolated from z-coordinate)
0 in case of success

Definition at line 103 of file qgsinterpolator.cpp.

References QgsGeometry::asWkb(), index, mCachedBaseData, mDataIsCached, QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, QGis::WKBPolygon25D, QgsGeometry::wkbType(), vertexData::x, vertexData::y, and vertexData::z.

Referenced by cacheBaseData().

int QgsInterpolator::cacheBaseData ( )

Caches the vertex and value data from the provider.

All the vertex data will be held in virtual memory

0 in case of success

Definition at line 38 of file qgsinterpolator.cpp.

References addVerticesToCache(), QgsFeature::attribute(), QgsFeature::geometry(), QgsVectorLayer::getFeatures(), mCachedBaseData, mLayerData, and QgsFeatureIterator::nextFeature().

Referenced by QgsIDWInterpolator::interpolatePoint().

virtual int QgsInterpolator::interpolatePoint ( double  x,
double  y,
double &  result 
pure virtual

Calculates interpolation value for map coordinates x, y.

xx-coordinate (in map units)
yy-coordinate (in map units)
resultout: interpolation result
0 in case of success

Implemented in QgsTINInterpolator, and QgsIDWInterpolator.

Referenced by QgsGridFileWriter::writeFile().

Member Data Documentation

QVector<vertexData> QgsInterpolator::mCachedBaseData
bool QgsInterpolator::mDataIsCached

Flag that tells if the cache already has been filled.

Definition at line 76 of file qgsinterpolator.h.

Referenced by addVerticesToCache(), and QgsIDWInterpolator::interpolatePoint().

QList<LayerData> QgsInterpolator::mLayerData

Definition at line 79 of file qgsinterpolator.h.

Referenced by cacheBaseData(), and QgsTINInterpolator::initialize().

The documentation for this class was generated from the following files: