QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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:
42
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 );
88 ~QgsMeshVectorArrowRenderer() override;
89
93 void draw() override;
94
95 private:
97 void drawVectorDataOnVertices( );
99 void drawVectorDataOnFaces( );
101 void drawVectorDataOnEdges( );
103 void drawVectorDataOnPoints( const QSet<int> indexesToRender, const QVector<QgsMeshVertex> &points );
105 void drawVectorDataOnGrid( );
107 virtual void drawVector( const QgsPointXY &lineStart, double xVal, double yVal, double magnitude );
109 bool calcVectorLineEnd( QgsPointXY &lineEnd,
110 double &vectorLength,
111 double &cosAlpha,
112 double &sinAlpha, //out
113 const QgsPointXY &lineStart,
114 double xVal,
115 double yVal,
116 double magnitude //in
117 );
118
125 double calcExtentBufferSize() const;
126
127 const QgsTriangularMesh &mTriangularMesh;
128 const QgsMeshDataBlock &mDatasetValues;
129 const QVector<double> &mDatasetValuesMag; //magnitudes
130 double mMinMag = 0.0;
131 double mMaxMag = 0.0;
133 QgsRectangle mBufferedExtent;
134 QPen mPen;
135
136 protected:
137 QgsRenderContext &mContext;
139 QSize mOutputSize;
140 QgsInterpolatedLineColor mVectorColoring;
141
142};
143
152class QgsMeshVectorWindBarbRenderer : public QgsMeshVectorArrowRenderer
153{
154 public:
156 QgsMeshVectorWindBarbRenderer( const QgsTriangularMesh &m,
157 const QgsMeshDataBlock &datasetValues,
158 const QVector<double> &datasetValuesMag,
159 double datasetMagMaximumValue,
160 double datasetMagMinimumValue,
162 const QgsMeshRendererVectorSettings &settings,
163 QgsRenderContext &context,
164 QSize size );
165 ~QgsMeshVectorWindBarbRenderer() override;
166
167 private:
168 void drawVector( const QgsPointXY &lineStart, double xVal, double yVal, double magnitude ) override;
169
170 QgsCoordinateTransform mGeographicTransform;
171
172};
173
175
176
177
178#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.