25 : mDataIsCached( false )
26 , mLayerData( layerData )
73 double attributeValue = 0.0;
74 bool attributeConversionOk =
false;
84 if ( !attributeVariant.
isValid() )
88 attributeValue = attributeVariant.
toDouble( &attributeConversionOk );
89 if ( !attributeConversionOk || qIsNaN( attributeValue ) )
105 int QgsInterpolator::addVerticesToCache(
const QgsGeometry *geom,
bool zCoord,
double attributeValue )
110 bool hasZValue =
false;
124 currentWkbPtr >> theVertex.
x >> theVertex.
y;
125 if ( zCoord && hasZValue )
127 currentWkbPtr >> theVertex.
z;
131 theVertex.
z = attributeValue;
143 currentWkbPtr >> nPoints;
146 currentWkbPtr >> theVertex.
x >> theVertex.
y;
147 if ( zCoord && hasZValue )
149 currentWkbPtr >> theVertex.
z;
153 theVertex.
z = attributeValue;
171 for (
int index2 = 0; index2 < *npoints; ++index2 )
175 if ( point.sqrDist( x, y ) < actdist )
177 actdist = point.sqrDist( x, y );
178 vertexnr = vertexcounter;
182 beforeVertex = vertexcounter + ( *npoints - 2 );
183 afterVertex = vertexcounter + 1;
185 else if ( index2 == ( *npoints - 1 ) )
187 beforeVertex = vertexcounter - 1;
188 afterVertex = vertexcounter - ( *npoints - 2 );
192 beforeVertex = vertexcounter - 1;
193 afterVertex = vertexcounter + 1;
198 wkbPtr +=
sizeof( double );
214 wkbPtr += 1 +
sizeof( int );
218 if ( point.sqrDist( x, y ) < actdist )
220 actdist = point.sqrDist( x, y );
225 wkbPtr +=
sizeof( double );
241 for (
int index2 = 0; index2 < nPoints; ++index2 )
245 if ( point.sqrDist( x, y ) < actdist )
247 actdist = point.sqrDist( x, y );
248 vertexnr = vertexcounter;
256 beforeVertex = vertexnr - 1;
258 if ( index2 == nPoints - 1 )
264 afterVertex = vertexnr + 1;
269 wkbPtr +=
sizeof( double );
285 wkbPtr += 1 +
sizeof( int );
288 for (
int index2 = 0; index2 < nRings; ++index2 )
292 for (
int index3 = 0; index3 < nPoints; ++index3 )
296 if ( point.sqrDist( x, y ) < actdist )
298 actdist = point.sqrDist( x, y );
299 vertexnr = vertexcounter;
304 beforeVertex = vertexcounter + ( nPoints - 2 );
305 afterVertex = vertexcounter + 1;
307 else if ( index3 == ( *npoints - 1 ) )
309 beforeVertex = vertexcounter - 1;
310 afterVertex = vertexcounter - ( nPoints - 2 );
314 beforeVertex = vertexcounter - 1;
315 afterVertex = vertexcounter + 1;
320 wkbPtr +=
sizeof( double );
Wrapper for iterator of features from vector data provider or vector layer.
QList< LayerData > mLayerData
QVector< vertexData > mCachedBaseData
QGis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
QgsVectorLayer * vectorLayer
void push_back(const T &value)
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
A geometry is the spatial representation of a feature.
WkbType
Used for symbology operations.
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
int wkbSize() const
Returns the size of the WKB in asWkb().
virtual ~QgsInterpolator()
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)...
const unsigned char * asWkb() const
Returns the buffer containing this geometry in WKB format.
A layer together with the information about interpolation attribute / z-coordinate interpolation and ...
int interpolationAttribute
QgsInterpolator(const QList< LayerData > &layerData)
void push_back(const T &value)
double toDouble(bool *ok) const
QgsWKBTypes::Type readHeader() const
bool nextFeature(QgsFeature &f)
Represents a vector layer which manages a vector based data sets.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
int cacheBaseData()
Caches the vertex and value data from the provider.