Skip to content
Permalink
Browse files

Working gui for setting point cloud opacity and blend mode

  • Loading branch information
nyalldawson committed Nov 16, 2020
1 parent 1758ca1 commit 1951489f25c5d2374f6ef363166a188efd70d075
@@ -35,10 +35,12 @@ Sets the ``context`` in which the widget is shown, e.g., the associated map canv

virtual void syncToLayer( QgsMapLayer *layer );


public slots:

virtual void apply();


};


@@ -131,12 +131,17 @@ void QgsPointCloudLayerProperties::apply()

// TODO -- move to proper widget classes!

#if 0
std::unique_ptr< QgsDummyPointCloudRenderer > renderer = qgis::make_unique< QgsDummyPointCloudRenderer >();
renderer->setAttribute( mAttributeComboBox->currentAttribute() );
renderer->setZMin( mMinZSpin->value() );
renderer->setZMax( mMaxZSpin->value() );
renderer->setColorRamp( mBtnColorRamp->colorRamp() );
mLayer->setRenderer( renderer.release() );
#endif

for ( QgsMapLayerConfigWidget *w : mConfigWidgets )
w->apply();

mLayer->triggerRepaint();
}
@@ -176,6 +181,9 @@ void QgsPointCloudLayerProperties::syncToLayer()
mMaxZSpin->setValue( renderer->zMax() );
mBtnColorRamp->setColorRamp( renderer->colorRamp() );
}

for ( QgsMapLayerConfigWidget *w : mConfigWidgets )
w->syncToLayer( mLayer );
}


@@ -78,9 +78,11 @@ QgsPointCloudRendererPropertiesWidget::QgsPointCloudRendererPropertiesWidget( Qg
// connect layer opacity slider and spin box
//connect( cboRenderers, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPointCloudRendererPropertiesWidget::rendererChanged );

//syncToLayer();
}
connect( mBlendModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );

syncToLayer( layer );
}

void QgsPointCloudRendererPropertiesWidget::setContext( const QgsSymbolWidgetContext &context )
{
@@ -92,3 +94,25 @@ void QgsPointCloudRendererPropertiesWidget::setContext( const QgsSymbolWidgetCon
}
}

void QgsPointCloudRendererPropertiesWidget::syncToLayer( QgsMapLayer *layer )
{
mLayer = qobject_cast< QgsPointCloudLayer * >( layer );

mBlockChangedSignal = true;
mOpacityWidget->setOpacity( mLayer->opacity() );
mBlendModeComboBox->setBlendMode( mLayer->blendMode() );
mBlockChangedSignal = false;
}

void QgsPointCloudRendererPropertiesWidget::apply()
{
mLayer->setOpacity( mOpacityWidget->opacity() );
mLayer->setBlendMode( mBlendModeComboBox->blendMode() );
}

void QgsPointCloudRendererPropertiesWidget::emitWidgetChanged()
{
if ( !mBlockChangedSignal )
emit widgetChanged();
}

@@ -51,11 +51,15 @@ class GUI_EXPORT QgsPointCloudRendererPropertiesWidget : public QgsMapLayerConfi
*/
void setContext( const QgsSymbolWidgetContext &context );

void syncToLayer( QgsMapLayer *layer ) override { Q_UNUSED( layer ) }
void syncToLayer( QgsMapLayer *layer ) override;

public slots:

void apply() override {}
void apply() override;

private slots:

void emitWidgetChanged();

private:

@@ -67,6 +71,8 @@ class GUI_EXPORT QgsPointCloudRendererPropertiesWidget : public QgsMapLayerConfi
QgsMapCanvas *mMapCanvas = nullptr;
QgsMessageBar *mMessageBar = nullptr;

bool mBlockChangedSignal = false;

};


0 comments on commit 1951489

Please sign in to comment.
You can’t perform that action at this time.