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 )
bool isMeasure() const
Returns true if the geometry contains m values.
Wrapper for iterator of features from vector data provider or vector layer.
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)
Operation failed due to invalid source.
void setProgress(double progress)
Sets the current progress for the feedback object.
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 cancelation of something running in a worker thread...
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)...
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
QgsGeometry geometry() const
Returns the geometry associated with this feature.
Use feature's geometry Z values for interpolation.
Result
Result of an interpolation operation.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
A source together with the information about interpolation attribute / z-coordinate interpolation and...
bool isCanceled() const
Tells whether the operation has been canceled already.
An interface for objects which provide features via a getFeatures method.
Use feature's geometry M values for interpolation.
Operation failed due to invalid feature geometry.
QList< int > QgsAttributeList
bool nextFeature(QgsFeature &f)
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry...
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
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...