17#include "moc_qgsmeshstaticdatasetwidget.cpp"
26 this->layout()->setContentsMargins( 0, 0, 0, 0 );
28 mScalarDatasetComboBox->setModel( mDatasetScalarModel );
30 mVectorDatasetComboBox->setModel( mDatasetVectorModel );
57 if ( mScalarDatasetComboBox->count() == 1 )
60 scalarIndex = mScalarDatasetComboBox->currentIndex() - 1;
63 if ( mVectorDatasetComboBox->count() == 1 )
66 vectorIndex = mVectorDatasetComboBox->currentIndex() - 1;
74 mScalarDatasetGroup = index;
76 mScalarDatasetComboBox->setEnabled( mScalarDatasetGroup >= 0 );
86 mVectorDatasetGroup = index;
88 mVectorDatasetComboBox->setEnabled( mVectorDatasetGroup >= 0 );
96void QgsMeshStaticDatasetWidget::setScalarDatasetIndex(
int index )
98 if ( index < mLayer->datasetCount( mScalarDatasetGroup ) )
99 mScalarDatasetComboBox->setCurrentIndex( index + 1 );
101 mScalarDatasetComboBox->setCurrentIndex( 0 );
104void QgsMeshStaticDatasetWidget::setVectorDatasetIndex(
int index )
106 if ( index < mLayer->datasetCount( mVectorDatasetGroup ) )
107 mVectorDatasetComboBox->setCurrentIndex( index + 1 );
109 mVectorDatasetComboBox->setCurrentIndex( 0 );
113 : QAbstractListModel( parent )
126 mDatasetGroup = group;
142 if ( !index.isValid() )
145 if ( role == Qt::DisplayRole )
147 if ( !mLayer || mDatasetGroup < 0 || index.row() == 0 )
150 else if ( index.row() == 1 && mLayer->
datasetCount( mDatasetGroup ) == 1 )
152 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.