37 if ( !rendererAbstractMetadata )
40 if ( !rendererMetadata )
45 if ( !iconName.isEmpty() )
54 static void _initRendererWidgetFunctions()
56 static bool sInitialized =
false;
60 _initRenderer( QStringLiteral(
"extent" ), QgsPointCloudExtentRendererWidget::create, QStringLiteral(
"styleicons/pointcloudextent.svg" ) );
61 _initRenderer( QStringLiteral(
"rgb" ), QgsPointCloudRgbRendererWidget::create, QStringLiteral(
"styleicons/multibandcolor.svg" ) );
62 _initRenderer( QStringLiteral(
"ramp" ), QgsPointCloudAttributeByRampRendererWidget::create, QStringLiteral(
"styleicons/singlebandpseudocolor.svg" ) );
63 _initRenderer( QStringLiteral(
"classified" ), QgsPointCloudClassifiedRendererWidget::create, QStringLiteral(
"styleicons/paletted.svg" ) );
75 layout()->setContentsMargins( 0, 0, 0, 0 );
78 _initRendererWidgetFunctions();
82 for (
const QString &name : renderers )
85 cboRenderers->addItem( m->icon(), m->visibleName(), name );
88 cboRenderers->setCurrentIndex( -1 );
93 connect( cboRenderers,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsPointCloudRendererPropertiesWidget::rendererChanged );
95 connect( mBlendModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
101 connect( mPointSizeSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
110 mMaxErrorSpinBox->setClearValue( 0.3 );
112 connect( mMaxErrorSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
115 connect( mPointStyleComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
116 connect( mDrawOrderComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
132 mLayer = qobject_cast< QgsPointCloudLayer * >( layer );
134 mBlockChangedSignal =
true;
135 mOpacityWidget->setOpacity( mLayer->
opacity() );
137 mBlendModeComboBox->setBlendMode( mLayer->
blendMode() );
142 const QString rendererName = mLayer->
renderer()->
type();
144 const int rendererIdx = cboRenderers->findData( rendererName );
145 cboRenderers->setCurrentIndex( rendererIdx );
148 Q_ASSERT( rendererIdx != -1 &&
"there must be a renderer!" );
154 mPointStyleComboBox->setCurrentIndex( mPointStyleComboBox->findData(
static_cast< int >( mLayer->
renderer()->
pointSymbol() ) ) );
155 mDrawOrderComboBox->setCurrentIndex( mDrawOrderComboBox->findData(
static_cast< int >( mLayer->
renderer()->
drawOrder2d() ) ) );
161 mBlockChangedSignal =
false;
173 mLayer->
setOpacity( mOpacityWidget->opacity() );
174 mLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
178 else if ( !cboRenderers->currentData().toString().isEmpty() )
195 void QgsPointCloudRendererPropertiesWidget::rendererChanged()
197 if ( cboRenderers->currentIndex() == -1 )
199 QgsDebugMsg( QStringLiteral(
"No current item -- this should never happen!" ) );
203 const QString rendererName = cboRenderers->currentData().toString();
206 std::unique_ptr< QgsPointCloudRenderer > oldRenderer;
207 std::unique_ptr< QgsPointCloudRenderer > newRenderer;
209 newRenderer.reset( mActiveWidget->
renderer() );
213 oldRenderer = std::move( newRenderer );
223 stackedWidget->removeWidget( mActiveWidget );
225 delete mActiveWidget;
226 mActiveWidget =
nullptr;
231 if ( rendererMetadata )
238 mActiveWidget = widget;
239 stackedWidget->addWidget( mActiveWidget );
240 stackedWidget->setCurrentWidget( mActiveWidget );
242 if ( mMapCanvas || mMessageBar )
257 stackedWidget->setCurrentWidget( pageNoWidget );
262 void QgsPointCloudRendererPropertiesWidget::emitWidgetChanged()
264 if ( !mBlockChangedSignal )