27 : mLayerData( layerData )
59 switch ( layer.valueSource )
62 attList.push_back( layer.interpolationAttribute );
70 double attributeValue = 0.0;
71 bool attributeConversionOk =
false;
72 double progress = layerCount * layerStep;
83 progress += featureStep;
87 switch ( layer.valueSource )
91 QVariant attributeVariant = feature.
attribute( layer.interpolationAttribute );
96 attributeValue = attributeVariant.toDouble( &attributeConversionOk );
97 if ( !attributeConversionOk || std::isnan( attributeValue ) )
109 if ( !addVerticesToCache( feature.
geometry(), layer.valueSource, attributeValue ) )
118bool QgsInterpolator::addVerticesToCache(
const QgsGeometry &geom, ValueSource source,
double attributeValue )
bool isMeasure() const
Returns true if the geometry contains m values.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
This class represents a coordinate reference system (CRS).
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QgsFeatureRequest & setDestinationCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets the destination crs for feature's geometries.
An interface for objects which provide features via a getFeatures method.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const =0
Returns an iterator for the features in the source.
virtual long long featureCount() const =0
Returns the number of features contained in the source, or -1 if the feature count is unknown.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const
Tells whether the operation has been canceled already.
void setProgress(double progress)
Sets the current progress for the feedback object.
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
QVector< QgsInterpolatorVertexData > mCachedBaseData
Cached vertex data for input sources.
@ ValueM
Use feature's geometry M values for interpolation.
@ ValueAttribute
Take value from feature's attribute.
@ ValueZ
Use feature's geometry Z values for interpolation.
QgsInterpolator(const QList< QgsInterpolator::LayerData > &layerData)
Result
Result of an interpolation operation.
@ Canceled
Operation was manually canceled.
@ InvalidSource
Operation failed due to invalid source.
@ FeatureGeometryError
Operation failed due to invalid feature geometry.
@ Success
Operation was successful.
bool mDataIsCached
Flag that tells if the cache already has been filled.
QList< LayerData > mLayerData
Information about the input vector layers and the attributes (or z-values) that are used for interpol...
Result cacheBaseData(QgsFeedback *feedback=nullptr)
Caches the vertex and value data from the provider.
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
QList< int > QgsAttributeList
const QgsCoordinateReferenceSystem & crs
Interpolation data for an individual source vertex.
A source together with the information about interpolation attribute / z-coordinate interpolation and...