QGIS API Documentation 3.41.0-Master (57ec4277f5e)
Loading...
Searching...
No Matches
qgstiledscenetexturerendererwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgstiledscenetexturerendererwidget.cpp
3 ---------------------
4 begin : August 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson 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
19#include "moc_qgstiledscenetexturerendererwidget.cpp"
20#include "qgstiledscenelayer.h"
22#include "qgsfillsymbol.h"
23
25
26QgsTiledSceneTextureRendererWidget::QgsTiledSceneTextureRendererWidget( QgsTiledSceneLayer *layer, QgsStyle *style )
27 : QgsTiledSceneRendererWidget( layer, style )
28{
29 setupUi( this );
30
31 mFillSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
32 mFillSymbolButton->setSymbol( QgsTiledSceneTextureRenderer::createDefaultFillSymbol() );
33
34 if ( layer )
35 {
36 setFromRenderer( layer->renderer() );
37 }
38
39 connect( mFillSymbolButton, &QgsSymbolButton::changed, this, &QgsTiledSceneTextureRendererWidget::emitWidgetChanged );
40}
41
42QgsTiledSceneRendererWidget *QgsTiledSceneTextureRendererWidget::create( QgsTiledSceneLayer *layer, QgsStyle *style, QgsTiledSceneRenderer * )
43{
44 return new QgsTiledSceneTextureRendererWidget( layer, style );
45}
46
47QgsTiledSceneRenderer *QgsTiledSceneTextureRendererWidget::renderer()
48{
49 std::unique_ptr<QgsTiledSceneTextureRenderer> renderer = std::make_unique<QgsTiledSceneTextureRenderer>();
50 renderer->setFillSymbol( mFillSymbolButton->clonedSymbol<QgsFillSymbol>() );
51
52 return renderer.release();
53}
54
55void QgsTiledSceneTextureRendererWidget::emitWidgetChanged()
56{
57 if ( !mBlockChangedSignal )
58 emit widgetChanged();
59}
60
61void QgsTiledSceneTextureRendererWidget::setFromRenderer( const QgsTiledSceneRenderer *renderer )
62{
63 mBlockChangedSignal = true;
64
65 if ( const QgsTiledSceneTextureRenderer *textureRenderer = dynamic_cast<const QgsTiledSceneTextureRenderer *>( renderer ) )
66 {
67 mFillSymbolButton->setSymbol( textureRenderer->fillSymbol()->clone() );
68 }
69
70 mBlockChangedSignal = false;
71}
72
@ Fill
Fill symbol.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void changed()
Emitted when the symbol's settings are changed.
Represents a map layer supporting display of tiled scene objects.
QgsTiledSceneRenderer * renderer()
Returns the 2D renderer for the tiled scene.
Base class for tiled scene 2D renderer settings widgets.
Abstract base class for 2d tiled scene renderers.
Renders tiled scene layers using textures.
static QgsFillSymbol * createDefaultFillSymbol()
Returns a copy of the default fill symbol used to render triangles without textures.