QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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 "qgstiledscenelayer.h"
21#include "qgsfillsymbol.h"
22
24
25QgsTiledSceneTextureRendererWidget::QgsTiledSceneTextureRendererWidget( QgsTiledSceneLayer *layer, QgsStyle *style )
26 : QgsTiledSceneRendererWidget( layer, style )
27{
28 setupUi( this );
29
30 mFillSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
31 mFillSymbolButton->setSymbol( QgsTiledSceneTextureRenderer::createDefaultFillSymbol() );
32
33 if ( layer )
34 {
35 setFromRenderer( layer->renderer() );
36 }
37
38 connect( mFillSymbolButton, &QgsSymbolButton::changed, this, &QgsTiledSceneTextureRendererWidget::emitWidgetChanged );
39}
40
41QgsTiledSceneRendererWidget *QgsTiledSceneTextureRendererWidget::create( QgsTiledSceneLayer *layer, QgsStyle *style, QgsTiledSceneRenderer * )
42{
43 return new QgsTiledSceneTextureRendererWidget( layer, style );
44}
45
46QgsTiledSceneRenderer *QgsTiledSceneTextureRendererWidget::renderer()
47{
48 std::unique_ptr< QgsTiledSceneTextureRenderer > renderer = std::make_unique< QgsTiledSceneTextureRenderer >();
49 renderer->setFillSymbol( mFillSymbolButton->clonedSymbol< QgsFillSymbol >() );
50
51 return renderer.release();
52}
53
54void QgsTiledSceneTextureRendererWidget::emitWidgetChanged()
55{
56 if ( !mBlockChangedSignal )
57 emit widgetChanged();
58}
59
60void QgsTiledSceneTextureRendererWidget::setFromRenderer( const QgsTiledSceneRenderer *renderer )
61{
62 mBlockChangedSignal = true;
63
64 if ( const QgsTiledSceneTextureRenderer *textureRenderer = dynamic_cast< const QgsTiledSceneTextureRenderer * >( renderer ) )
65 {
66 mFillSymbolButton->setSymbol( textureRenderer->fillSymbol()->clone() );
67 }
68
69 mBlockChangedSignal = false;
70}
71
@ 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.