Skip to content
Permalink
Browse files

minor code tweaks

  • Loading branch information
PeterPetrik authored and wonder-sk committed Jul 18, 2018
1 parent f54a23e commit 52aa8492e9b66ea2d91ae06c36196e79816f024a
@@ -226,21 +226,18 @@ void QgsMeshDatasetGroupTreeView::onSelectionChanged( const QItemSelection &sele
{
Q_UNUSED( deselected );

if ( selected.isEmpty() )
int group = -1;
if ( !selected.isEmpty() && !selected.first().indexes().isEmpty() )
{
mActiveGroup = 0;
return;
QModelIndex index = selected.first().indexes().first(); //single selection only
group = index.row();
}

if ( selected.first().indexes().isEmpty() )
if ( mActiveGroup != group )
{
mActiveGroup = 0;
return;
mActiveGroup = group;
emit activeGroupChanged();
}

QModelIndex index = selected.first().indexes().first(); //single selection only
mActiveGroup = index.row();
emit activeGroupChanged();
}


@@ -131,7 +131,7 @@ class APP_EXPORT QgsMeshDatasetGroupTreeView : public QTreeView
QgsMeshDatasetGroupTreeModel mModel;
QgsMeshLayer *mMeshLayer = nullptr; // not owned
QStringList mGroups; // group names
int mActiveGroup; // index of active group
int mActiveGroup = -1; // index of active group
};

#endif // QGSMESHDATASETGROUPTREE_H
@@ -128,9 +128,11 @@ QgsMeshDatasetIndex QgsMeshRendererActiveDatasetWidget::datasetIndex() const
{
int value = mDatasetSlider->value();
int groupIndex = mDatasetGroupTreeView->activeGroup();
int datasetCount = mMeshLayer->dataProvider()->datasetCount( groupIndex );

if ( datasetCount > value && mMeshLayer && mMeshLayer->dataProvider() )
if ( mMeshLayer &&
mMeshLayer->dataProvider() &&
mMeshLayer->dataProvider()->datasetCount( groupIndex ) > value
)
return QgsMeshDatasetIndex( groupIndex, value );
else
return QgsMeshDatasetIndex();
@@ -76,7 +76,7 @@ class APP_EXPORT QgsMeshRendererActiveDatasetWidget : public QWidget, private Ui
QgsMeshDatasetIndex datasetIndex() const;

QgsMeshLayer *mMeshLayer = nullptr; // not owned
QgsMeshDatasetIndex mActiveScalarDataset ;
QgsMeshDatasetIndex mActiveScalarDataset;
QgsMeshDatasetIndex mActiveVectorDataset;
};

@@ -58,7 +58,7 @@ class APP_EXPORT QgsMeshRendererScalarSettingsWidget : public QWidget, private U

public slots:
//! Set active scalar dataset to be used
void setActiveDataset( QgsMeshDatasetIndex activeDatase );
void setActiveDataset( QgsMeshDatasetIndex activeDataset );

private slots:
void minMaxChanged();
@@ -169,6 +169,8 @@ QgsMeshDatasetMetadata QgsMdalProvider::datasetMetadata( QgsMeshDatasetIndex ind
return QgsMeshDatasetMetadata();

DatasetH dataset = MDAL_G_dataset( group, index.dataset() );
if ( !dataset )
return QgsMeshDatasetMetadata();

bool isValid = MDAL_D_isValid( dataset );
double time = MDAL_D_time( dataset );

0 comments on commit 52aa849

Please sign in to comment.
You can’t perform that action at this time.