17#include "moc_qgsmeshstaticdatasetwidget.cpp"
25 this->layout()->setContentsMargins( 0, 0, 0, 0 );
27 mScalarDatasetComboBox->setModel( mDatasetScalarModel );
29 mVectorDatasetComboBox->setModel( mDatasetVectorModel );
56 if ( mScalarDatasetComboBox->count() == 1 )
59 scalarIndex = mScalarDatasetComboBox->currentIndex() - 1;
62 if ( mVectorDatasetComboBox->count() == 1 )
65 vectorIndex = mVectorDatasetComboBox->currentIndex() - 1;
73 mScalarDatasetGroup = index;
75 mScalarDatasetComboBox->setEnabled( mScalarDatasetGroup >= 0 );
85 mVectorDatasetGroup = index;
87 mVectorDatasetComboBox->setEnabled( mVectorDatasetGroup >= 0 );
95void QgsMeshStaticDatasetWidget::setScalarDatasetIndex(
int index )
97 if ( index < mLayer->datasetCount( mScalarDatasetGroup ) )
98 mScalarDatasetComboBox->setCurrentIndex( index + 1 );
100 mScalarDatasetComboBox->setCurrentIndex( 0 );
103void QgsMeshStaticDatasetWidget::setVectorDatasetIndex(
int index )
105 if ( index < mLayer->datasetCount( mVectorDatasetGroup ) )
106 mVectorDatasetComboBox->setCurrentIndex( index + 1 );
108 mVectorDatasetComboBox->setCurrentIndex( 0 );
124 mDatasetGroup = group;
140 if ( !index.isValid() )
143 if ( role == Qt::DisplayRole )
145 if ( !mLayer || mDatasetGroup < 0 || index.row() == 0 )
148 else if ( index.row() == 1 && mLayer->
datasetCount( mDatasetGroup ) == 1 )
150 return tr(
"Display dataset" );
A representation of the interval between two datetime values.
double hours() const
Returns the interval duration in hours.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
int dataset() const
Returns a dataset index within group()
List model for dataset contained in dataset group, used to display by time dataset in widget.
void setDatasetGroup(int group)
Sets the dataset group.
void setMeshLayer(QgsMeshLayer *layer)
Sets the layer.
int rowCount(const QModelIndex &parent) const override
QVariant data(const QModelIndex &index, int role) const override
QgsMeshDatasetListModel(QObject *parent)
Constructor.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
int datasetCount(const QgsMeshDatasetIndex &index) const
Returns the dataset count in the dataset groups.
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.
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.
QgsInterval datasetRelativeTime(const QgsMeshDatasetIndex &index)
Returns the relative time of the dataset from the reference time of its group.
QgsMeshDatasetIndex staticScalarDatasetIndex(int group=-1) const
Returns the static scalar dataset index that is rendered if the temporal properties is not active.
QString formatTime(double hours)
Returns (date) time in hours formatted to human readable form.
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the dataset groups metadata.
int activeVectorDatasetGroup() const
Returns the active vector dataset group.
int activeScalarDatasetGroup() const
Returns the active scalar dataset group.