55 addVerticesFromFeature( feat, valueAttribute, transform, feedback );
83 addVerticesFromFeature( feat, valueAttribute, transform, feedback );
87 addBreakLinesFromFeature( feat, valueAttribute, transform, feedback );
99 return mTriangulation->triangulationToMesh( feedback );
124 if ( valueAttribute >= 0 )
125 value = feature.
attribute( valueAttribute ).toDouble();
131 if ( valueAttribute < 0 )
132 mTriangulation->addPoint( *vit );
143 double valueOnVertex = 0;
144 if ( valueAttribute >= 0 )
145 valueOnVertex = feature.
attribute( valueAttribute ).toDouble();
148 std::vector<const QgsCurve *> curves;
163 std::vector< const QgsCurvePolygon * > polygons;
169 polygons.emplace_back( qgsgeometry_cast< const QgsCurvePolygon * >( ms->
geometryN( i ) ) );
174 polygons.emplace_back( qgsgeometry_cast< const QgsCurvePolygon * >( geom.
constGet() ) );
184 if ( polygon->exteriorRing() )
185 curves.emplace_back( polygon->exteriorRing() );
187 for (
int i = 0; i < polygon->numInteriorRings(); ++i )
191 curves.emplace_back( polygon->interiorRing( i ) );
204 curves.emplace_back( qgsgeometry_cast< const QgsCurve * >( mc->
geometryN( i ) ) );
209 curves.emplace_back( qgsgeometry_cast< const QgsCurve * >( geom.
constGet() ) );
213 for (
const QgsCurve *curve : curves )
222 curve->points( linePoints );
223 bool hasZ = curve->is3D();
224 if ( valueAttribute >= 0 )
225 for (
int i = 0; i < linePoints.count(); ++i )
230 linePoints[i].setZ( valueOnVertex );
233 const QgsPoint &point = linePoints.at( i );
234 linePoints[i] =
QgsPoint( point.
x(), point.
y(), valueOnVertex );
245 mDataset = std::make_unique< QgsMeshZValueDataset >( mesh );
255 if ( datasetIndex != 0 )
258 return mDataset->metadata();
268 return mDataset.get();
275 return QDomElement();
282 if ( vertex.
z() < mZMinimum )
283 mZMinimum = vertex.
z();
284 if ( vertex.
z() > mZMaximum )
285 mZMaximum = vertex.
z();
291 if ( valueIndex < 0 || valueIndex >= mMesh.
vertexCount() )
301 QVector<double> zValues( count );
302 for (
int i = valueIndex; i < valueIndex + count; ++i )
303 zValues[i - valueIndex] = mMesh.
vertex( i ).
z();
310 Q_UNUSED( faceIndex );
319 return ( faceIndex > 0 && faceIndex < mMesh.
faceCount() );
The vertex_iterator class provides STL-style iterator for vertices.
This class represents a coordinate reference system (CRS).
Custom exception class for Coordinate Reference System related exceptions.
Curve polygon geometry type.
Abstract base class for curved geometry type.
DualEdgeTriangulation is an implementation of a triangulation class based on the dual edge data struc...
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
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.
int numGeometries() const SIP_HOLDGIL
Returns the number of geometries within the collection.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
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.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
QgsWkbTypes::GeometryType type
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
@ SourceBreakLines
Break lines.
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
@ ScalarDouble
Scalar double values.
@ ActiveFlagInteger
Integer boolean flag whether face is active.
void setValues(const QVector< double > &vals)
Sets values.
void setValid(bool valid)
Sets block validity.
Abstract class that represents a dataset group.
void calculateStatistic()
Calculates the statistics (minimum and maximum)
QgsMeshDatasetValue represents single dataset value.
Abstract class that represents a dataset.
bool addBreakLines(QgsFeatureIterator &lineFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transformContext, QgsFeedback *feedback=nullptr, long featureCount=1)
Adds break lines from a vector layer, return true if successful.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the coordinate reference system used for the triangulation.
~QgsMeshTriangulation()
Destructor.
QgsMeshTriangulation()
Constructor.
bool addVertices(QgsFeatureIterator &vertexFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback=nullptr, long featureCount=1)
Adds vertices to the triangulation from a feature iterator, return true if successful.
QgsMesh triangulatedMesh(QgsFeedback *feedback=nullptr) const
Returns the triangulated mesh.
int datasetCount() const override
Returns the count of datasets in the group.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const override
Write dataset group information in a DOM element.
void initialize() override
Initialize the dataset group.
QgsMeshDataset * dataset(int index) const override
Returns the dataset with index.
QgsMeshDatasetMetadata datasetMetadata(int datasetIndex) const override
Returns the metadata of the dataset with index datasetIndex.
QgsMeshZValueDatasetGroup(const QString &datasetGroupName, const QgsMesh &mesh)
Constructor.
QgsMeshDataBlock areFacesActive(int faceIndex, int count) const override
Returns whether faces are active.
QgsMeshDatasetMetadata metadata() const override
Returns the metadata of the dataset.
QgsMeshZValueDataset(const QgsMesh &mesh)
Constructor with the mesh.
bool isActive(int faceIndex) const override
Returns whether the face is active.
int valuesCount() const override
Returns the values count.
QgsMeshDatasetValue datasetValue(int valueIndex) const override
Returns the value with index valueIndex.
QgsMeshDataBlock datasetValues(bool isScalar, int valueIndex, int count) const override
Returns count values from valueIndex.
Multi curve geometry collection.
Multi surface geometry collection.
Point geometry type, with support for z-dimension and m-values.
The class is used as a container of context for various read/write operations on other objects.
static GeometryType geometryType(Type type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
QVector< QgsPoint > QgsPointSequence
#define QgsDebugMsgLevel(str, level)
const QgsCoordinateReferenceSystem & crs
Mesh - vertices, edges and faces.
int vertexCount() const
Returns number of vertices.
QVector< QgsMeshVertex > vertices
int faceCount() const
Returns number of faces.
QgsMeshVertex vertex(int index) const
Returns a vertex at the index.