QGIS API Documentation 3.39.0-Master (be2050b798e)
Loading...
Searching...
No Matches
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 virtual void drawVector( 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;
134 QgsRectangle mBufferedExtent;
135 QPen mPen;
136
137 protected:
138 QgsRenderContext &mContext;
140 QSize mOutputSize;
141 QgsInterpolatedLineColor mVectorColoring;
142
143};
144
153class QgsMeshVectorWindBarbRenderer : public QgsMeshVectorArrowRenderer
154{
155 public:
157 QgsMeshVectorWindBarbRenderer( const QgsTriangularMesh &m,
158 const QgsMeshDataBlock &datasetValues,
159 const QVector<double> &datasetValuesMag,
160 double datasetMagMaximumValue,
161 double datasetMagMinimumValue,
163 const QgsMeshRendererVectorSettings &settings,
164 QgsRenderContext &context,
165 QSize size );
167 ~QgsMeshVectorWindBarbRenderer() override;
168
169 private:
170 void drawVector( const QgsPointXY &lineStart, double xVal, double yVal, double magnitude ) override;
171
172 QgsCoordinateTransform mGeographicTransform;
173
174};
175
177
178
179
180#endif // QGSMESHVECTORRENDERER_H
Class for doing transforms between two map coordinate systems.
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.
@ DataOnVertices
Data is defined on vertices.
Represents a renderer settings for vector datasets.
A class to represent a 2D point.
Definition qgspointxy.h:60
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Triangular/Derived Mesh is mesh with vertices in map coordinates.