Commit 045da03e authored by Bianca Tost's avatar Bianca Tost

added missing properties to saving and loading of data set configuration;...

added missing properties to saving and loading of data set configuration; prevent creation of data sets with names already in use
parent 43294828
......@@ -148,7 +148,7 @@ MNWPPipelineConfigurationInfo MAddDatasetDialog::getNWPPipelineConfigurationInfo
d.surfacePressureFieldType = ui->surfacePressureTypeComboBox->currentText();
d.convertGeometricHeightToPressure_ICAOStandard =
ui->convertGeometricHeightToPressureICAOStandardCheckBox->isChecked();
d.auxiliary3DPressureField = ui->useAuxiliary3DPressureLineEdit->text();
d.auxiliary3DPressureField = ui->auxiliary3DPressureFieldLineEdit->text();
d.disableGridConsistencyCheck =
ui->disableGridConsistencyCheckCheckBox->isChecked();
d.inputVarsForDerivedVars = ui->inputVarsForDerivedVarsLineEdit->text();
......@@ -254,6 +254,13 @@ void MAddDatasetDialog::saveConfiguration(QSettings *settings)
->isChecked());
settings->setValue("gribSurfacePressureFieldType",
ui->surfacePressureTypeComboBox->currentText());
settings->setValue("auxiliary3DPressureField",
ui->auxiliary3DPressureFieldLineEdit->text());
settings->setValue(
"disableGridConsistencyCheck",
ui->disableGridConsistencyCheckCheckBox->isChecked());
settings->setValue("inputVarsForDerivedVars",
ui->inputVarsForDerivedVarsLineEdit->text());
settings->endGroup();
}
// Save configuration for Trajectories Pipeline.
......@@ -332,6 +339,13 @@ void MAddDatasetDialog::loadConfiguration(QSettings *settings)
ui->surfacePressureTypeComboBox->setCurrentText(
settings->value("gribSurfacePressureFieldType",
"auto").toString());
ui->auxiliary3DPressureFieldLineEdit->setText(
settings->value("auxiliary3DPressureField", "").toString());
ui->disableGridConsistencyCheckCheckBox->setChecked(
settings->value("disableGridConsistencyCheck",
false).toBool());
ui->inputVarsForDerivedVarsLineEdit->setText(
settings->value("inputVarsForDerivedVars", "").toString());
settings->endGroup();
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>734</width>
<height>496</height>
<height>525</height>
</rect>
</property>
<property name="windowTitle">
......@@ -262,7 +262,7 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="useAuxiliary3DPressureLineEdit"/>
<widget class="QLineEdit" name="auxiliary3DPressureFieldLineEdit"/>
</item>
</layout>
</item>
......
......@@ -572,11 +572,28 @@ void MPipelineConfiguration::initializeNWPPipeline(
bool disableGridConsistencyCheck,
QString inputVarsForDerivedVars)
{
const QString dataSourceId = name;
const QString dataSourceIdDerived = dataSourceId + " derived";
QStringList dataSourceIDs = QStringList()
<< (dataSourceId + QString(" ENSFilter"))
<< dataSourceIdDerived + QString(" ENSFilter");
if (enableProbabiltyRegionFilter)
{
dataSourceIDs << (dataSourceId + QString(" ProbReg"))
<< (dataSourceIdDerived + QString(" ProbReg"));
}
if (!checkUniquenessOfDataSourceNames(dataSourceId, dataSourceIDs))
{
return;
}
MSystemManagerAndControl *sysMC = MSystemManagerAndControl::getInstance();
MAbstractScheduler* scheduler = sysMC->getScheduler(schedulerID);
MAbstractMemoryManager* memoryManager = sysMC->getMemoryManager(memoryManagerID);
const QString dataSourceId = name;
LOG4CPLUS_DEBUG(mlog, "Initializing NWP pipeline ''"
<< dataSourceId.toStdString() << "'' ...");
......@@ -647,8 +664,6 @@ void MPipelineConfiguration::initializeNWPPipeline(
// is the same as above).
// =====================================================================
const QString dataSourceIdDerived = dataSourceId + " derived";
MDerivedMetVarsDataSource *derivedMetVarsSource =
new MDerivedMetVarsDataSource();
derivedMetVarsSource->setMemoryManager(memoryManager);
......@@ -722,12 +737,28 @@ void MPipelineConfiguration::initializePrecomputedTrajectoriesPipeline(
QString schedulerID,
QString memoryManagerID)
{
const QString dataSourceId = name;
QStringList dataSourceIDs = QStringList()
<< (dataSourceId + QString(" Reader"))
// Also check the names used in
// initializeEnsembleTrajectoriesPipeline() here to avoid the
// reader being added while the rest might not be able to be
// added.
<< (dataSourceId + QString(" timestepFilter"))
<< (dataSourceId + QString(" Normals"))
<< (dataSourceId)
<< (dataSourceId + QString(" ProbReg"));
if (!checkUniquenessOfDataSourceNames(dataSourceId, dataSourceIDs))
{
return;
}
MSystemManagerAndControl *sysMC = MSystemManagerAndControl::getInstance();
MAbstractScheduler* scheduler = sysMC->getScheduler(schedulerID);
MAbstractMemoryManager* memoryManager =
sysMC->getMemoryManager(memoryManagerID);
const QString dataSourceId = name;
LOG4CPLUS_DEBUG(mlog,
"Initializing precomputed ensemble trajectories pipeline ''"
<< dataSourceId.toStdString() << "'' ...");
......@@ -762,12 +793,29 @@ void MPipelineConfiguration::initializeTrajectoryComputationPipeline(
QString windVerticalVariable,
MVerticalLevelType verticalLevelType)
{
const QString dataSourceId = name;
QStringList dataSourceIDs = QStringList()
<< (dataSourceId + QString(" Reader"))
// Also check the names used in
// initializeEnsembleTrajectoriesPipeline() here to avoid the
// reader being added while the rest might not be able to be
// added.
<< (dataSourceId + QString(" timestepFilter"))
<< (dataSourceId + QString(" Normals"))
<< (dataSourceId)
<< (dataSourceId + QString(" ProbReg"));
if (!checkUniquenessOfDataSourceNames(dataSourceId, dataSourceIDs))
{
return;
}
MSystemManagerAndControl *sysMC = MSystemManagerAndControl::getInstance();
MAbstractScheduler* scheduler = sysMC->getScheduler(schedulerID);
MAbstractMemoryManager* memoryManager =
sysMC->getMemoryManager(memoryManagerID);
const QString dataSourceId = name;
LOG4CPLUS_DEBUG(mlog, "Initializing trajectory computation pipeline ''"
"" << dataSourceId.toStdString() << "'' ...");
......@@ -881,6 +929,17 @@ void MPipelineConfiguration::initializeEnsembleTrajectoriesPipeline(
MAbstractScheduler* scheduler,
MAbstractMemoryManager* memoryManager)
{
QStringList dataSourceIDs = QStringList()
<< (dataSourceId + QString(" timestepFilter"))
<< (dataSourceId + QString(" Normals"))
<< (dataSourceId)
<< (dataSourceId + QString(" ProbReg"));
if (!checkUniquenessOfDataSourceNames(dataSourceId, dataSourceIDs))
{
return;
}
MSystemManagerAndControl *sysMC = MSystemManagerAndControl::getInstance();
MDeltaPressurePerTrajectorySource *dpSource =
......@@ -985,6 +1044,13 @@ void MPipelineConfiguration::initializeConfigurablePipeline(
{
case DIFFERENCE:
{
QStringList dataSourceIDs = QStringList()
<< (dataSourceId + QString(" ENSFilter"));
if (!checkUniquenessOfDataSourceNames(dataSourceId, dataSourceIDs))
{
return;
}
// Pipeline for difference variables.
// ==================================
const QString dataSourceIdDifference = dataSourceId;
......@@ -1231,4 +1297,31 @@ void MPipelineConfiguration::checkAndStoreDefaultPipelineMemoryManager(
}
bool MPipelineConfiguration::checkUniquenessOfDataSourceNames(
QString dataSetName,
QStringList &dataSources) const
{
MMainWindow *mainWin =
MSystemManagerAndControl::getInstance()->getMainWindow();
QStringList existingDataSourcesList =
MSystemManagerAndControl::getInstance()->getDataSourceIdentifiers();
for (QString dataSourceID : dataSources)
{
if (existingDataSourcesList.contains(dataSourceID))
{
QMessageBox::warning(
mainWin, "Adding data set",
"The name '" + dataSetName
+ "' is already in use by another data set."
"\nPlease choose a different name."
"\n(The data set will NOT be added.)");
return false;
}
}
return true;
}
} // namespace Met3D
......@@ -194,6 +194,18 @@ protected:
QString defaultMemoryManager, QString PipelineID,
QMap<QString, QString> *defaultMemoryManagers,
MSystemManagerAndControl *sysMC);
/**
Checks if one of the name strings contained in @p dataSources matches the
name of any already existing data source.
If a match can be found, QMessageBox::warning is displayed to inform the
user using the name of the data set given by @p dataSetName and the
method returns false. If no match can be found no message is displayed
and method returns true.
*/
bool checkUniquenessOfDataSourceNames(QString dataSetName,
QStringList &dataSources) const;
};
} // namespace Met3D
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment