Navigation Menu

Skip to content

Commit

Permalink
fix color ramp shader settings for 3d mesh rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec authored and nyalldawson committed Jan 20, 2020
1 parent 9b4a824 commit ec59d3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/3d/qgs3dmapconfigwidget.cpp
Expand Up @@ -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() );
}
Expand Down Expand Up @@ -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();
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/3d/qgsmesh3dsymbolwidget.cpp
Expand Up @@ -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() );
}
Expand Down Expand Up @@ -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() )
Expand Down
1 change: 1 addition & 0 deletions src/app/3d/qgsmesh3dsymbolwidget.h
Expand Up @@ -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 );
Expand Down

0 comments on commit ec59d3b

Please sign in to comment.