17#include "moc_qgsrenderermeshpropertieswidget.cpp"
38 mMeshRendererActiveDatasetWidget->setLayer( mMeshLayer );
39 mMeshRendererScalarSettingsWidget->setLayer( mMeshLayer );
43 mMeshRendererVectorSettingsWidget->setLayer( mMeshLayer );
44 m3dAveragingSettingsWidget->setLayer( mMeshLayer );
49 mBlendModeComboBox->setBlendMode( mMeshLayer->
blendMode() );
50 connect( mBlendModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &
QgsPanelWidget::widgetChanged );
52 mOpacityWidget->setOpacity( mMeshLayer->
opacity() );
78 const bool edgeMeshRenderingIsEnabled = mEdgeMeshGroup->isChecked();
80 edgeMeshSettings.
setEnabled( edgeMeshRenderingIsEnabled );
83 const bool nativeMeshRenderingIsEnabled = mNativeMeshGroup->isChecked();
85 nativeMeshSettings.
setEnabled( nativeMeshRenderingIsEnabled );
88 const bool triangularMeshRenderingIsEnabled = mTriangularMeshGroup->isChecked();
90 triangularMeshSettings.
setEnabled( triangularMeshRenderingIsEnabled );
93 int activeScalarDatasetGroupIndex = mMeshRendererActiveDatasetWidget->activeScalarDatasetGroup();
94 if ( !mContoursGroupBox->isChecked() )
95 activeScalarDatasetGroupIndex = -1;
98 int activeVectorDatasetGroupIndex = mMeshRendererActiveDatasetWidget->activeVectorDatasetGroup();
99 if ( !mVectorsGroupBox->isChecked() )
100 activeVectorDatasetGroupIndex = -1;
108 if ( activeScalarDatasetGroupIndex > -1 )
109 settings.
setScalarSettings( activeScalarDatasetGroupIndex, mMeshRendererScalarSettingsWidget->settings() );
112 if ( activeVectorDatasetGroupIndex > -1 )
113 settings.
setVectorSettings( activeVectorDatasetGroupIndex, mMeshRendererVectorSettingsWidget->settings() );
121 mMeshLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
124 const std::unique_ptr<QgsMesh3DAveragingMethod> averagingMethod( m3dAveragingSettingsWidget->averagingMethod() );
130 windowsSettings.
setValue( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ), mStyleOptionsTab->currentIndex() );
135 QgsMeshLayer *ml = qobject_cast<QgsMeshLayer *>( mapLayer );
139 mMeshRendererActiveDatasetWidget->setLayer( ml );
143 m3dAveragingSettingsWidget->setLayer( ml );
148 syncToLayerPrivate();
151void QgsRendererMeshPropertiesWidget::syncToLayerPrivate()
153 mMeshRendererActiveDatasetWidget->syncToLayer();
154 mNativeMeshSettingsWidget->syncToLayer();
155 mTriangularMeshSettingsWidget->syncToLayer();
156 mEdgeMeshSettingsWidget->syncToLayer();
157 m3dAveragingSettingsWidget->syncToLayer();
167 mFaceMeshGroupBox->setVisible( hasFaces || !mMeshLayer->
isValid() );
170 mEdgeMeshGroupBox->setVisible( hasEdges || !mMeshLayer->
isValid() );
173 if ( !settings.
contains( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ) ) )
174 settings.
setValue( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ), 0 );
176 mStyleOptionsTab->setCurrentIndex( settings.
value( QStringLiteral(
"/Windows/RendererMeshProperties/tab" ) ).toInt() );
179void QgsRendererMeshPropertiesWidget::onActiveScalarGroupChanged(
int groupIndex )
181 mMeshRendererScalarSettingsWidget->setActiveDatasetGroup( groupIndex );
182 mMeshRendererScalarSettingsWidget->syncToLayer();
183 mContoursGroupBox->setChecked( groupIndex >= 0 );
184 mContoursGroupBox->setEnabled( groupIndex >= 0 );
187void QgsRendererMeshPropertiesWidget::onActiveVectorGroupChanged(
int groupIndex )
191 mMeshRendererVectorSettingsWidget->setActiveDatasetGroup( groupIndex );
192 mMeshRendererVectorSettingsWidget->syncToLayer();
193 mVectorsGroupBox->setChecked( groupIndex >= 0 );
194 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.
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
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(int group=-1) const
Returns the static vector dataset index that is rendered if the temporal properties is not active.
void setRendererSettings(const QgsMeshRendererSettings &settings)
Sets new renderer settings.
QgsMeshDatasetIndex staticScalarDatasetIndex(int group=-1) const
Returns the static scalar dataset index that is rendered if the temporal properties is not active.
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 setAveragingMethod(QgsMesh3DAveragingMethod *method)
Sets averaging method for conversion of 3d stacked mesh data to 2d data.
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.
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.
static bool layerIsContainedInGroupLayer(QgsProject *project, QgsMapLayer *layer)
Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.
static QgsProject * instance()
Returns the QgsProject singleton instance.
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.