17#include "moc_qgsmeshrendereractivedatasetwidget.cpp"
34 this, &QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged );
36 this, &QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged );
54 mDatasetGroupTreeView->setLayer( layer );
63 return mActiveScalarDatasetGroup;
68 return mActiveVectorDatasetGroup;
72void QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged(
int groupIndex )
74 if ( groupIndex == mActiveScalarDatasetGroup )
77 mActiveScalarDatasetGroup = groupIndex;
83void QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged(
int groupIndex )
85 if ( groupIndex == mActiveVectorDatasetGroup )
88 mActiveVectorDatasetGroup = groupIndex;
94void QgsMeshRendererActiveDatasetWidget::updateMetadata()
101 msg += tr(
"Invalid mesh layer selected" );
105 if ( mActiveScalarDatasetGroup > -1 )
107 if ( mActiveVectorDatasetGroup > -1 )
109 if ( mActiveScalarDatasetGroup == mActiveVectorDatasetGroup )
111 msg += metadata( mActiveScalarDatasetGroup );
115 msg += QStringLiteral(
"<p> <h3> %1 </h3> " ).arg( tr(
"Scalar dataset" ) );
116 msg += metadata( mActiveScalarDatasetGroup );
117 msg += QStringLiteral(
"</p> <p> <h3> %1 </h3>" ).arg( tr(
"Vector dataset" ) );
118 msg += metadata( mActiveVectorDatasetGroup );
119 msg += QLatin1String(
"</p>" );
124 msg += metadata( mActiveScalarDatasetGroup );
129 if ( mActiveVectorDatasetGroup > -1 )
131 msg += metadata( mActiveVectorDatasetGroup );
135 msg += tr(
"No mesh dataset selected" );
140 mActiveDatasetMetadata->setText( msg );
148 msg += QLatin1String(
"<table>" );
150 QString definedOnMesh;
155 definedOnMesh = tr(
"faces and edges" );
159 definedOnMesh = tr(
"faces" );
164 definedOnMesh = tr(
"edges" );
168 definedOnMesh = tr(
"invalid mesh" );
170 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
171 .arg( tr(
"Mesh type" ) )
172 .arg( definedOnMesh );
179 definedOn = tr(
"vertices" );
182 definedOn = tr(
"faces" );
185 definedOn = tr(
"volumes" );
188 definedOn = tr(
"edges" );
191 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
192 .arg( tr(
"Data type" ) )
195 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
196 .arg( tr(
"Is vector" ) )
197 .arg( gmeta.
isVector() ? tr(
"Yes" ) : tr(
"No" ) );
200 for (
auto it = options.constBegin(); it != options.constEnd(); ++it )
202 if ( it.key() == QLatin1String(
"classification" ) )
204 msg += QStringLiteral(
"<tr><td>%1</td></tr>" ).arg( tr(
"Classified values" ) );
207 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" ).arg( it.key() ).arg( it.value() );
210 msg += QLatin1String(
"</table>" );
217 setEnabled( mMeshLayer );
221 mActiveScalarDatasetGroup = mDatasetGroupTreeView->activeScalarGroup();
222 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.