QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgstiledscenewireframerendererwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgstiledscenewireframerendererwidget.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#include "qgslinesymbol.h"
23
25
26QgsTiledSceneWireframeRendererWidget::QgsTiledSceneWireframeRendererWidget( QgsTiledSceneLayer *layer, QgsStyle *style )
27 : QgsTiledSceneRendererWidget( layer, style )
28{
29 setupUi( this );
30
31 mFillSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
32 mFillSymbolButton->setSymbol( QgsTiledSceneWireframeRenderer::createDefaultFillSymbol() );
33 mLineSymbolButton->setSymbolType( Qgis::SymbolType::Line );
34 mLineSymbolButton->setSymbol( QgsTiledSceneWireframeRenderer::createDefaultLineSymbol() );
35
36 if ( layer )
37 {
38 setFromRenderer( layer->renderer() );
39 }
40
41 connect( mFillSymbolButton, &QgsSymbolButton::changed, this, &QgsTiledSceneWireframeRendererWidget::emitWidgetChanged );
42 connect( mLineSymbolButton, &QgsSymbolButton::changed, this, &QgsTiledSceneWireframeRendererWidget::emitWidgetChanged );
43 connect( mCheckUseTextureColors, &QCheckBox::toggled, this, &QgsTiledSceneWireframeRendererWidget::emitWidgetChanged );
44}
45
46QgsTiledSceneRendererWidget *QgsTiledSceneWireframeRendererWidget::create( QgsTiledSceneLayer *layer, QgsStyle *style, QgsTiledSceneRenderer * )
47{
48 return new QgsTiledSceneWireframeRendererWidget( layer, style );
49}
50
51QgsTiledSceneRenderer *QgsTiledSceneWireframeRendererWidget::renderer()
52{
53 std::unique_ptr< QgsTiledSceneWireframeRenderer > renderer = std::make_unique< QgsTiledSceneWireframeRenderer >();
54 renderer->setFillSymbol( mFillSymbolButton->clonedSymbol< QgsFillSymbol >() );
55 renderer->setLineSymbol( mLineSymbolButton->clonedSymbol< QgsLineSymbol >() );
56 renderer->setUseTextureColors( mCheckUseTextureColors->isChecked() );
57
58 return renderer.release();
59}
60
61void QgsTiledSceneWireframeRendererWidget::emitWidgetChanged()
62{
63 if ( !mBlockChangedSignal )
64 emit widgetChanged();
65}
66
67void QgsTiledSceneWireframeRendererWidget::setFromRenderer( const QgsTiledSceneRenderer *renderer )
68{
69 mBlockChangedSignal = true;
70 if ( const QgsTiledSceneWireframeRenderer *wireframeRenderer = dynamic_cast< const QgsTiledSceneWireframeRenderer * >( renderer ) )
71 {
72 mFillSymbolButton->setSymbol( wireframeRenderer->fillSymbol()->clone() );
73 mLineSymbolButton->setSymbol( wireframeRenderer->lineSymbol()->clone() );
74 mCheckUseTextureColors->setChecked( wireframeRenderer->useTextureColors() );
75 }
76
77 mBlockChangedSignal = false;
78}
79
@ Line
Line symbol.
@ Fill
Fill symbol.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString 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 the raw primitive wireframes.
static QgsLineSymbol * createDefaultLineSymbol()
Returns a copy of the default line symbol used to render lines in the wireframe.
static QgsFillSymbol * createDefaultFillSymbol()
Returns a copy of the default fill symbol used to render triangles in the wireframe.