QGIS API Documentation  3.6.0-Noosa (5873452)
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 "qgstriangularmesh.h"
30 #include "qgsmeshlayer.h"
31 #include "qgspointxy.h"
32 
33 class QgsRenderContext;
34 
36 
45 class QgsMeshVectorRenderer
46 {
47  public:
49  QgsMeshVectorRenderer( const QgsTriangularMesh &m,
50  const QgsMeshDataBlock &datasetValues,
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 QgsMeshDataBlock &mDatasetValues;
96  const QVector<double> &mDatasetValuesMag; //magnitudes
97  double mMinMag = 0.0;
98  double mMaxMag = 0.0;
99  QgsRenderContext &mContext;
100  const QgsMeshRendererVectorSettings &mCfg;
101  bool mDataOnVertices = true;
102  QSize mOutputSize;
103  QgsRectangle mBufferedExtent;
104 };
105 
107 
108 
109 
110 #endif // QGSMESHVECTORRENDERER_H
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Triangular/Derived Mesh is mesh with vertices in map coordinates.
A class to represent a 2D point.
Definition: qgspointxy.h:43
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e...
Represents a mesh renderer settings for vector datasets.
Contains information about the context of a rendering operation.