26 : mLayerData( layerData )
56 switch ( layer.valueSource )
59 attList.push_back( layer.interpolationAttribute );
67 double attributeValue = 0.0;
68 bool attributeConversionOk =
false;
69 double progress = layerCount * layerStep;
80 progress += featureStep;
84 switch ( layer.valueSource )
88 QVariant attributeVariant = feature.
attribute( layer.interpolationAttribute );
89 if ( !attributeVariant.isValid() )
93 attributeValue = attributeVariant.toDouble( &attributeConversionOk );
94 if ( !attributeConversionOk || std::isnan( attributeValue ) )
106 if ( !addVerticesToCache( feature.
geometry(), layer.valueSource, attributeValue ) )
115 bool QgsInterpolator::addVerticesToCache(
const QgsGeometry &geom,
ValueSource source,
double attributeValue )
Wrapper for iterator of features from vector data provider or vector layer.
bool isCanceled() const
Tells whether the operation has been canceled already.
QList< LayerData > mLayerData
Information about the input vector layers and the attributes (or z-values) that are used for interpol...
Operation was successful.
QgsInterpolator(const QList< QgsInterpolator::LayerData > &layerData)
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry...
bool isNull() const
Returns true if the geometry is null (ie, contains no underlying geometry accessible via geometry() )...
Operation failed due to invalid source.
void setProgress(double progress)
Sets the current progress for the feedback object.
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
A geometry is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Operation was manually canceled.
Interpolation data for an individual source vertex.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
bool isMeasure() const
Returns true if the geometry contains m values.
ValueSource
Source for interpolated values from features.
Take value from feature's attribute.
QVector< QgsInterpolatorVertexData > mCachedBaseData
Cached vertex data for input sources.
bool mDataIsCached
Flag that tells if the cache already has been filled.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Use feature's geometry Z values for interpolation.
Result
Result of an interpolation operation.
A source together with the information about interpolation attribute / z-coordinate interpolation and...
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
An interface for objects which provide features via a getFeatures method.
Use feature's geometry M values for interpolation.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
Operation failed due to invalid feature geometry.
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
QList< int > QgsAttributeList
bool nextFeature(QgsFeature &f)
Result cacheBaseData(QgsFeedback *feedback=nullptr)
Caches the vertex and value data from the provider.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
virtual long featureCount() const =0
Returns the number of features contained in the source, or -1 if the feature count is unknown...