41 &QgsRendererMeshPropertiesWidget::syncToLayerPrivate );
43 mMeshRendererActiveDatasetWidget->setLayer( mMeshLayer );
44 mMeshRendererScalarSettingsWidget->setLayer( mMeshLayer );
45 mNativeMeshSettingsWidget->setLayer( mMeshLayer, QgsMeshRendererMeshSettingsWidget::MeshType::Native );
46 mTriangularMeshSettingsWidget->setLayer( mMeshLayer, QgsMeshRendererMeshSettingsWidget::MeshType::Triangular );
47 mEdgeMeshSettingsWidget->setLayer( mMeshLayer, QgsMeshRendererMeshSettingsWidget::MeshType::Edge );
48 mMeshRendererVectorSettingsWidget->setLayer( mMeshLayer );
49 m3dAveragingSettingsWidget->setLayer( mMeshLayer );
54 mBlendModeComboBox->setBlendMode( mMeshLayer->
blendMode() );
55 connect( mBlendModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &
QgsPanelWidget::widgetChanged );
57 mOpacityWidget->setOpacity( mMeshLayer->
opacity() );
61 this, &QgsRendererMeshPropertiesWidget::onActiveScalarGroupChanged );
63 this, &QgsRendererMeshPropertiesWidget::onActiveVectorGroupChanged );
88 const bool edgeMeshRenderingIsEnabled = mEdgeMeshGroup->isChecked();
90 edgeMeshSettings.
setEnabled( edgeMeshRenderingIsEnabled );
93 const bool nativeMeshRenderingIsEnabled = mNativeMeshGroup->isChecked();
95 nativeMeshSettings.
setEnabled( nativeMeshRenderingIsEnabled );
98 const bool triangularMeshRenderingIsEnabled = mTriangularMeshGroup->isChecked();
100 triangularMeshSettings.
setEnabled( triangularMeshRenderingIsEnabled );
103 int activeScalarDatasetGroupIndex = mMeshRendererActiveDatasetWidget->activeScalarDatasetGroup();
104 if ( !mContoursGroupBox->isChecked() )
105 activeScalarDatasetGroupIndex = -1;
108 int activeVectorDatasetGroupIndex = mMeshRendererActiveDatasetWidget->activeVectorDatasetGroup();
109 if ( !mVectorsGroupBox->isChecked() )
110 activeVectorDatasetGroupIndex = -1;
118 if ( activeScalarDatasetGroupIndex > -1 )
119 settings.
setScalarSettings( activeScalarDatasetGroupIndex, mMeshRendererScalarSettingsWidget->settings() );
122 if ( activeVectorDatasetGroupIndex > -1 )
123 settings.
setVectorSettings( activeVectorDatasetGroupIndex, mMeshRendererVectorSettingsWidget->settings() );
131 mMeshLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
134 const std::unique_ptr<QgsMesh3dAveragingMethod> averagingMethod( m3dAveragingSettingsWidget->averagingMethod() );
140 windowsSettings.
setValue( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ), mStyleOptionsTab->currentIndex() );
145 QgsMeshLayer *ml = qobject_cast<QgsMeshLayer *>( mapLayer );
149 mMeshRendererActiveDatasetWidget->setLayer( ml );
153 m3dAveragingSettingsWidget->setLayer( ml );
158 syncToLayerPrivate();
161 void QgsRendererMeshPropertiesWidget::syncToLayerPrivate()
163 mMeshRendererActiveDatasetWidget->syncToLayer();
164 mNativeMeshSettingsWidget->syncToLayer();
165 mTriangularMeshSettingsWidget->syncToLayer();
166 mEdgeMeshSettingsWidget->syncToLayer();
167 m3dAveragingSettingsWidget->syncToLayer();
176 const bool hasFaces = ( mMeshLayer->
contains( QgsMesh::ElementType::Face ) );
177 mFaceMeshGroupBox->setVisible( hasFaces || !mMeshLayer->
isValid() );
179 const bool hasEdges = ( mMeshLayer->
contains( QgsMesh::ElementType::Edge ) );
180 mEdgeMeshGroupBox->setVisible( hasEdges || !mMeshLayer->
isValid() );
183 if ( !settings.
contains( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ) ) )
184 settings.
setValue( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ), 0 );
186 mStyleOptionsTab->setCurrentIndex( settings.
value( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ) ).toInt() );
189 void QgsRendererMeshPropertiesWidget::onActiveScalarGroupChanged(
int groupIndex )
191 mMeshRendererScalarSettingsWidget->setActiveDatasetGroup( groupIndex );
192 mMeshRendererScalarSettingsWidget->syncToLayer();
193 mContoursGroupBox->setChecked( groupIndex >= 0 );
194 mContoursGroupBox->setEnabled( groupIndex >= 0 );
197 void QgsRendererMeshPropertiesWidget::onActiveVectorGroupChanged(
int groupIndex )
201 mMeshRendererVectorSettingsWidget->setActiveDatasetGroup( groupIndex );
202 mMeshRendererVectorSettingsWidget->syncToLayer();
203 mVectorsGroupBox->setChecked( groupIndex >= 0 );
204 mVectorsGroupBox->setEnabled( groupIndex >= 0 );