diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp index eff9bc8d1e..d6811aa80d 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp @@ -212,7 +212,7 @@ QList } else if (fieldNeedingOptions == &transScalingTimeStep) { - std::map wellProductionStartStrings = generateWellProductionStartStrings(); + std::map>> wellProductionStartStrings = generateWellProductionStartStrings(); QStringList timeStepNames; @@ -226,7 +226,43 @@ QList auto it = wellProductionStartStrings.find(i); if (it != wellProductionStartStrings.end()) { - timeStepString += QString(" [Start: %1]").arg(it->second.join(", ")); + int numberOfWells = static_cast(it->second.size()); + QStringList wellList; + QStringList wellPressureList; + const int maxStringLength = 70; + QString startStringFormat(" [Start: %1]"); + + for (int w = 0; w < numberOfWells; ++w) + { + QString wellString = it->second[w].first; + QStringList candidateWellList = wellList; candidateWellList << wellString; + + if (startStringFormat.arg(candidateWellList.join(", ")).length() < maxStringLength) + { + wellList.swap(candidateWellList); + } + + QString wellStringWithPressure = QString("%1 (%2)").arg(it->second[w].first).arg(it->second[w].second); + QStringList candidateWellPressureList = wellPressureList; candidateWellPressureList << wellStringWithPressure; + if (startStringFormat.arg(candidateWellPressureList.join(", ")).length() < maxStringLength) + { + wellPressureList.swap(candidateWellPressureList); + } + } + + if (wellList.size() < numberOfWells) + { + wellList += QString("+ %1 more").arg(numberOfWells - wellList.size()); + timeStepString += startStringFormat.arg(wellList.join(", ")); + } + else if (wellPressureList.size() < numberOfWells) + { + timeStepString += startStringFormat.arg(wellList.join(", ")); + } + else + { + timeStepString += startStringFormat.arg(wellPressureList.join(", ")); + } } options.push_back(caf::PdmOptionItemInfo(timeStepString, i)); @@ -317,9 +353,9 @@ void RicExportCompletionDataSettingsUi::defineUiOrdering(QString uiConfigName, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::map RicExportCompletionDataSettingsUi::generateWellProductionStartStrings() +std::map>> RicExportCompletionDataSettingsUi::generateWellProductionStartStrings() { - std::map wellProductionStartStrings; + std::map>> wellProductionStartStrings; const RimProject* project = nullptr; if (caseToApply) @@ -338,7 +374,7 @@ std::map RicExportCompletionDataSettingsUi::generateWellProduc ¤tWellPressure); if (initialWellProductionTimeStep >= 0) { - wellProductionStartStrings[initialWellProductionTimeStep] += QString("%1 (%2 Bar)").arg(wellPath->name()).arg(initialWellPressure, 4, 'f', 1); + wellProductionStartStrings[initialWellProductionTimeStep].push_back(std::make_pair(wellPath->name(), QString("%1 Bar").arg(initialWellPressure, 4, 'f', 1))); } } } diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h index b742f99a39..856ac39c99 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h @@ -95,7 +95,7 @@ protected: QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - std::map generateWellProductionStartStrings(); + std::map>> generateWellProductionStartStrings(); private: caf::PdmField m_reportCompletionTypesSeparately;