28 #include <QProgressDialog> 32 , mTriangulation( nullptr )
33 , mTriangleInterpolator( nullptr )
34 , mIsInitialized( false )
35 , mShowProgressDialog( showProgressDialog )
36 , mExportTriangulationToFile( false )
37 , mInterpolation( interpolation )
43 delete mTriangulation;
44 delete mTriangleInterpolator;
49 if ( !mIsInitialized )
54 if ( !mTriangleInterpolator )
60 if ( !mTriangleInterpolator->
calcPoint( x, y, &r ) )
68 void QgsTINInterpolator::initialize()
79 mTriangulation = theDualEdgeTriangulation;
84 int nProcessedFeatures = 0;
85 if ( mShowProgressDialog )
97 if ( mShowProgressDialog )
119 if ( mShowProgressDialog )
125 theProgressDialog->
setValue( nProcessedFeatures );
128 ++nProcessedFeatures;
133 delete theProgressDialog;
142 if ( mShowProgressDialog )
148 delete progressDialog;
151 mTriangleInterpolator = ctInterpolator;
158 mIsInitialized =
true;
161 if ( mExportTriangulationToFile )
183 double attributeValue = 0;
184 bool attributeConversionOk =
false;
188 if ( !attributeVariant.
isValid() )
192 attributeValue = attributeVariant.
toDouble( &attributeConversionOk );
193 if ( !attributeConversionOk || qIsNaN( attributeValue ) )
200 bool hasZValue =
false;
215 currentWkbPtr >> x >> y;
216 if ( zCoord && hasZValue )
225 if ( mTriangulation->
addPoint( thePoint ) == -100 )
237 currentWkbPtr >> nPoints;
240 currentWkbPtr.readHeader();
241 currentWkbPtr >> x >> y;
263 currentWkbPtr >> nPoints;
266 currentWkbPtr >> x >> y;
267 if ( zCoord && hasZValue )
299 currentWkbPtr >> nLines;
307 currentWkbPtr >> nPoints;
308 for (
int index2 = 0; index2 < nPoints; ++index2 )
310 currentWkbPtr >> x >> y;
343 currentWkbPtr >> nRings;
352 currentWkbPtr >> nPoints;
353 for (
int index2 = 0; index2 < nPoints; ++index2 )
355 currentWkbPtr >> x >> y;
389 currentWkbPtr >> nPolys;
392 currentWkbPtr.readHeader();
394 currentWkbPtr >> nRings;
395 for (
int index2 = 0; index2 < nRings; ++index2 )
402 currentWkbPtr >> nPoints;
403 for (
int index3 = 0; index3 < nPoints; ++index3 )
405 currentWkbPtr >> x >> y;
Decorator class which adds the functionality of estimating normals at the data points.
Wrapper for iterator of features from vector data provider or vector layer.
QList< LayerData > mLayerData
virtual int addPoint(Point3D *p)=0
Adds a point to the triangulation Ownership is transferred to this class.
Interface class for interpolations.
QGis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
QgsVectorLayer * vectorLayer
virtual void addTriangulation(Triangulation *t)
Adds an association to a triangulation.
void push_back(const T &value)
virtual void setTriangulation(NormVecDecorator *tin)
LinTriangleInterpolator is a class which interpolates linearly on a triangulation.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
void setLabelText(const QString &text)
double getZ() const
Returns the z-coordinate of the point.
A geometry is the spatial representation of a feature.
WkbType
Used for symbology operations.
QgsTINInterpolator(const QList< LayerData > &inputData, TIN_INTERPOLATION interpolation=Linear, bool showProgressDialog=false)
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
This class represents a line.
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().
QString tr(const char *sourceText, const char *disambiguation, int n)
DualEdgeTriangulation is an implementation of a triangulation class based on the dual edge data struc...
long featureCount(QgsSymbolV2 *symbol)
Number of features rendered with specified symbol.
void setValue(int progress)
InputType
Describes the type of input data.
Point3D is a class to represent a three dimensional point.
virtual bool saveAsShapefile(const QString &fileName) const override
Saves the triangulation as a (line) shapefile.
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.
virtual void addLine(Line3D *line, bool breakline)=0
Adds a line (e.g.
void setTriangleInterpolator(TriangleInterpolator *inter) override
Sets an interpolator.
bool estimateFirstDerivatives(QProgressDialog *d=nullptr)
This method adds the functionality of estimating normals at the data points.
void insertPoint(Point3D *p)
Inserts a node behind the current position and sets the current position to this new node...
A layer together with the information about interpolation attribute / z-coordinate interpolation and ...
int interpolationAttribute
int interpolatePoint(double x, double y, double &result) override
Calculates interpolation value for map coordinates x, y.
This is an implementation of a Clough-Tocher interpolator based on a triangular tessellation.
virtual bool calcPoint(double x, double y, Point3D *result)=0
Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point...
double toDouble(bool *ok) const
QgsWKBTypes::Type readHeader() const
bool nextFeature(QgsFeature &f)
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.