26 : mLayerData( layerData )
58 switch ( layer.valueSource )
61 attList.push_back( layer.interpolationAttribute );
69 double attributeValue = 0.0;
70 bool attributeConversionOk =
false;
71 double progress = layerCount * layerStep;
82 progress += featureStep;
86 switch ( layer.valueSource )
90 QVariant attributeVariant = feature.
attribute( layer.interpolationAttribute );
91 if ( !attributeVariant.isValid() || attributeVariant.isNull() )
95 attributeValue = attributeVariant.toDouble( &attributeConversionOk );
96 if ( !attributeConversionOk || std::isnan( attributeValue ) )
108 if ( !addVerticesToCache( feature.
geometry(), layer.valueSource, attributeValue ) )
117 bool QgsInterpolator::addVerticesToCache(
const QgsGeometry &geom, ValueSource source,
double attributeValue )
bool is3D() const SIP_HOLDGIL
Returns true if the geometry is 3D and contains a z-value.
bool isMeasure() const SIP_HOLDGIL
Returns true if the geometry contains m values.
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).
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 SIP_HOLDGIL
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 SIP_HOLDGIL
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.
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...