QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsmeshtriangulation.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmeshtriangulation.h
3 -----------------
4 begin : August 9th, 2020
5 copyright : (C) 2020 by Vincent Cloarec
6 email : vcloarec at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSMESHTRIANGULATION_H
18#define QGSMESHTRIANGULATION_H
19
20#include "qgis_analysis.h"
23#include "qgsmeshdataprovider.h"
24
25class QgsVectorLayer;
27class QgsFeature;
30class QgsFeedback;
31
40class ANALYSIS_EXPORT QgsMeshTriangulation : public QObject
41{
42 Q_OBJECT
43 public:
46
56 bool addVertices( QgsFeatureIterator &vertexFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = nullptr, long featureCount = 1 );
57
68 bool addBreakLines( QgsFeatureIterator &lineFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transformContext, QgsFeedback *feedback = nullptr, long featureCount = 1 );
69
75 int addVertex( const QgsPoint &vertex );
76
78 QgsMesh triangulatedMesh( QgsFeedback *feedback = nullptr ) const;
79
81 void setCrs( const QgsCoordinateReferenceSystem &crs );
82
83 private:
84#ifdef SIP_RUN
86#endif
87
89 std::unique_ptr<QgsTriangulation> mTriangulation;
90
91 void addVerticesFromFeature( const QgsFeature &feature, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = nullptr );
92 void addBreakLinesFromFeature( const QgsFeature &feature, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = nullptr );
93};
94
95#ifndef SIP_RUN
96
106{
107 public:
109 QgsMeshZValueDataset( const QgsMesh &mesh );
110
111 QgsMeshDatasetValue datasetValue( int valueIndex ) const override;
112 QgsMeshDataBlock datasetValues( bool isScalar, int valueIndex, int count ) const override;
113 QgsMeshDataBlock areFacesActive( int faceIndex, int count ) const override;
114 bool isActive( int faceIndex ) const override;
115 QgsMeshDatasetMetadata metadata() const override;
116 int valuesCount() const override;
117
118 private:
119 QgsMesh mMesh;
120 double mZMinimum = std::numeric_limits<double>::max();
121 double mZMaximum = -std::numeric_limits<double>::max();
122};
123
124#endif //SIP_RUN
125
134class ANALYSIS_EXPORT QgsMeshZValueDatasetGroup : public QgsMeshDatasetGroup
135{
136 public:
137
144 QgsMeshZValueDatasetGroup( const QString &datasetGroupName, const QgsMesh &mesh );
145
146 void initialize() override;
147 QgsMeshDatasetMetadata datasetMetadata( int datasetIndex ) const override;
148 int datasetCount() const override;
149 QgsMeshDataset *dataset( int index ) const override;
151 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
152
153 private:
154#ifdef SIP_RUN
156#endif
157 std::unique_ptr<QgsMeshZValueDataset> mDataset;
158};
159
160
171{
172 public:
174
175 QString text() const override;
176
177 private:
178 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
179};
180
181#endif // QGSMESHTRIANGULATION_H
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Handles coordinate transforms between two coordinate systems.
Wrapper for iterator of features from vector data provider or vector layer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
A block of integers/doubles from a mesh dataset.
QgsMeshDatasetGroup()=default
Type
Type of the dataset group.
@ Virtual
Virtual Dataset group defined by a formula.
Represents mesh dataset metadata, such as whether the data is valid or the associated time.
Represents a single mesh dataset value.
Abstract class that represents a mesh dataset.
QgsMeshDataset()=default
QString text() const override
Returns a short text string describing what this advanced edit does. Default implementation return a ...
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.
~QgsMeshTriangulation() override
int addVertex(const QgsPoint &vertex)
Adds a new vertex in the triangulation and returns the index of the new vertex.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the coordinate reference system used for the triangulation.
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.
Convenience class that can be used to obtain a dataset group on vertices that represents the Z value ...
int datasetCount() const override
Returns the count of datasets in the group.
void initialize() override
Initialize the dataset group.
QgsMeshDataset * dataset(int index) const override
Returns the dataset with index.
QgsMeshDatasetGroup::Type type() const override
Returns the type of dataset group.
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.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
A container for the context for various read/write operations on objects.
Contains topological differences between two states of a topological mesh, only accessible from the Q...
Interface for Triangulation classes.
Represents a vector layer which manages a vector based dataset.
Mesh - vertices, edges and faces.