QGIS API Documentation  3.2.0-Bonn (bc43194)
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  bool dataIsOnVertices,
53  const QgsMeshRendererVectorSettings &settings,
54  QgsRenderContext &context,
55  const QSize &size );
57  ~QgsMeshVectorRenderer();
58 
62  void draw();
63 
64  private:
66  void drawVectorDataOnVertices();
68  void drawVectorDataOnFaces();
70  void drawVectorArrow( const QgsPointXY &lineStart, double xVal, double yVal, double magnitude );
72  bool calcVectorLineEnd( QgsPointXY &lineEnd,
73  double &vectorLength,
74  double &cosAlpha,
75  double &sinAlpha, //out
76  const QgsPointXY &lineStart,
77  double xVal,
78  double yVal,
79  double magnitude //in
80  );
81 
82 
83  const QgsTriangularMesh &mTriangularMesh;
84  const QVector<double> &mDatasetValuesX;
85  const QVector<double> &mDatasetValuesY;
86  const QVector<double> &mDatasetValuesMag; //magnitudes
87  double mMinX = 0.0;
88  double mMaxX = 0.0;
89  double mMinY = 0.0;
90  double mMaxY = 0.0;
91  double mMinMag = 0.0;
92  double mMaxMag = 0.0;
93  QgsRenderContext &mContext;
95  bool mDataOnVertices = true;
96  QSize mOutputSize;
97 };
98 
100 
101 
102 
103 #endif // QGSMESHVECTORRENDERER_H
Triangular/Derived Mesh.
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.