QGIS API Documentation 3.41.0-Master (3440c17df1d)
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 "moc_qgstiledscenewireframerendererwidget.cpp"
20#include "qgstiledscenelayer.h"
22#include "qgsfillsymbol.h"
23#include "qgslinesymbol.h"
24
26
27QgsTiledSceneWireframeRendererWidget::QgsTiledSceneWireframeRendererWidget( QgsTiledSceneLayer *layer, QgsStyle *style )
28 : QgsTiledSceneRendererWidget( layer, style )
29{
30 setupUi( this );
31
32 mFillSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
33 mFillSymbolButton->setSymbol( QgsTiledSceneWireframeRenderer::createDefaultFillSymbol() );
34 mLineSymbolButton->setSymbolType( Qgis::SymbolType::Line );
35 mLineSymbolButton->setSymbol( QgsTiledSceneWireframeRenderer::createDefaultLineSymbol() );
36
37 if ( layer )
38 {
39 setFromRenderer( layer->renderer() );
40 }
41
42 connect( mFillSymbolButton, &QgsSymbolButton::changed, this, &QgsTiledSceneWireframeRendererWidget::emitWidgetChanged );
43 connect( mLineSymbolButton, &QgsSymbolButton::changed, this, &QgsTiledSceneWireframeRendererWidget::emitWidgetChanged );
44 connect( mCheckUseTextureColors, &QCheckBox::toggled, this, &QgsTiledSceneWireframeRendererWidget::emitWidgetChanged );
45}
46
47QgsTiledSceneRendererWidget *QgsTiledSceneWireframeRendererWidget::create( QgsTiledSceneLayer *layer, QgsStyle *style, QgsTiledSceneRenderer * )
48{
49 return new QgsTiledSceneWireframeRendererWidget( layer, style );
50}
51
52QgsTiledSceneRenderer *QgsTiledSceneWireframeRendererWidget::renderer()
53{
54 std::unique_ptr< QgsTiledSceneWireframeRenderer > renderer = std::make_unique< QgsTiledSceneWireframeRenderer >();
55 renderer->setFillSymbol( mFillSymbolButton->clonedSymbol< QgsFillSymbol >() );
56 renderer->setLineSymbol( mLineSymbolButton->clonedSymbol< QgsLineSymbol >() );
57 renderer->setUseTextureColors( mCheckUseTextureColors->isChecked() );
58
59 return renderer.release();
60}
61
62void QgsTiledSceneWireframeRendererWidget::emitWidgetChanged()
63{
64 if ( !mBlockChangedSignal )
65 emit widgetChanged();
66}
67
68void QgsTiledSceneWireframeRendererWidget::setFromRenderer( const QgsTiledSceneRenderer *renderer )
69{
70 mBlockChangedSignal = true;
71 if ( const QgsTiledSceneWireframeRenderer *wireframeRenderer = dynamic_cast< const QgsTiledSceneWireframeRenderer * >( renderer ) )
72 {
73 mFillSymbolButton->setSymbol( wireframeRenderer->fillSymbol()->clone() );
74 mLineSymbolButton->setSymbol( wireframeRenderer->lineSymbol()->clone() );
75 mCheckUseTextureColors->setChecked( wireframeRenderer->useTextureColors() );
76 }
77
78 mBlockChangedSignal = false;
79}
80
@ 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.