QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsmeshvectorrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstriangularmesh.h
3  -------------------
4  begin : April 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 "qgsrendercontext.h"
30 #include "qgstriangularmesh.h"
31 #include "qgsmeshlayer.h"
32 #include "qgspointxy.h"
33 
35 
44 class QgsMeshVectorRenderer
45 {
46  public:
48  QgsMeshVectorRenderer( const QgsTriangularMesh &m,
49  const QVector<double> &datasetValuesX,
50  const QVector<double> &datasetValuesY,
51  const QVector<double> &datasetValuesMag,
52  double datasetMagMaximumValue,
53  double datasetMagMinimumValue,
54  bool dataIsOnVertices,
55  const QgsMeshRendererVectorSettings &settings,
56  QgsRenderContext &context,
57  QSize size );
59  ~QgsMeshVectorRenderer();
60 
64  void draw();
65 
66  private:
68  void drawVectorDataOnVertices( const QList<int> &trianglesInExtent );
70  void drawVectorDataOnFaces( const QList<int> &trianglesInExtent );
72  void drawVectorDataOnGrid( const QList<int> &trianglesInExtent );
74  void drawVectorArrow( const QgsPointXY &lineStart, double xVal, double yVal, double magnitude );
76  bool calcVectorLineEnd( QgsPointXY &lineEnd,
77  double &vectorLength,
78  double &cosAlpha,
79  double &sinAlpha, //out
80  const QgsPointXY &lineStart,
81  double xVal,
82  double yVal,
83  double magnitude //in
84  );
85 
92  double calcExtentBufferSize() const;
93 
94  const QgsTriangularMesh &mTriangularMesh;
95  const QVector<double> &mDatasetValuesX;
96  const QVector<double> &mDatasetValuesY;
97  const QVector<double> &mDatasetValuesMag; //magnitudes
98  double mMinMag = 0.0;
99  double mMaxMag = 0.0;
100  QgsRenderContext &mContext;
101  const QgsMeshRendererVectorSettings &mCfg;
102  bool mDataOnVertices = true;
103  QSize mOutputSize;
104  QgsRectangle mBufferedExtent;
105 };
106 
108 
109 
110 
111 #endif // QGSMESHVECTORRENDERER_H
A rectangle specified with double values.
Definition: qgsrectangle.h:40
Triangular/Derived Mesh is mesh with vertices in map coordinates.
A class to represent a 2D point.
Definition: qgspointxy.h:43
Represents a mesh renderer settings for vector datasets.
Contains information about the context of a rendering operation.