QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
21#include "qgsmeshdataprovider.h"
23
24#include "qgis_analysis.h"
25
26
27class QgsVectorLayer;
29class QgsFeature;
32class QgsFeedback;
33
42class ANALYSIS_EXPORT QgsMeshTriangulation : public QObject
43{
44 Q_OBJECT
45 public:
48
58 bool addVertices( QgsFeatureIterator &vertexFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = nullptr, long featureCount = 1 );
59
70 bool addBreakLines( QgsFeatureIterator &lineFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transformContext, QgsFeedback *feedback = nullptr, long featureCount = 1 );
71
77 int addVertex( const QgsPoint &vertex );
78
80 QgsMesh triangulatedMesh( QgsFeedback *feedback = nullptr ) const;
81
83 void setCrs( const QgsCoordinateReferenceSystem &crs );
84
85 private:
86#ifdef SIP_RUN
88#endif
89
91 std::unique_ptr<QgsTriangulation> mTriangulation;
92
93 void addVerticesFromFeature( const QgsFeature &feature, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = nullptr );
94 void addBreakLinesFromFeature( const QgsFeature &feature, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = nullptr );
95};
96
97#ifndef SIP_RUN
98
108{
109 public:
111 QgsMeshZValueDataset( const QgsMesh &mesh );
112
113 QgsMeshDatasetValue datasetValue( int valueIndex ) const override;
114 QgsMeshDataBlock datasetValues( bool isScalar, int valueIndex, int count ) const override;
115 QgsMeshDataBlock areFacesActive( int faceIndex, int count ) const override;
116 bool isActive( int faceIndex ) const override;
117 QgsMeshDatasetMetadata metadata() const override;
118 int valuesCount() const override;
119
120 private:
121 QgsMesh mMesh;
122 double mZMinimum = std::numeric_limits<double>::max();
123 double mZMaximum = -std::numeric_limits<double>::max();
124};
125
126#endif //SIP_RUN
127
136class ANALYSIS_EXPORT QgsMeshZValueDatasetGroup : public QgsMeshDatasetGroup
137{
138 public:
145 QgsMeshZValueDatasetGroup( const QString &datasetGroupName, const QgsMesh &mesh );
146
147 void initialize() override;
148 QgsMeshDatasetMetadata datasetMetadata( int datasetIndex ) const override;
149 int datasetCount() const override;
150 QgsMeshDataset *dataset( int index ) const override;
152 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const override;
153
154 private:
155#ifdef SIP_RUN
157#endif
158 std::unique_ptr<QgsMeshZValueDataset> mDataset;
159};
160
161
172{
173 public:
175
176 QString text() const override;
177
178 private:
179 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
180};
181
182#endif // QGSMESHTRIANGULATION_H
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Class for doing transforms between two map 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
Abstract class that can be derived to implement advanced editing on mesh.
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
Abstract class that represents a dataset group.
Type
Type of the dataset group.
@ Virtual
Virtual Dataset group defined by a formula.
QgsMeshDatasetMetadata is a collection of mesh dataset metadata such as whether the data is valid or ...
QgsMeshDatasetValue represents single dataset value.
Abstract class that represents a dataset.
Class that can be used with QgsMeshEditor::advancedEdit() to add triangle faces to a mesh created by ...
Class that makes edit operation on a mesh.
Class that handles mesh creation with Delaunay constrained triangulation.
Convenient class that can be used to obtain a datasetgroup on vertices that represents the Z value of...
QgsMeshDatasetGroup::Type type() const override
Returns the type of dataset group.
Convenient class that can be used to obtain a dataset that represents the Z values of mesh vertices.
QgsMeshDataBlock areFacesActive(int faceIndex, int count) const override
Returns whether faces are active.
QgsMeshDatasetMetadata metadata() const override
Returns the metadata of the dataset.
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
The class is used as a container of context for various read/write operations on other objects.
Class that contains topological differences between two states of a topological mesh,...
Interface for Triangulation classes.
Represents a vector layer which manages a vector based data sets.
const QgsCoordinateReferenceSystem & crs
Mesh - vertices, edges and faces.