17#include "moc_qgsmeshrendereractivedatasetwidget.cpp"
50 mDatasetGroupTreeView->setLayer( layer );
57 return mActiveScalarDatasetGroup;
62 return mActiveVectorDatasetGroup;
66void QgsMeshRendererActiveDatasetWidget::onActiveScalarGroupChanged(
int groupIndex )
68 if ( groupIndex == mActiveScalarDatasetGroup )
71 mActiveScalarDatasetGroup = groupIndex;
77void QgsMeshRendererActiveDatasetWidget::onActiveVectorGroupChanged(
int groupIndex )
79 if ( groupIndex == mActiveVectorDatasetGroup )
82 mActiveVectorDatasetGroup = groupIndex;
88void QgsMeshRendererActiveDatasetWidget::updateMetadata()
94 msg += tr(
"Invalid mesh layer selected" );
98 if ( mActiveScalarDatasetGroup > -1 )
100 if ( mActiveVectorDatasetGroup > -1 )
102 if ( mActiveScalarDatasetGroup == mActiveVectorDatasetGroup )
104 msg += metadata( mActiveScalarDatasetGroup );
108 msg += QStringLiteral(
"<p> <h3> %1 </h3> " ).arg( tr(
"Scalar dataset" ) );
109 msg += metadata( mActiveScalarDatasetGroup );
110 msg += QStringLiteral(
"</p> <p> <h3> %1 </h3>" ).arg( tr(
"Vector dataset" ) );
111 msg += metadata( mActiveVectorDatasetGroup );
112 msg += QLatin1String(
"</p>" );
117 msg += metadata( mActiveScalarDatasetGroup );
122 if ( mActiveVectorDatasetGroup > -1 )
124 msg += metadata( mActiveVectorDatasetGroup );
128 msg += tr(
"No mesh dataset selected" );
133 mActiveDatasetMetadata->setText( msg );
140 msg += QLatin1String(
"<table>" );
142 QString definedOnMesh;
147 definedOnMesh = tr(
"faces and edges" );
151 definedOnMesh = tr(
"faces" );
156 definedOnMesh = tr(
"edges" );
160 definedOnMesh = tr(
"invalid mesh" );
162 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
163 .arg( tr(
"Mesh type" ) )
164 .arg( definedOnMesh );
171 definedOn = tr(
"vertices" );
174 definedOn = tr(
"faces" );
177 definedOn = tr(
"volumes" );
180 definedOn = tr(
"edges" );
183 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
184 .arg( tr(
"Data type" ) )
187 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" )
188 .arg( tr(
"Is vector" ) )
189 .arg( gmeta.
isVector() ? tr(
"Yes" ) : tr(
"No" ) );
192 for (
auto it = options.constBegin(); it != options.constEnd(); ++it )
194 if ( it.key() == QLatin1String(
"classification" ) )
196 msg += QStringLiteral(
"<tr><td>%1</td></tr>" ).arg( tr(
"Classified values" ) );
199 msg += QStringLiteral(
"<tr><td>%1</td><td>%2</td></tr>" ).arg( it.key() ).arg( it.value() );
202 msg += QLatin1String(
"</table>" );
209 setEnabled( mMeshLayer );
213 mActiveScalarDatasetGroup = mDatasetGroupTreeView->activeScalarGroup();
214 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.