QGIS API Documentation  3.6.0-Noosa (5873452)
qgsvectorlayer3drenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayer3drenderer.h
3  --------------------------------------
4  Date : July 2017
5  Copyright : (C) 2017 by Martin Dobias
6  Email : wonder dot sk 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 QGSVECTORLAYER3DRENDERER_H
17 #define QGSVECTORLAYER3DRENDERER_H
18 
19 #include "qgis_3d.h"
20 #include "qgis_sip.h"
21 
22 #include "qgs3drendererregistry.h"
23 #include "qgsabstract3drenderer.h"
24 #include "qgsabstract3dsymbol.h"
25 
27 
28 #include "qgsmaplayerref.h"
29 
30 #include <QObject>
31 
32 class QgsVectorLayer;
33 
34 
45 {
46  public:
48 
50  QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) override SIP_FACTORY;
51 };
52 
53 
61 {
62  public:
65 
67  void setLayer( QgsVectorLayer *layer );
69  QgsVectorLayer *layer() const;
70 
72  void setSymbol( QgsAbstract3DSymbol *symbol SIP_TRANSFER );
74  const QgsAbstract3DSymbol *symbol() const;
75 
76  QString type() const override { return "vector"; }
77  QgsVectorLayer3DRenderer *clone() const override SIP_FACTORY;
78  Qt3DCore::QEntity *createEntity( const Qgs3DMapSettings &map ) const override SIP_SKIP;
79 
80  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
81  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
82  void resolveReferences( const QgsProject &project ) override;
83 
84  private:
85  QgsMapLayerRef mLayerRef;
86  std::unique_ptr<QgsAbstract3DSymbol> mSymbol;
87 
88  private:
89 #ifdef SIP_RUN
92 #endif
93 };
94 
95 
96 #endif // QGSVECTORLAYER3DRENDERER_H
The class is used as a container of context for various read/write operations on other objects...
virtual void resolveReferences(const QgsProject &project)
Resolves references to other objects - second phase of loading - after readXml()
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.
3 Definition of the world
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
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:119
QString type() const override
Returns unique identifier of the renderer class (used to identify subclass)
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Reads and writes project states.
Definition: qgsproject.h:89
#define SIP_FACTORY
Definition: qgis_sip.h:69
3D renderer that renders all features of a vector layer with the same 3D symbol.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads renderer&#39;s properties from given XML element.
Metadata for vector layer 3D renderer to allow creation of its instances from XML.
virtual QgsAbstract3DRenderer * clone() const =0
Returns a cloned instance.
Base metadata class for 3D renderers.
Represents a vector layer which manages a vector based data sets.
virtual QgsAbstract3DRenderer * createRenderer(QDomElement &elem, const QgsReadWriteContext &context)=0
Returns new instance of the renderer given the DOM element.