QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgsmeshvectorrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmeshvectorrenderer.h
3 -------------------
4 begin : May 2018
5 copyright : (C) 2018 by Peter Petrik
6 email : zilolv 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 QGSMESHVECTORRENDERER_H
19#define QGSMESHVECTORRENDERER_H
20
21
22#define SIP_NO_FILE
23
24#include <QVector>
25#include <QSize>
26
27#include "qgis_core.h"
28#include "qgsmeshdataprovider.h"
29#include "qgstriangularmesh.h"
30#include "qgsmeshlayer.h"
31#include "qgspointxy.h"
32
35class QgsMeshLayerRendererFeedback;
37
38
39class QgsMeshVectorRenderer
40{
41 public:
43 QgsMeshVectorRenderer() = default;
44
48 virtual ~QgsMeshVectorRenderer();
49
50 virtual void draw() = 0;
51
53 static QgsMeshVectorRenderer *makeVectorRenderer( const QgsTriangularMesh &m,
54 const QgsMeshDataBlock &datasetVectorValues,
55 const QgsMeshDataBlock &scalarActiveFaceFlagValues,
56 const QVector<double> &datasetValuesMag,
57 double datasetMagMaximumValue,
58 double datasetMagMinimumValue,
60 const QgsMeshRendererVectorSettings &settings,
61 QgsRenderContext &context,
62 const QgsRectangle &layerExtent,
63 QgsMeshLayerRendererFeedback *feedBack,
64 const QSize &size );
65};
66
75class QgsMeshVectorArrowRenderer : public QgsMeshVectorRenderer
76{
77 public:
79 QgsMeshVectorArrowRenderer( const QgsTriangularMesh &m,
80 const QgsMeshDataBlock &datasetValues,
81 const QVector<double> &datasetValuesMag,
82 double datasetMagMaximumValue,
83 double datasetMagMinimumValue,
85 const QgsMeshRendererVectorSettings &settings,
86 QgsRenderContext &context,
87 QSize size );
89 ~QgsMeshVectorArrowRenderer() override;
90
94 void draw() override;
95
96 private:
98 void drawVectorDataOnVertices( );
100 void drawVectorDataOnFaces( );
102 void drawVectorDataOnEdges( );
104 void drawVectorDataOnPoints( const QSet<int> indexesToRender, const QVector<QgsMeshVertex> &points );
106 void drawVectorDataOnGrid( );
108 void drawVectorArrow( const QgsPointXY &lineStart, double xVal, double yVal, double magnitude );
110 bool calcVectorLineEnd( QgsPointXY &lineEnd,
111 double &vectorLength,
112 double &cosAlpha,
113 double &sinAlpha, //out
114 const QgsPointXY &lineStart,
115 double xVal,
116 double yVal,
117 double magnitude //in
118 );
119
126 double calcExtentBufferSize() const;
127
128 const QgsTriangularMesh &mTriangularMesh;
129 const QgsMeshDataBlock &mDatasetValues;
130 const QVector<double> &mDatasetValuesMag; //magnitudes
131 double mMinMag = 0.0;
132 double mMaxMag = 0.0;
133 QgsRenderContext &mContext;
135 QgsMeshDatasetGroupMetadata::DataType mDataType = QgsMeshDatasetGroupMetadata::DataType::DataOnVertices;
136 QSize mOutputSize;
137 QgsRectangle mBufferedExtent;
138 QPen mPen;
139
140 QgsInterpolatedLineColor mVectorColoring;
141
142};
143
144
145
147
148
149
150#endif // QGSMESHVECTORRENDERER_H
Class defining color to render mesh datasets.
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
DataType
Location of where data is specified for datasets in the dataset group.
Represents a renderer settings for vector datasets.
A class to represent a 2D point.
Definition: qgspointxy.h:59
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Contains information about the context of a rendering operation.
Triangular/Derived Mesh is mesh with vertices in map coordinates.