QGIS API Documentation 4.3.0-Master (16649ce5cc6)
Loading...
Searching...
No Matches
qgsmeshvectorfieldvaluesource.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmeshvectorfieldvaluesource.h
3 -------------------------------
4 begin : September 2026
5 copyright : (C) 2026 by Stefanos Natsis
6 email : uclaros 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
18#ifndef QGSMESHVECTORFIELDVALUESOURCE_H
19#define QGSMESHVECTORFIELDVALUESOURCE_H
20
21#include "qgsmeshdataset.h"
22#include "qgstriangularmesh.h"
24
25#define SIP_NO_FILE
26
28
40class QgsMeshVectorFieldValueSource : public QgsVectorFieldValueSource
41{
42 public:
51 QgsMeshVectorFieldValueSource(
52 const QgsTriangularMesh &triangularMesh,
53 const QgsMeshDataBlock &datasetVectorValues,
54 const QgsMeshDataBlock &scalarActiveFaceFlagValues,
55 const QVector<double> &datasetMagnitudeValues,
57 const QgsRectangle &layerExtent,
58 double maximumMagnitude
59 );
60
65 static std::unique_ptr<QgsMeshVectorFieldValueSource> create(
66 const QgsTriangularMesh &triangularMesh,
67 const QgsMeshDataBlock &datasetVectorValues,
68 const QgsMeshDataBlock &scalarActiveFaceFlagValues,
69 const QVector<double> &datasetMagnitudeValues,
71 const QgsRectangle &layerExtent,
72 double maximumMagnitude
73 );
74
75 QgsVector vectorValue( const QgsPointXY &point ) const override;
76 QgsRectangle extent() const override;
77 double maximumMagnitude() const override;
78 QVector<QgsPointXY> seedPoints( const QgsRectangle &extent ) const override;
79
83 std::unique_ptr<QgsRasterInterface> magnitudeSource( const QgsRenderContext &context, QSize size ) const override;
84
85 protected:
86 virtual QgsVector interpolatedValuePrivate( int faceIndex, const QgsPointXY point ) const = 0;
87
88 bool isVectorValid( const QgsVector &v ) const;
89
90 QgsTriangularMesh mTriangularMesh;
91 QgsMeshDataBlock mDatasetValues;
92 QgsMeshDataBlock mActiveFaceFlagValues;
93 QVector<double> mMagnitudeValues;
95 QgsRectangle mExtent;
96 double mMaximumMagnitude = 0;
97 bool mUseScalarActiveFaceFlagValues = false;
98 mutable int mCacheFaceIndex = -1;
99
100 private:
101 void activeFaceFilter( QgsVector &vector, int faceIndex ) const;
102};
103
112class QgsMeshVectorFieldValueSourceFromVertex : public QgsMeshVectorFieldValueSource
113{
114 public:
115 using QgsMeshVectorFieldValueSource::QgsMeshVectorFieldValueSource;
116
117 QgsMeshVectorFieldValueSourceFromVertex *clone() const override;
118
119 private:
120 QgsVector interpolatedValuePrivate( int faceIndex, const QgsPointXY point ) const override;
121};
122
131class QgsMeshVectorFieldValueSourceFromFace : public QgsMeshVectorFieldValueSource
132{
133 public:
134 using QgsMeshVectorFieldValueSource::QgsMeshVectorFieldValueSource;
135
136 QgsMeshVectorFieldValueSourceFromFace *clone() const override;
137
138 private:
139 QgsVector interpolatedValuePrivate( int faceIndex, const QgsPointXY point ) const override;
140};
141
143
144#endif // QGSMESHVECTORFIELDVALUESOURCE_H
A block of integers/doubles from a mesh dataset.
DataType
Location of where data is specified for datasets in the dataset group.
@ DataOnVertices
Data is defined on vertices.
Represents a 2D point.
Definition qgspointxy.h:62
A rectangle specified with double values.
Contains information about the context of a rendering operation.
A triangular/derived mesh with vertices in map coordinates.
Abstract source of vector (u/v) values sampled at arbitrary map positions.
virtual QgsRectangle extent() const =0
Returns the extent of the data, in map coordinates.
virtual std::unique_ptr< QgsRasterInterface > magnitudeSource(const QgsRenderContext &context, QSize size) const
Returns a raster interface exposing the magnitude of the vector field as a single band,...
virtual QVector< QgsPointXY > seedPoints(const QgsRectangle &extent) const
Returns the natural seeding positions of the data within extent, in map coordinates.
virtual double maximumMagnitude() const =0
Returns the maximum magnitude over the whole data.
virtual QgsVector vectorValue(const QgsPointXY &point) const =0
Returns the vector value at point, expressed in map coordinates.
Represent a 2-dimensional vector.
Definition qgsvector.h:34