QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsmeshlayer3drenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshlayer3drenderer.h
3  ------------------------
4  Date : January 2019
5  Copyright : (C) 2019 by Peter Petrik
6  Email : zilolv at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMESHLAYER3DRENDERER_H
17 #define QGSMESHLAYER3DRENDERER_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgs3drendererregistry.h"
22 #include "qgsabstract3drenderer.h"
23 #include "qgsmesh3dsymbol.h"
24 
26 #include "qgsmaplayerref.h"
27 
28 #include <QObject>
29 
30 class QgsMeshLayer;
31 
32 
42 {
43  public:
45 
47  QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) override SIP_FACTORY;
48 };
49 
50 
57 {
58  public:
60  explicit QgsMeshLayer3DRenderer( QgsMesh3DSymbol *s SIP_TRANSFER = nullptr );
61 
63  void setLayer( QgsMeshLayer *layer );
65  QgsMeshLayer *layer() const;
66 
68  void setSymbol( QgsMesh3DSymbol *symbol SIP_TRANSFER );
70  const QgsMesh3DSymbol *symbol() const;
71 
72  QString type() const override { return "mesh"; }
73  QgsMeshLayer3DRenderer *clone() const override SIP_FACTORY;
74  Qt3DCore::QEntity *createEntity( const Qgs3DMapSettings &map ) const override SIP_SKIP;
75 
76  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
77  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
78  void resolveReferences( const QgsProject &project ) override;
79 
80 
81  private:
82  QgsMapLayerRef mLayerRef;
83  std::unique_ptr<QgsMesh3DSymbol> mSymbol;
84 
85  private:
86 #ifdef SIP_RUN
88  QgsMeshLayer3DRenderer &operator=( const QgsMeshLayer3DRenderer & );
89 #endif
90 };
91 
92 #endif // QGSMESHLAYER3DRENDERER_H
The class is used as a container of context for various read/write operations on other objects...
QString type() const override
Returns unique identifier of the renderer class (used to identify subclass)
virtual void resolveReferences(const QgsProject &project)
Resolves references to other objects - second phase of loading - after readXml()
3 3D symbol that draws mesh geometry as planar triangles.
Base class for all renderers that may to participate in 3D view.
virtual Qt3DCore::QEntity * createEntity(const Qgs3DMapSettings &map) const =0
Returns a 3D entity that will be used to show renderer&#39;s data in 3D scene.
3D renderer that renders all mesh triangles of a mesh layer.
3 Definition of the world
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes renderer&#39;s properties to given XML element.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
Definition: qgsproject.h:89
#define SIP_FACTORY
Definition: qgis_sip.h:76
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads renderer&#39;s properties from given XML element.
Metadata for mesh layer 3D renderer to allow creation of its instances from XML.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:90
virtual QgsAbstract3DRenderer * clone() const =0
Returns a cloned instance.
Base metadata class for 3D renderers.
virtual QgsAbstract3DRenderer * createRenderer(QDomElement &elem, const QgsReadWriteContext &context)=0
Returns new instance of the renderer given the DOM element.