33 this, &QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged );
35 this, &QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged );
53 mDatasetGroupTreeView->setLayer( layer );
62 return mActiveScalarDatasetGroup;
67 return mActiveVectorDatasetGroup;
71void QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged(
int groupIndex )
73 if ( groupIndex == mActiveScalarDatasetGroup )
76 mActiveScalarDatasetGroup = groupIndex;
82void QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged(
int groupIndex )
84 if ( groupIndex == mActiveVectorDatasetGroup )
87 mActiveVectorDatasetGroup = groupIndex;
93void QgsMeshRendererActiveDatasetWidget::updateMetadata()
100 msg += tr(
"Invalid mesh layer selected" );
104 if ( mActiveScalarDatasetGroup > -1 )
106 if ( mActiveVectorDatasetGroup > -1 )
108 if ( mActiveScalarDatasetGroup == mActiveVectorDatasetGroup )
110 msg += metadata( mActiveScalarDatasetGroup );
114 msg += QStringLiteral(
"<p> <h3> %1 </h3> " ).arg( tr(
"Scalar dataset" ) );
115 msg += metadata( mActiveScalarDatasetGroup );
116 msg += QStringLiteral(
"</p> <p> <h3> %1 </h3>" ).arg( tr(
"Vector dataset" ) );
117 msg += metadata( mActiveVectorDatasetGroup );
118 msg += QLatin1String(
"</p>" );
123 msg += metadata( mActiveScalarDatasetGroup );
128 if ( mActiveVectorDatasetGroup > -1 )
130 msg += metadata( mActiveVectorDatasetGroup );
134 msg += tr(
"No mesh dataset selected" );
139 mActiveDatasetMetadata->setText( msg );
147 msg += QLatin1String(
"<table>" );
149 QString definedOnMesh;
154 definedOnMesh = tr(
"faces and edges" );
158 definedOnMesh = tr(
"faces" );
163 definedOnMesh = tr(
"edges" );
167 definedOnMesh = tr(
"invalid mesh" );
169 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
170 .arg( tr(
"Mesh type" ) )
171 .arg( definedOnMesh );
178 definedOn = tr(
"vertices" );
181 definedOn = tr(
"faces" );
184 definedOn = tr(
"volumes" );
187 definedOn = tr(
"edges" );
190 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
191 .arg( tr(
"Data type" ) )
194 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
195 .arg( tr(
"Is vector" ) )
196 .arg( gmeta.
isVector() ? tr(
"Yes" ) : tr(
"No" ) );
199 for (
auto it = options.constBegin(); it != options.constEnd(); ++it )
201 if ( it.key() == QLatin1String(
"classification" ) )
203 msg += QStringLiteral(
"<tr><td>%1</td></tr>" ).arg( tr(
"Classified values" ) );
206 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" ).arg( it.key() ).arg( it.value() );
209 msg += QLatin1String(
"</table>" );
216 setEnabled( mMeshLayer );
220 mActiveScalarDatasetGroup = mDatasetGroupTreeView->activeScalarGroup();
221 mActiveVectorDatasetGroup = mDatasetGroupTreeView->activeVectorGroup();
void setActiveScalarGroup(int group)
Sets active group for contours.
void setActiveVectorGroup(int group)
Sets active vector group.
void activeVectorGroupChanged(int groupIndex)
Selected dataset group for vectors changed. -1 for invalid group.
void activeScalarGroupChanged(int groupIndex)
Selected dataset group for contours changed. -1 for invalid group.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
bool contains(const QgsMesh::ElementType &type) const
Returns whether the mesh contains at mesh elements of given type.
void activeScalarDatasetGroupChanged(int index)
Emitted when active scalar group dataset is changed.
void activeVectorDatasetGroupChanged(int index)
Emitted when active vector group dataset is changed.
QgsMeshDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the dataset groups metadata.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.