39 &QgsRendererMeshPropertiesWidget::syncToLayerPrivate );
41 mMeshRendererActiveDatasetWidget->setLayer( mMeshLayer );
42 mMeshRendererScalarSettingsWidget->setLayer( mMeshLayer );
43 mNativeMeshSettingsWidget->setLayer( mMeshLayer, QgsMeshRendererMeshSettingsWidget::MeshType::Native );
44 mTriangularMeshSettingsWidget->setLayer( mMeshLayer, QgsMeshRendererMeshSettingsWidget::MeshType::Triangular );
45 mEdgeMeshSettingsWidget->setLayer( mMeshLayer, QgsMeshRendererMeshSettingsWidget::MeshType::Edge );
46 mMeshRendererVectorSettingsWidget->setLayer( mMeshLayer );
47 m3dAveragingSettingsWidget->setLayer( mMeshLayer );
51 mBlendModeComboBox->setBlendMode( mMeshLayer->
blendMode() );
52 connect( mBlendModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &
QgsPanelWidget::widgetChanged );
55 this, &QgsRendererMeshPropertiesWidget::onActiveScalarGroupChanged );
57 this, &QgsRendererMeshPropertiesWidget::onActiveVectorGroupChanged );
82 const bool edgeMeshRenderingIsEnabled = mEdgeMeshGroup->isChecked();
84 edgeMeshSettings.
setEnabled( edgeMeshRenderingIsEnabled );
87 const bool nativeMeshRenderingIsEnabled = mNativeMeshGroup->isChecked();
89 nativeMeshSettings.
setEnabled( nativeMeshRenderingIsEnabled );
92 const bool triangularMeshRenderingIsEnabled = mTriangularMeshGroup->isChecked();
94 triangularMeshSettings.
setEnabled( triangularMeshRenderingIsEnabled );
97 int activeScalarDatasetGroupIndex = mMeshRendererActiveDatasetWidget->activeScalarDatasetGroup();
98 if ( !mContoursGroupBox->isChecked() )
99 activeScalarDatasetGroupIndex = -1;
102 int activeVectorDatasetGroupIndex = mMeshRendererActiveDatasetWidget->activeVectorDatasetGroup();
103 if ( !mVectorsGroupBox->isChecked() )
104 activeVectorDatasetGroupIndex = -1;
112 if ( activeScalarDatasetGroupIndex > -1 )
113 settings.
setScalarSettings( activeScalarDatasetGroupIndex, mMeshRendererScalarSettingsWidget->settings() );
116 if ( activeVectorDatasetGroupIndex > -1 )
117 settings.
setVectorSettings( activeVectorDatasetGroupIndex, mMeshRendererVectorSettingsWidget->settings() );
125 mMeshLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
127 const std::unique_ptr<QgsMesh3dAveragingMethod> averagingMethod( m3dAveragingSettingsWidget->averagingMethod() );
133 windowsSettings.
setValue( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ), mStyleOptionsTab->currentIndex() );
138 QgsMeshLayer *ml = qobject_cast<QgsMeshLayer *>( mapLayer );
142 mMeshRendererActiveDatasetWidget->setLayer( ml );
146 m3dAveragingSettingsWidget->setLayer( ml );
151 syncToLayerPrivate();
154 void QgsRendererMeshPropertiesWidget::syncToLayerPrivate()
156 mMeshRendererActiveDatasetWidget->syncToLayer();
157 mNativeMeshSettingsWidget->syncToLayer();
158 mTriangularMeshSettingsWidget->syncToLayer();
159 mEdgeMeshSettingsWidget->syncToLayer();
160 m3dAveragingSettingsWidget->syncToLayer();
169 const bool hasFaces = ( mMeshLayer->
contains( QgsMesh::ElementType::Face ) );
170 mFaceMeshGroupBox->setVisible( hasFaces );
172 const bool hasEdges = ( mMeshLayer->
contains( QgsMesh::ElementType::Edge ) );
173 mEdgeMeshGroupBox->setVisible( hasEdges );
176 if ( !settings.
contains( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ) ) )
177 settings.
setValue( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ), 0 );
179 mStyleOptionsTab->setCurrentIndex( settings.
value( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ) ).toInt() );
182 void QgsRendererMeshPropertiesWidget::onActiveScalarGroupChanged(
int groupIndex )
184 mMeshRendererScalarSettingsWidget->setActiveDatasetGroup( groupIndex );
185 mMeshRendererScalarSettingsWidget->syncToLayer();
186 mContoursGroupBox->setChecked( groupIndex >= 0 );
187 mContoursGroupBox->setEnabled( groupIndex >= 0 );
190 void QgsRendererMeshPropertiesWidget::onActiveVectorGroupChanged(
int groupIndex )
194 mMeshRendererVectorSettingsWidget->setActiveDatasetGroup( groupIndex );
195 mMeshRendererVectorSettingsWidget->syncToLayer();
196 mVectorsGroupBox->setChecked( groupIndex >= 0 );
197 mVectorsGroupBox->setEnabled( groupIndex >= 0 );
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
void dataChanged()
Data of layer changed.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
int dataset() const
Returns a dataset index within group()
Represents a mesh layer supporting display of data on structured or unstructured meshes.
void setStaticVectorDatasetIndex(const QgsMeshDatasetIndex &staticVectorDatasetIndex)
Sets the static vector dataset index that is rendered if the temporal properties is not active.
void setStaticScalarDatasetIndex(const QgsMeshDatasetIndex &staticScalarDatasetIndex)
Sets the static scalar dataset index that is rendered if the temporal properties is not active.
bool contains(const QgsMesh::ElementType &type) const
Returns whether the mesh contains at mesh elements of given type.
QgsMeshRendererSettings rendererSettings() const
Returns renderer settings.
QgsMeshDatasetIndex staticVectorDatasetIndex() const
Returns the static vector dataset index that is rendered if the temporal properties is not active.
QgsMeshDatasetIndex staticScalarDatasetIndex() const
Returns the static scalar dataset index that is rendered if the temporal properties is not active.
void setRendererSettings(const QgsMeshRendererSettings &settings)
Sets new renderer settings.
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the dataset groups metadata.
Represents a mesh renderer settings for mesh object.
void setEnabled(bool enabled)
Sets whether mesh structure rendering is enabled.
bool isEnabled() const
Returns whether mesh structure rendering is enabled.
Represents all mesh renderer settings.
void setActiveVectorDatasetGroup(int activeVectorDatasetGroup)
Sets the active vector dataset group.
int activeVectorDatasetGroup() const
Returns the active vector dataset group.
void setEdgeMeshSettings(const QgsMeshRendererMeshSettings &settings)
Sets new edge mesh renderer settings.
int activeScalarDatasetGroup() const
Returns the active scalar dataset group.
void setActiveScalarDatasetGroup(int activeScalarDatasetGroup)
Sets the active scalar dataset group.
void setVectorSettings(int groupIndex, const QgsMeshRendererVectorSettings &settings)
Sets new renderer settings.
void setTriangularMeshSettings(const QgsMeshRendererMeshSettings &settings)
Sets new triangular mesh renderer settings.
QgsMeshRendererMeshSettings edgeMeshSettings() const
Returns edge mesh renderer settings.
void setAveragingMethod(QgsMesh3dAveragingMethod *method)
Sets averaging method for conversion of 3d stacked mesh data to 2d data.
QgsMeshRendererMeshSettings nativeMeshSettings() const
Returns native mesh renderer settings.
void setScalarSettings(int groupIndex, const QgsMeshRendererScalarSettings &settings)
Sets new renderer settings.
QgsMeshRendererMeshSettings triangularMeshSettings() const
Returns triangular mesh renderer settings.
void setNativeMeshSettings(const QgsMeshRendererMeshSettings &settings)
Sets new native mesh renderer settings, triggers repaint.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.