QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
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 = qgis::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() );
Abstract base class for curved geometry type.
void setProgress(double progress)
Sets the current progress for the feedback object.
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.
QgsMeshDatasetMetadata datasetMetadata(int datasetIndex) const override
Returns the metadata of the dataset with index datasetIndex.
The class is used as a container of context for various read/write operations on other objects.
@ ScalarDouble
Scalar double values.
~QgsMeshTriangulation()
Destructor.
Point geometry type, with support for z-dimension and m-values.
#define QgsDebugMsgLevel(str, level)
const QgsCoordinateReferenceSystem & crs
Curve polygon geometry type.
QgsMeshDatasetValue represents single dataset value.
QgsMeshDataBlock areFacesActive(int faceIndex, int count) const override
Returns whether faces are active.
int valuesCount() const override
Returns the values count.
Abstract class that represents a dataset.
QgsMeshDatasetValue datasetValue(int valueIndex) const override
Returns the value with index valueIndex.
Mesh - vertices, edges and faces.
QgsMeshTriangulation()
Constructor.
Multi surface geometry collection.
int numGeometries() const SIP_HOLDGIL
Returns the number of geometries within the collection.
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
Custom exception class for Coordinate Reference System related exceptions.
int faceCount() const
Returns number of faces.
QgsMeshDataBlock datasetValues(bool isScalar, int valueIndex, int count) const override
Returns count values from valueIndex.
int vertexCount() const
Returns number of vertices.
bool isActive(int faceIndex) const override
Returns whether the face is active.
Multi curve geometry collection.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
int datasetCount() const override
Returns the count of datasets in the group.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
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.
QgsMesh triangulatedMesh(QgsFeedback *feedback=nullptr) const
Returns the triangulated mesh.
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
This class represents a coordinate reference system (CRS).
void setValid(bool valid)
Sets block validity.
Abstract class that represents a dataset group.
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.
bool isCanceled() const
Tells whether the operation has been canceled already.
@ SourceBreakLines
Break lines.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const override
Write dataset group information in a DOM element.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
The vertex_iterator class provides STL-style iterator for vertices.
bool nextFeature(QgsFeature &f)
QVector< QgsPoint > QgsPointSequence
A geometry is the spatial representation of a feature.
@ ActiveFlagInteger
Integer boolean flag whether face is active.
void setValues(const QVector< double > &vals)
Sets values.
QgsMeshZValueDatasetGroup(const QString &datasetGroupName, const QgsMesh &mesh)
Constructor.
QVector< QgsMeshVertex > vertices
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the coordinate reference system used for the triangulation.
QgsMeshZValueDataset(const QgsMesh &mesh)
Constructor with the mesh.
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...
void calculateStatistic()
Calculates the statictics (minimum and maximum)
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsMeshDataset * dataset(int index) const override
Returns the dataset with index.
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
QgsWkbTypes::GeometryType type
QgsMeshVertex vertex(int index) const
Returns a vertex at the index.
Wrapper for iterator of features from vector data provider or vector layer.
QgsMeshDatasetMetadata metadata() const override
Returns the metadata of the dataset.
void initialize() override
Initialize the dataset group.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
DualEdgeTriangulation is an implementation of a triangulation class based on the dual edge data struc...