Skip to content
Permalink
Browse files

fix color ramp shader settings for 3d mesh rendering

  • Loading branch information
vcloarec authored and nyalldawson committed Jan 18, 2020
1 parent 9b4a824 commit ec59d3b801a8296b6a9404f67b9a0cd004236f2b
@@ -81,7 +81,7 @@ Qgs3DMapConfigWidget::Qgs3DMapConfigWidget( Qgs3DMapSettings *map, QgsMapCanvas
QgsMeshTerrainGenerator *meshTerrain = static_cast<QgsMeshTerrainGenerator *>( terrainGen );
cboTerrainLayer->setFilters( QgsMapLayerProxyModel::MeshLayer );
cboTerrainLayer->setLayer( meshTerrain->meshLayer() );
mMeshSymbolWidget->setLayer( meshTerrain->meshLayer() );
mMeshSymbolWidget->setLayer( meshTerrain->meshLayer(), false );
mMeshSymbolWidget->setSymbol( meshTerrain->symbol() );
spinTerrainScale->setValue( meshTerrain->symbol().verticaleScale() );
}
@@ -277,12 +277,11 @@ void Qgs3DMapConfigWidget::onTerrainLayerChanged()
QgsMeshLayer *meshLayer = qobject_cast<QgsMeshLayer *>( cboTerrainLayer->currentLayer() );
if ( meshLayer )
{
QgsMeshLayer *oldLayer = mMeshSymbolWidget->meshLayer();

mMeshSymbolWidget->setLayer( meshLayer, false );
if ( mMeshSymbolWidget->symbol().colorRampShader().colorRampItemList().count() == 0 )
{
if ( oldLayer != meshLayer )
mMeshSymbolWidget->reloadColorRampShaderMinMax();
}
}
}
}
@@ -63,6 +63,8 @@ void QgsMesh3dSymbolWidget::setSymbol( const QgsMesh3DSymbol &symbol )
mComboBoxTextureType->setCurrentIndex( symbol.renderingStyle() );
mMeshSingleColorButton->setColor( symbol.singleMeshColor() );
mColorRampShaderWidget->setFromShader( symbol.colorRampShader() );
mColorRampShaderWidget->setMinimumMaximumAndClassify( symbol.colorRampShader().minimumValue(),
symbol.colorRampShader().maximumValue() );

setColorRampMinMax( symbol.colorRampShader().minimumValue(), symbol.colorRampShader().maximumValue() );
}
@@ -90,6 +92,8 @@ void QgsMesh3dSymbolWidget::setLayer( QgsMeshLayer *meshLayer, bool updateSymbol
reloadColorRampShaderMinMax(); //As the symbol is new, the Color ramp shader needs to be initialized with min max value
}

QgsMeshLayer *QgsMesh3dSymbolWidget::meshLayer() const {return mLayer;}

double QgsMesh3dSymbolWidget::lineEditValue( const QLineEdit *lineEdit ) const
{
if ( lineEdit->text().isEmpty() )
@@ -34,6 +34,7 @@ class QgsMesh3dSymbolWidget : public QWidget, private Ui::QgsMesh3dPropsWidget
QgsMesh3DSymbol symbol() const;

void setLayer( QgsMeshLayer *meshLayer, bool updateSymbol = true );
QgsMeshLayer *meshLayer() const;
void setSymbol( const QgsMesh3DSymbol &symbol );

void enableVerticalSetting( bool isEnable );

0 comments on commit ec59d3b

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