Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce intermediate base class QgsAbstractVectorLayer3DRenderer
This will be useful as we start adding more properties that are common among all vector layer 3D renderers (such as tiling configuration)
- Loading branch information
Showing
10 changed files
with
130 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*************************************************************************** | ||
qgsabstractvectorlayer3drenderer.cpp | ||
-------------------------------------- | ||
Date : January 2020 | ||
Copyright : (C) 2020 by Martin Dobias | ||
Email : wonder dot sk at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsabstractvectorlayer3drenderer.h" | ||
|
||
#include "qgsvectorlayer.h" | ||
|
||
|
||
QgsAbstractVectorLayer3DRenderer::QgsAbstractVectorLayer3DRenderer() | ||
{ | ||
} | ||
|
||
void QgsAbstractVectorLayer3DRenderer::setLayer( QgsVectorLayer *layer ) | ||
{ | ||
mLayerRef = QgsMapLayerRef( layer ); | ||
} | ||
|
||
QgsVectorLayer *QgsAbstractVectorLayer3DRenderer::layer() const | ||
{ | ||
return qobject_cast<QgsVectorLayer *>( mLayerRef.layer ); | ||
} | ||
|
||
void QgsAbstractVectorLayer3DRenderer::copyBaseProperties( QgsAbstractVectorLayer3DRenderer *r ) const | ||
{ | ||
r->mLayerRef = mLayerRef; | ||
} | ||
|
||
void QgsAbstractVectorLayer3DRenderer::writeXmlBaseProperties( QDomElement &elem, const QgsReadWriteContext &context ) const | ||
{ | ||
Q_UNUSED( context ) | ||
elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId ); | ||
} | ||
|
||
void QgsAbstractVectorLayer3DRenderer::readXmlBaseProperties( const QDomElement &elem, const QgsReadWriteContext &context ) | ||
{ | ||
Q_UNUSED( context ) | ||
mLayerRef = QgsMapLayerRef( elem.attribute( QStringLiteral( "layer" ) ) ); | ||
} | ||
|
||
void QgsAbstractVectorLayer3DRenderer::resolveReferences( const QgsProject &project ) | ||
{ | ||
mLayerRef.setLayer( project.mapLayer( mLayerRef.layerId ) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*************************************************************************** | ||
qgsabstractvectorlayer3drenderer.h | ||
-------------------------------------- | ||
Date : January 2020 | ||
Copyright : (C) 2020 by Martin Dobias | ||
Email : wonder dot sk at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSABSTRACTVECTORLAYER3DRENDERER_H | ||
#define QGSABSTRACTVECTORLAYER3DRENDERER_H | ||
|
||
#include "qgis_3d.h" | ||
|
||
#include "qgsabstract3drenderer.h" | ||
#include "qgsmaplayerref.h" | ||
|
||
class QgsVectorLayer; | ||
|
||
|
||
/** | ||
* \ingroup 3d | ||
* Base class for 3D renderers that are based on vector layers. | ||
* | ||
* \since QGIS 3.12 | ||
*/ | ||
class _3D_EXPORT QgsAbstractVectorLayer3DRenderer : public QgsAbstract3DRenderer | ||
{ | ||
public: | ||
QgsAbstractVectorLayer3DRenderer(); | ||
|
||
//! Sets vector layer associated with the renderer | ||
void setLayer( QgsVectorLayer *layer ); | ||
//! Returns vector layer associated with the renderer | ||
QgsVectorLayer *layer() const; | ||
|
||
void resolveReferences( const QgsProject &project ) override; | ||
|
||
protected: | ||
//! copy common properties of this object to another object | ||
void copyBaseProperties( QgsAbstractVectorLayer3DRenderer *r ) const; | ||
//! write common properties of this object to DOM element | ||
void writeXmlBaseProperties( QDomElement &elem, const QgsReadWriteContext &context ) const; | ||
//! read common properties of this object from DOM element | ||
void readXmlBaseProperties( const QDomElement &elem, const QgsReadWriteContext &context ); | ||
|
||
private: | ||
QgsMapLayerRef mLayerRef; //!< Layer used to extract polygons from | ||
}; | ||
|
||
#endif // QGSABSTRACTVECTORLAYER3DRENDERER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters