QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsmeshlayerrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshlayerrenderer.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 QGSMESHLAYERRENDERER_H
19 #define QGSMESHLAYERRENDERER_H
20 
21 class QgsMeshLayer;
22 class QgsSymbol;
23 
24 #define SIP_NO_FILE
25 
26 #include <memory>
27 
28 #include "qgis.h"
29 
30 #include "qgsmaplayerrenderer.h"
31 #include "qgsrasterinterface.h"
32 #include "qgsrendercontext.h"
33 #include "qgstriangularmesh.h"
34 #include "qgsmeshlayer.h"
35 #include "qgssymbol.h"
36 
38 
43 class QgsMeshLayerRendererFeedback : public QgsRasterBlockFeedback
44 {
45 };
46 
48 
49 
58 {
59  public:
62  ~QgsMeshLayerRenderer() override = default;
63  QgsFeedback *feedback() const override;
64  bool render() override;
65 
66  private:
67  void renderMesh( const std::unique_ptr<QgsSymbol> &symbol, const QVector<QgsMeshFace> &faces );
68  void renderScalarDataset();
69  void renderVectorDataset();
70  void copyScalarDatasetValues( QgsMeshLayer *layer );
71  void copyVectorDatasetValues( QgsMeshLayer *layer );
72  void createMeshSymbol( std::unique_ptr<QgsSymbol> &symbol, const QgsMeshRendererMeshSettings &settings );
73  void calculateOutputSize();
74 
75  protected:
77  std::unique_ptr<QgsMeshLayerRendererFeedback> mFeedback;
78 
79  // copy from mesh layer
81 
82  // copy from mesh layer
84 
85  // copy of the scalar dataset
86  QVector<double> mScalarDatasetValues;
87  bool mScalarDataOnVertices = true;
88 
89  // copy of the vector dataset
90  QVector<double> mVectorDatasetValuesX;
91  QVector<double> mVectorDatasetValuesY;
92  QVector<double> mVectorDatasetValuesMag;
93  bool mVectorDataOnVertices = true;
94 
95  // copy from mesh layer
96  std::unique_ptr<QgsSymbol> mNativeMeshSymbol = nullptr;
97 
98  // copy from mesh layer
99  std::unique_ptr<QgsSymbol> mTriangularMeshSymbol = nullptr;
100 
101  // rendering context
103 
104  // copy of rendering settings
109 
110  // output screen size
111  QSize mOutputSize;
112 };
113 
114 
115 #endif // QGSMESHLAYERRENDERER_H
QVector< double > mVectorDatasetValuesX
Triangular/Derived Mesh.
Represents a mesh renderer settings for mesh object.
Represents a mesh renderer settings for scalar datasets.
QVector< double > mScalarDatasetValues
Implementation of threaded rendering for mesh layers.
QVector< double > mVectorDatasetValuesMag
QgsTriangularMesh mTriangularMesh
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:44
Represents a mesh renderer settings for vector datasets.
QgsMeshRendererScalarSettings mRendererScalarSettings
QVector< double > mVectorDatasetValuesY
std::unique_ptr< QgsMeshLayerRendererFeedback > mFeedback
feedback class for cancelation
QgsMeshRendererVectorSettings mRendererVectorSettings
QgsRenderContext & mContext
Contains information about the context of a rendering operation.
Mesh - vertices and faces.
QgsMeshRendererMeshSettings mRendererNativeMeshSettings
Base class for utility classes that encapsulate information necessary for rendering of map layers...
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:90
QgsMeshRendererMeshSettings mRendererTriangularMeshSettings
Feedback object tailored for raster block reading.