33 this, &QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged );
35 this, &QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged );
53 mDatasetGroupTreeView->setLayer( layer );
62 return mActiveScalarDatasetGroup;
67 return mActiveVectorDatasetGroup;
71 void QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged(
int groupIndex )
73 if ( groupIndex == mActiveScalarDatasetGroup )
76 mActiveScalarDatasetGroup = groupIndex;
82 void QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged(
int groupIndex )
84 if ( groupIndex == mActiveVectorDatasetGroup )
87 mActiveVectorDatasetGroup = groupIndex;
93 void 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;
150 if ( mMeshLayer->
contains( QgsMesh::ElementType::Face ) )
152 if ( mMeshLayer->
contains( QgsMesh::ElementType::Edge ) )
154 definedOnMesh = tr(
"faces and edges" );
158 definedOnMesh = tr(
"faces" );
161 else if ( mMeshLayer->
contains( QgsMesh::ElementType::Edge ) )
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();