Branch data Line data Source code
1 : : /*************************************************************************** 2 : : qgsabstract3drenderer.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 QGSABSTRACT3DRENDERER_H 17 : : #define QGSABSTRACT3DRENDERER_H 18 : : 19 : : #include "qgis_core.h" 20 : : #include "qgis_sip.h" 21 : : 22 : : #include <QString> 23 : : 24 : : class QDomElement; 25 : : class QgsProject; 26 : : class QgsReadWriteContext; 27 : : class Qgs3DMapSettings; 28 : : 29 : : #ifndef SIP_RUN 30 : : namespace Qt3DCore 31 : : { 32 : : class QEntity; 33 : : } 34 : : #endif 35 : : 36 : : /** 37 : : * \ingroup core 38 : : * \brief Base class for all renderers that may to participate in 3D view. 39 : : * 40 : : * 3D renderers implement the method createEntity() that returns a new 3D entity - that entity 41 : : * will be added to the 3D scene to represent data in renderer's display style. 42 : : * 43 : : * Renderers may store some custom properties (e.g. materials, sizes) that are written to and read from 44 : : * XML. It is therefore not recommended to store large amount of data within a renderer (e.g. arrays of vertices). 45 : : * 46 : : * \since QGIS 3.0 47 : : */ 48 : : class CORE_EXPORT QgsAbstract3DRenderer SIP_ABSTRACT 49 : : { 50 : : public: 51 : 0 : virtual ~QgsAbstract3DRenderer() = default; 52 : : 53 : : //! Returns unique identifier of the renderer class (used to identify subclass) 54 : : virtual QString type() const = 0; 55 : : //! Returns a cloned instance 56 : : virtual QgsAbstract3DRenderer *clone() const = 0 SIP_FACTORY; 57 : : //! Returns a 3D entity that will be used to show renderer's data in 3D scene 58 : : virtual Qt3DCore::QEntity *createEntity( const Qgs3DMapSettings &map ) const = 0 SIP_SKIP; 59 : : 60 : : //! Writes renderer's properties to given XML element 61 : : virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const = 0; 62 : : //! Reads renderer's properties from given XML element 63 : : virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0; 64 : : //! Resolves references to other objects - second phase of loading - after readXml() 65 : : virtual void resolveReferences( const QgsProject &project ); 66 : : 67 : : protected: 68 : : //! Default constructor 69 : : QgsAbstract3DRenderer() = default; 70 : : 71 : : private: 72 : : #ifdef SIP_RUN 73 : : QgsAbstract3DRenderer( const QgsAbstract3DRenderer & ); 74 : : QgsAbstract3DRenderer &operator=( const QgsAbstract3DRenderer & ); 75 : : #endif 76 : : 77 : : Q_DISABLE_COPY( QgsAbstract3DRenderer ) 78 : : }; 79 : : 80 : : 81 : : #endif // QGSABSTRACT3DRENDERER_H