diff --git a/ApplicationCode/Application/Tools/RiaStdStringTools.cpp b/ApplicationCode/Application/Tools/RiaStdStringTools.cpp index a82f4674df..fb07082ec0 100644 --- a/ApplicationCode/Application/Tools/RiaStdStringTools.cpp +++ b/ApplicationCode/Application/Tools/RiaStdStringTools.cpp @@ -102,6 +102,17 @@ bool RiaStdStringTools::startsWithAlphabetic(const std::string& s) return isalpha(s[0]) != 0; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaStdStringTools::endsWith(const std::string& mainStr, const std::string& toMatch) +{ + if (mainStr.size() >= toMatch.size() && mainStr.compare(mainStr.size() - toMatch.size(), toMatch.size(), toMatch) == 0) + return true; + else + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -127,3 +138,4 @@ size_t RiaStdStringTools::findCharMatchCount(const std::string& s, char c) } return count; } + diff --git a/ApplicationCode/Application/Tools/RiaStdStringTools.h b/ApplicationCode/Application/Tools/RiaStdStringTools.h index 5de74be4ed..9430ad9361 100644 --- a/ApplicationCode/Application/Tools/RiaStdStringTools.h +++ b/ApplicationCode/Application/Tools/RiaStdStringTools.h @@ -39,6 +39,9 @@ public: static bool containsAlphabetic(const std::string& s); static bool startsWithAlphabetic(const std::string& s); + static bool endsWith(const std::string& mainStr, const std::string& toMatch); + + static std::vector splitStringBySpace(const std::string& s); private: diff --git a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp index b23b143140..9b0f7f973a 100644 --- a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp +++ b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaSummaryCurveAnalyzer.h" +#include "RiaStdStringTools.h" #include "RiaSummaryCurveDefinition.h" @@ -62,6 +63,44 @@ std::set RiaSummaryCurveAnalyzer::quantities() const return m_quantities; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RiaSummaryCurveAnalyzer::quantityNamesWithHistory() const +{ + assignCategoryToQuantities(); + + return m_quantitiesWithMatchingHistory; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RiaSummaryCurveAnalyzer::quantityNamesNoHistory() const +{ + assignCategoryToQuantities(); + + return m_quantitiesNoMatchingHistory; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RiaSummaryCurveAnalyzer::quantityNameForTitle() const +{ + if (quantityNamesWithHistory().size() == 1 && quantityNamesNoHistory().empty()) + { + return *quantityNamesWithHistory().begin(); + } + + if (quantityNamesNoHistory().size() == 1 && quantityNamesWithHistory().empty()) + { + return *quantityNamesNoHistory().begin(); + } + + return std::string(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -130,7 +169,7 @@ std::vector RiaSummaryCurveAnalyzer::identifierTexts(RifEclipseSummaryA /// //-------------------------------------------------------------------------------------------------- std::vector - RiaSummaryCurveAnalyzer::addressesForCategory(const std::set& addresses, + RiaSummaryCurveAnalyzer::addressesForCategory(const std::set& addresses, RifEclipseSummaryAddress::SummaryVarCategory category) { std::vector filteredAddresses; @@ -146,6 +185,24 @@ std::vector return filteredAddresses; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName(const std::string& curveName) +{ + static std::string historyIdentifier = "H"; + + if (RiaStdStringTools::endsWith(curveName, historyIdentifier)) + { + std::string candidate = curveName.substr(0, curveName.size() - 1); + return candidate; + } + else + { + return curveName + historyIdentifier; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -158,6 +215,53 @@ void RiaSummaryCurveAnalyzer::clear() m_categories.clear(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaSummaryCurveAnalyzer::assignCategoryToQuantities() const +{ + if (!m_quantities.empty()) + { + if (m_quantitiesWithMatchingHistory.empty() && m_quantitiesNoMatchingHistory.empty()) + { + computeQuantityNamesWithHistory(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const +{ + m_quantitiesNoMatchingHistory.clear(); + m_quantitiesWithMatchingHistory.clear(); + + const std::string historyIdentifier("H"); + + for (const auto& s : m_quantities) + { + std::string correspondingHistoryCurve = correspondingHistorySummaryCurveName(s); + + if (m_quantities.find(correspondingHistoryCurve) != m_quantities.end()) + { + // Insert the curve name without H + if (RiaStdStringTools::endsWith(s, historyIdentifier)) + { + m_quantitiesWithMatchingHistory.insert(correspondingHistoryCurve); + } + else + { + m_quantitiesWithMatchingHistory.insert(s); + } + } + else + { + m_quantitiesNoMatchingHistory.insert(s); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h index e66475241f..fea237f115 100644 --- a/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h +++ b/ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.h @@ -42,6 +42,11 @@ public: void clear(); std::set quantities() const; + std::set quantityNamesWithHistory() const; + std::set quantityNamesNoHistory() const; + + std::string quantityNameForTitle() const; + std::set wellNames() const; std::set wellGroupNames() const; std::set regionNumbers() const; @@ -53,11 +58,19 @@ public: static std::vector addressesForCategory(const std::set& addresses, RifEclipseSummaryAddress::SummaryVarCategory category); + static std::string correspondingHistorySummaryCurveName(const std::string& curveName); + private: + void assignCategoryToQuantities() const; + void computeQuantityNamesWithHistory() const; + void analyzeSingleAddress(const RifEclipseSummaryAddress& address); private: std::set m_quantities; + mutable std::set m_quantitiesWithMatchingHistory; + mutable std::set m_quantitiesNoMatchingHistory; + std::set m_wellNames; std::set m_wellGroupNames; std::set m_regionNumbers; diff --git a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp index 728cf62b59..34222e8944 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp @@ -101,7 +101,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked) QString subIndexText = QString("%1").arg(sub.subIndex, 2, 10, QChar('0')); QString lateralName = QString("%1_%2_Sub%3_Lat%4").arg(wellPath->name()).arg(fishboneName).arg(subIndexText).arg(lateralIndex); - EXP::writeWellPathGeometryToStream(*stream, wellPath, lateralName, mdStepSize); + EXP::writeWellPathGeometryToStream(*stream, &geometry, lateralName, mdStepSize, false, 0.0, false); } } } diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index c6d26579f7..7e0081b18c 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -328,7 +328,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve std::vector completionsForWell; for (const auto& completion : completions) { - if (completion.wellName() == wellPath->completions()->wellNameForExport()) + if (RicWellPathExportCompletionDataFeatureImpl::isCompletionWellPathEqual(completion, wellPath)) { completionsForWell.push_back(completion); } @@ -369,10 +369,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve std::vector completionsForWell; for (const auto& completion : completions) { - if (completion.wellName() == wellPath->completions()->wellNameForExport() && - completionType == completion.completionType()) + if (completionType == completion.completionType()) { - completionsForWell.push_back(completion); + if (RicWellPathExportCompletionDataFeatureImpl::isCompletionWellPathEqual(completion, wellPath)) + { + completionsForWell.push_back(completion); + } } } @@ -616,7 +618,7 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(RifEclipse formatter.add(startMD); formatter.addValueOrDefaultMarker(exportInfo.topWellBoreVolume(), RicMswExportInfo::defaultDoubleValue()); formatter.add(exportInfo.lengthAndDepthText()); - formatter.add(exportInfo.pressureDropText()); + formatter.add(QString("'%1'").arg(exportInfo.pressureDropText())); formatter.rowCompleted(); } @@ -998,6 +1000,7 @@ RigCompletionData RigCompletionData resultCompletion(wellName, cellIndexIJK, firstCompletion.firstOrderingValue()); resultCompletion.setSecondOrderingValue(firstCompletion.secondOrderingValue()); + resultCompletion.setSourcePdmObject(firstCompletion.sourcePdmObject()); bool anyNonDarcyFlowPresent = false; for (const auto& c : completions) @@ -1125,7 +1128,9 @@ QFilePtr RicWellPathExportCompletionDataFeatureImpl::openFileForExport(const QSt } } - QString filePath = exportFolder.filePath(fileName); + QString validFileName = caf::Utils::makeValidFileBasename(fileName); + + QString filePath = exportFolder.filePath(validFileName); QFilePtr exportFile(new QFile(filePath)); if (!exportFile->open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -2669,6 +2674,23 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCarfinForTemporaryLgrs(co } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicWellPathExportCompletionDataFeatureImpl::isCompletionWellPathEqual(const RigCompletionData& completion, + const RimWellPath* wellPath) +{ + if (!wellPath) return false; + + RimWellPath* parentWellPath = nullptr; + if (completion.sourcePdmObject()) + { + completion.sourcePdmObject()->firstAncestorOrThisOfType(parentWellPath); + } + + return (parentWellPath == wellPath); +} + //-------------------------------------------------------------------------------------------------- /// Internal function //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index 176fdb70c4..ca64c86b02 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -290,4 +290,5 @@ private: static void exportCarfinForTemporaryLgrs(const RimEclipseCase* sourceCase, const QString& folder); + static bool isCompletionWellPathEqual(const RigCompletionData& completion, const RimWellPath* wellPath); }; diff --git a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp index 4819bf5ed3..0caaace5f7 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp @@ -374,9 +374,9 @@ void RicExportLgrFeature::writeLgrs(QTextStream& stream, const std::vectorwellPathGeometry(); if (!wellPathGeom) return; + bool useMdRkb = false; + double rkb = 0.0; + { + const RimModeledWellPath* modeledWellPath = dynamic_cast(wellPath); + if (modeledWellPath) + { + useMdRkb = true; + rkb = modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget(); + } + } + + writeWellPathGeometryToStream(stream, wellPathGeom, exportName, mdStepSize, useMdRkb, rkb, writeProjectInfo); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStream& stream, + const RigWellPath* wellPathGeom, + const QString& exportName, + double mdStepSize, + bool useMdRkb, + double rkbOffset, + bool writeProjectInfo) +{ + if (!wellPathGeom) return; + double currMd = wellPathGeom->measureDepths().front() - mdStepSize; double endMd = wellPathGeom->measureDepths().back(); @@ -88,27 +115,16 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStrea stream << endl; } - bool useMdRkb = false; - double rkb = 0.0; - { - const RimModeledWellPath* modeledWellPath = dynamic_cast(wellPath); - if (modeledWellPath) - { - useMdRkb = true; - rkb = modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget(); - } - } - stream << "WELLNAME: '" << caf::Utils::makeValidFileBasename(exportName) << "'" << endl; auto numberFormat = RifEclipseOutputTableDoubleFormatting(RIF_FLOAT, 2); formatter.header( - { - {"X", numberFormat, RIGHT}, - {"Y", numberFormat, RIGHT}, - {"TVDMSL", numberFormat, RIGHT}, - {useMdRkb ? "MDRKB" : "MDMSL", numberFormat, RIGHT} - }); + { + {"X", numberFormat, RIGHT}, + {"Y", numberFormat, RIGHT}, + {"TVDMSL", numberFormat, RIGHT}, + {useMdRkb ? "MDRKB" : "MDMSL", numberFormat, RIGHT} + }); while (currMd < endMd) { @@ -122,7 +138,7 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStrea formatter.add(pt.x()); formatter.add(pt.y()); formatter.add(tvd); - formatter.add(currMd + rkb); + formatter.add(currMd + rkbOffset); formatter.rowCompleted(""); } formatter.tableCompleted("", false); diff --git a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h index 702e076fba..edf047d1d0 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h +++ b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h @@ -51,12 +51,21 @@ class RicExportSelectedWellPathsFeature : public caf::CmdFeature static RicExportWellPathsUi* openDialog(); static QFilePtr openFileForExport(const QString& folderName, const QString& fileName); static QTextStreamPtr createOutputFileStream(QFile& file); + static void writeWellPathGeometryToStream(QTextStream& stream, const RimWellPath* wellPath, const QString& exportName, double mdStepSize, bool writeProjectInfo = true); + static void writeWellPathGeometryToStream(QTextStream& stream, + const RigWellPath* wellPath, + const QString& exportName, + double mdStepSize, + bool useMdRkb, + double rkbOffset, + bool writeProjectInfo); + private: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; diff --git a/ApplicationCode/Commands/RicFileHierarchyDialog.cpp b/ApplicationCode/Commands/RicFileHierarchyDialog.cpp index c941f3a709..e5ca5b34c8 100644 --- a/ApplicationCode/Commands/RicFileHierarchyDialog.cpp +++ b/ApplicationCode/Commands/RicFileHierarchyDialog.cpp @@ -116,9 +116,12 @@ RicFileHierarchyDialog::RicFileHierarchyDialog(QWidget* parent) m_effectiveFilter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_fileListLabel->setText("Files found"); m_fileListLabel->setVisible(false); + m_fileList->setSelectionMode(QAbstractItemView::ExtendedSelection); m_fileList->setVisible(false); m_fileList->setContextMenuPolicy(Qt::CustomContextMenu); + m_fileList->setSortingEnabled(true); + m_browseButton->setText("..."); m_browseButton->setFixedWidth(25); m_findOrCancelButton->setText(FIND_BUTTON_FIND_TEXT); diff --git a/ApplicationCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationCode/Commands/RicImportEnsembleFeature.cpp index ea8e82a40d..dcdcd89b53 100644 --- a/ApplicationCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationCode/Commands/RicImportEnsembleFeature.cpp @@ -63,7 +63,8 @@ bool RicImportEnsembleFeature::isCommandEnabled() void RicImportEnsembleFeature::onActionTriggered(bool isChecked) { RiaApplication* app = RiaApplication::instance(); - QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble"); + QString pathCacheName = "ENSEMBLE_FILES"; + QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Ensemble", pathCacheName); if (fileNames.isEmpty()) return; diff --git a/ApplicationCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationCode/Commands/RicImportSummaryCasesFeature.cpp index 173d79c0e9..53dddd8308 100644 --- a/ApplicationCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationCode/Commands/RicImportSummaryCasesFeature.cpp @@ -70,7 +70,8 @@ bool RicImportSummaryCasesFeature::isCommandEnabled() void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked) { RiaApplication* app = RiaApplication::instance(); - QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases"); + QString pathCacheName = "INPUT_FILES"; + QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases", pathCacheName); std::vector cases; if (!fileNames.isEmpty()) createSummaryCasesFromFiles(fileNames, &cases); @@ -217,10 +218,11 @@ void RicImportSummaryCasesFeature::addCasesToGroupIfRelevant(const std::vectorlastUsedDialogDirectory("INPUT_FILES"); + QString defaultDir = app->lastUsedDialogDirectory(pathCacheName); RicFileHierarchyDialogResult result = RicFileHierarchyDialog::runRecursiveSearchDialog(nullptr, dialogTitle, @@ -236,7 +238,7 @@ QStringList RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialo if (!result.ok) return QStringList(); // Remember the path to next time - app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(result.rootDir).absoluteFilePath()); + app->setLastUsedDialogDirectory(pathCacheName, QFileInfo(result.rootDir).absoluteFilePath()); return result.files; } diff --git a/ApplicationCode/Commands/RicImportSummaryCasesFeature.h b/ApplicationCode/Commands/RicImportSummaryCasesFeature.h index 3efc668cc8..14afbad64a 100644 --- a/ApplicationCode/Commands/RicImportSummaryCasesFeature.h +++ b/ApplicationCode/Commands/RicImportSummaryCasesFeature.h @@ -43,7 +43,7 @@ public: static void addSummaryCases(const std::vector cases); static void addCasesToGroupIfRelevant(const std::vector cases); - static QStringList runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle); + static QStringList runRecursiveSummaryCaseFileSearchDialog(const QString& dialogTitle, const QString& pathCacheName); protected: // Overrides diff --git a/ApplicationCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationCode/Commands/RicImportSummaryGroupFeature.cpp index 24f899cef0..0f98bf2eec 100644 --- a/ApplicationCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationCode/Commands/RicImportSummaryGroupFeature.cpp @@ -61,7 +61,8 @@ bool RicImportSummaryGroupFeature::isCommandEnabled() void RicImportSummaryGroupFeature::onActionTriggered(bool isChecked) { RiaApplication* app = RiaApplication::instance(); - QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Summary Case Group"); + QString pathCacheName = "INPUT_FILES"; + QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Summary Case Group", pathCacheName); if (fileNames.isEmpty()) return; diff --git a/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 3a6d690770..c0b6833655 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -36,6 +36,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsembleCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicPasteEnsembleCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleCurveFilterFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedEnsembleFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingSummaryCurveFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.h +${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -75,6 +79,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsembleCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicPasteEnsembleCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleCurveFilterFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedEnsembleFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingSummaryCurveFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.cpp +${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingEnsembleCurveSetFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingEnsembleCurveSetFeature.cpp new file mode 100644 index 0000000000..b715c7323e --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingEnsembleCurveSetFeature.cpp @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicClearSourceSteppingEnsembleCurveSetFeature.h" + +#include "RimEnsembleCurveSet.h" +#include "RimEnsembleCurveSetCollection.h" +#include "RimSummaryCurve.h" +#include "RimSummaryCurveCollection.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT(RicClearSourceSteppingEnsembleCurveSetFeature, "RicClearSourceSteppingEnsembleCurveSetFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicClearSourceSteppingEnsembleCurveSetFeature::isCommandEnabled() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if (objects.size() == 1) + { + auto c = objects[0]; + + RimSummaryPlot* summaryPlot = nullptr; + c->firstAncestorOrThisOfTypeAsserted(summaryPlot); + if (summaryPlot) + { + if (summaryPlot->ensembleCurveSetCollection()->curveSetForSourceStepping() + || summaryPlot->summaryCurveCollection()->curveForSourceStepping()) + { + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicClearSourceSteppingEnsembleCurveSetFeature::onActionTriggered(bool isChecked) +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if (objects.size() == 1) + { + auto c = objects[0]; + + RimSummaryPlot* summaryPlot = nullptr; + c->firstAncestorOrThisOfType(summaryPlot); + if (summaryPlot) + { + clearAllSourceSteppingInSummaryPlot(summaryPlot); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicClearSourceSteppingEnsembleCurveSetFeature::clearAllSourceSteppingInSummaryPlot(const RimSummaryPlot* summaryPlot) +{ + RimEnsembleCurveSet* previousCurveSet = summaryPlot->ensembleCurveSetCollection()->curveSetForSourceStepping(); + summaryPlot->ensembleCurveSetCollection()->setCurveSetForSourceStepping(nullptr); + + RimSummaryCurve* previousCurve = summaryPlot->summaryCurveCollection()->curveForSourceStepping(); + summaryPlot->summaryCurveCollection()->setCurveForSourceStepping(nullptr); + + if (previousCurveSet) + { + previousCurveSet->updateConnectedEditors(); + } + + if (previousCurve) + { + previousCurve->updateConnectedEditors(); + } + + RiuPlotMainWindowTools::refreshToolbars(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicClearSourceSteppingEnsembleCurveSetFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Clear Source Stepping Curve Set"); + actionToSetup->setIcon(QIcon(":/StepUpDown16x16.png")); +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingEnsembleCurveSetFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingEnsembleCurveSetFeature.h new file mode 100644 index 0000000000..2bb811e746 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingEnsembleCurveSetFeature.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RimSummaryPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicClearSourceSteppingEnsembleCurveSetFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +public: + static void clearAllSourceSteppingInSummaryPlot(const RimSummaryPlot* summaryPlot); + +protected: + bool isCommandEnabled() override; + void onActionTriggered(bool isChecked) override; + + + void setupActionLook(QAction* actionToSetup) override; +}; diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingSummaryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingSummaryCurveFeature.cpp new file mode 100644 index 0000000000..56490344d3 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingSummaryCurveFeature.cpp @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicClearSourceSteppingSummaryCurveFeature.h" +#include "RicClearSourceSteppingEnsembleCurveSetFeature.h" + +#include "RimSummaryCurve.h" +#include "RimSummaryCurveCollection.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManager.h" + +#include +#include "RimEnsembleCurveSetCollection.h" + +CAF_CMD_SOURCE_INIT(RicClearSourceSteppingSummaryCurveFeature, "RicClearSourceSteppingSummaryCurveFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicClearSourceSteppingSummaryCurveFeature::isCommandEnabled() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if (objects.size() == 1) + { + auto c = objects[0]; + + RimSummaryPlot* summaryPlot = nullptr; + c->firstAncestorOrThisOfTypeAsserted(summaryPlot); + if (summaryPlot) + { + if (summaryPlot->ensembleCurveSetCollection()->curveSetForSourceStepping() + || summaryPlot->summaryCurveCollection()->curveForSourceStepping()) + { + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicClearSourceSteppingSummaryCurveFeature::onActionTriggered(bool isChecked) +{ + std::vector summaryCurves; + caf::SelectionManager::instance()->objectsByType(&summaryCurves); + + if (summaryCurves.size() == 1) + { + auto c = summaryCurves[0]; + + RimSummaryPlot* summaryPlot = nullptr; + c->firstAncestorOrThisOfType(summaryPlot); + if (summaryPlot) + { + RicClearSourceSteppingEnsembleCurveSetFeature::clearAllSourceSteppingInSummaryPlot(summaryPlot); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicClearSourceSteppingSummaryCurveFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Clear Source Stepping Curve"); + actionToSetup->setIcon(QIcon(":/StepUpDown16x16.png")); +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingSummaryCurveFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingSummaryCurveFeature.h new file mode 100644 index 0000000000..81e4f1f200 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicClearSourceSteppingSummaryCurveFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicClearSourceSteppingSummaryCurveFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered(bool isChecked) override; + void setupActionLook(QAction* actionToSetup) override; +}; diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index 1d5d324280..f3364dfaaf 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -19,6 +19,7 @@ #include "RicNewSummaryCurveFeature.h" #include "RiaApplication.h" +#include "RiaColorTables.h" #include "RimMainPlotCollection.h" #include "RimOilField.h" @@ -31,8 +32,6 @@ #include "RiuPlotMainWindow.h" -#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" - #include "cafSelectionManager.h" #include "cvfAssert.h" @@ -62,7 +61,9 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked) if (plot) { RimSummaryCurve* newCurve = new RimSummaryCurve(); - cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount()); + + // Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered + cvf::Color3f curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(plot->singleColorCurveCount()); newCurve->setColor(curveColor); plot->addCurveAndUpdate(newCurve); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index d9d8039433..606faf578d 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -67,12 +67,8 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked) { RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet(); - // Set single curve set color - auto allCurveSets = plot->ensembleCurveSetCollection()->curveSets(); - size_t colorIndex = std::count_if(allCurveSets.begin(), allCurveSets.end(), [](RimEnsembleCurveSet* curveSet) - { - return curveSet->colorMode() == RimEnsembleCurveSet::SINGLE_COLOR; - }); + // Use same counting as RicNewSummaryCurveFeature::onActionTriggered + auto colorIndex = plot->singleColorCurveCount(); curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex)); curveSet->legendConfig()->setColorRange(RimEnsembleCurveSetColorManager::cycledEnsembleColorRange(static_cast(colorIndex))); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingEnsembleCurveSetFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingEnsembleCurveSetFeature.cpp new file mode 100644 index 0000000000..fec1dbfcc8 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingEnsembleCurveSetFeature.cpp @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSetSourceSteppingEnsembleCurveSetFeature.h" + +#include "RimEnsembleCurveSet.h" +#include "RimEnsembleCurveSetCollection.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManager.h" + +#include +#include "RicClearSourceSteppingEnsembleCurveSetFeature.h" +#include "RimSummaryPlot.h" + +CAF_CMD_SOURCE_INIT(RicSetSourceSteppingEnsembleCurveSetFeature, "RicSetSourceSteppingEnsembleCurveSetFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSetSourceSteppingEnsembleCurveSetFeature::isCommandEnabled() +{ + std::vector ensembleCurveSets; + caf::SelectionManager::instance()->objectsByType(&ensembleCurveSets); + + if (ensembleCurveSets.size() == 1) + { + auto c = ensembleCurveSets[0]; + + RimEnsembleCurveSetCollection* coll = nullptr; + c->firstAncestorOrThisOfType(coll); + if (coll) + { + if (coll->curveSetForSourceStepping() != c) + { + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSetSourceSteppingEnsembleCurveSetFeature::onActionTriggered(bool isChecked) +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if (objects.size() == 1) + { + auto c = objects[0]; + + RimSummaryPlot* summaryPlot = nullptr; + c->firstAncestorOrThisOfType(summaryPlot); + if (summaryPlot) + { + RicClearSourceSteppingEnsembleCurveSetFeature::clearAllSourceSteppingInSummaryPlot(summaryPlot); + } + + RimEnsembleCurveSetCollection* coll = nullptr; + c->firstAncestorOrThisOfType(coll); + if (coll) + { + coll->setCurveSetForSourceStepping(c); + c->updateConnectedEditors(); + + RiuPlotMainWindowTools::refreshToolbars(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSetSourceSteppingEnsembleCurveSetFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Set as Source Stepping Curve Set"); + actionToSetup->setIcon(QIcon(":/StepUpDown16x16.png")); +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingEnsembleCurveSetFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingEnsembleCurveSetFeature.h new file mode 100644 index 0000000000..0657e69f35 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingEnsembleCurveSetFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicSetSourceSteppingEnsembleCurveSetFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered(bool isChecked) override; + void setupActionLook(QAction* actionToSetup) override; +}; diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingSummaryCurveFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingSummaryCurveFeature.cpp new file mode 100644 index 0000000000..153d664cd6 --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingSummaryCurveFeature.cpp @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSetSourceSteppingSummaryCurveFeature.h" +#include "RicClearSourceSteppingEnsembleCurveSetFeature.h" + +#include "RimSummaryCurve.h" +#include "RimSummaryCurveCollection.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT(RicSetSourceSteppingSummaryCurveFeature, "RicSetSourceSteppingSummaryCurveFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSetSourceSteppingSummaryCurveFeature::isCommandEnabled() +{ + std::vector summaryCurves; + caf::SelectionManager::instance()->objectsByType(&summaryCurves); + + if (summaryCurves.size() == 1) + { + auto c = summaryCurves[0]; + + RimSummaryCurveCollection* coll = nullptr; + c->firstAncestorOrThisOfTypeAsserted(coll); + if (coll) + { + if (coll->curveForSourceStepping() != c) + { + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSetSourceSteppingSummaryCurveFeature::onActionTriggered(bool isChecked) +{ + std::vector summaryCurves; + caf::SelectionManager::instance()->objectsByType(&summaryCurves); + + if (summaryCurves.size() == 1) + { + auto c = summaryCurves[0]; + + RimSummaryPlot* summaryPlot = nullptr; + c->firstAncestorOrThisOfType(summaryPlot); + if (summaryPlot) + { + RicClearSourceSteppingEnsembleCurveSetFeature::clearAllSourceSteppingInSummaryPlot(summaryPlot); + } + + RimSummaryCurveCollection* coll = nullptr; + c->firstAncestorOrThisOfTypeAsserted(coll); + if (coll) + { + coll->setCurveForSourceStepping(c); + c->updateConnectedEditors(); + + RiuPlotMainWindowTools::refreshToolbars(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSetSourceSteppingSummaryCurveFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Set as Source Stepping Curve"); + actionToSetup->setIcon(QIcon(":/StepUpDown16x16.png")); +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingSummaryCurveFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingSummaryCurveFeature.h new file mode 100644 index 0000000000..b14b40a82f --- /dev/null +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSetSourceSteppingSummaryCurveFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicSetSourceSteppingSummaryCurveFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered(bool isChecked) override; + void setupActionLook(QAction* actionToSetup) override; +}; diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index ef83dfb2ab..29c674d2fe 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -230,6 +230,9 @@ void RicSummaryCurveCreator::fieldChangedByUi(const caf::PdmFieldHandle* changed caf::PdmField* field = dynamic_cast*>(m_targetPlot->uiCapability()->objectToggleField()); field->setValueWithFieldChanged(true); + + RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow(); + mainPlotWindow->updateSummaryPlotToolBar(); } else if (changedField == &m_useAutoAppearanceAssignment && m_useAutoAppearanceAssignment) { diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp index 6fed115bd3..ea8c0fd9d0 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -520,14 +520,14 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::ensembleStatisticsAddress(con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifEclipseSummaryAddress::isDependentOnWellName(const RifEclipseSummaryAddress& address) +bool RifEclipseSummaryAddress::isDependentOnWellName(SummaryVarCategory category) { // clang-format off - if (address.category() == SUMMARY_WELL || - address.category() == SUMMARY_WELL_COMPLETION || - address.category() == SUMMARY_WELL_COMPLETION_LGR || - address.category() == SUMMARY_WELL_LGR || - address.category() == SUMMARY_WELL_SEGMENT) + if (category == SUMMARY_WELL || + category == SUMMARY_WELL_COMPLETION || + category == SUMMARY_WELL_COMPLETION_LGR || + category == SUMMARY_WELL_LGR || + category == SUMMARY_WELL_SEGMENT) { return true; } diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h index e898220568..b321d648bf 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h +++ b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h @@ -144,7 +144,7 @@ public: static RifEclipseSummaryAddress importedAddress(const std::string& quantityName); static RifEclipseSummaryAddress ensembleStatisticsAddress(const std::string& quantityName, const std::string& dataQuantityName); - static bool isDependentOnWellName(const RifEclipseSummaryAddress& address); + static bool isDependentOnWellName(SummaryVarCategory category); // Access methods diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp index d2a6b65f0f..5ccae742ff 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp @@ -97,6 +97,7 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs() initialiseObsoleteFields(); CAF_PDM_InitFieldNoDefault(&m_valveLocations, "ValveLocations", "Valve Locations", "", "", ""); m_valveLocations = new RimMultipleValveLocations(); + m_valveLocations->findField("RangeValveCount")->uiCapability()->setUiName("Number of Subs"); m_valveLocations.uiCapability()->setUiHidden(true); m_valveLocations.uiCapability()->setUiTreeChildrenHidden(true); diff --git a/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp b/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp index 3190a35a7f..459127a089 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp @@ -30,7 +30,7 @@ namespace caf { addItem(RimMswCompletionParameters::HYDROSTATIC, "H--", "Hydrostatic"); addItem(RimMswCompletionParameters::HYDROSTATIC_FRICTION, "HF-", "Hydrostatic + Friction"); addItem(RimMswCompletionParameters::HYDROSTATIC_FRICTION_ACCELERATION, "HFA", "Hydrostatic + Friction + Acceleration"); - setDefault(RimMswCompletionParameters::HYDROSTATIC); + setDefault(RimMswCompletionParameters::HYDROSTATIC_FRICTION); } template<> diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index dbc75013da..c5aa69e585 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -461,7 +461,6 @@ WellFractureIntersectionData RimStimPlanFractureTemplate::wellFractureIntersecti double weightedConductivity = 0.0; double weightedWidth = 0.0; double weightedBetaFactorOnFile = 0.0; - double conversionFactorForBeta = 1.0; { std::vector widthResultValues; @@ -483,20 +482,6 @@ WellFractureIntersectionData RimStimPlanFractureTemplate::wellFractureIntersecti auto nameUnit = betaFactorParameterNameAndUnit(); betaFactorResultValues = m_stimPlanFractureDefinitionData->fractureGridResults( nameUnit.first, nameUnit.second, m_activeTimeStepIndex); - - QString trimmedUnit = nameUnit.second.trimmed().toLower(); - if (trimmedUnit == "/m") - { - conversionFactorForBeta = 1.01325E+08; - } - else if (trimmedUnit == "/cm") - { - conversionFactorForBeta = 1.01325E+06; - } - else if (trimmedUnit == "/ft") - { - conversionFactorForBeta = 3.088386E+07; - } } RiaWeightedMeanCalculator widthCalc; @@ -522,7 +507,15 @@ WellFractureIntersectionData RimStimPlanFractureTemplate::wellFractureIntersecti if (fractureGlobalCellIndex < betaFactorResultValues.size()) { - betaFactorCalc.addValueAndWeight(betaFactorResultValues[fractureGlobalCellIndex], intersectionLength); + double nativeBetaFactor = betaFactorResultValues[fractureGlobalCellIndex]; + + // Guard against zero beta values, as these values will set the geometric mean to zero + // Consider using the conductivity threshold instead of a local beta threshold + const double threshold = 1e-6; + if (fabs(nativeBetaFactor) > threshold) + { + betaFactorCalc.addValueAndWeight(nativeBetaFactor, intersectionLength); + } } } if (conductivityCalc.validAggregatedWeight()) @@ -545,7 +538,9 @@ WellFractureIntersectionData RimStimPlanFractureTemplate::wellFractureIntersecti values.m_width = weightedWidth; values.m_conductivity = weightedConductivity; - double betaFactorForcheimer = weightedBetaFactorOnFile / conversionFactorForBeta; + double conversionFactorForBeta = conversionFactorForBetaValues(); + double betaFactorForcheimer = weightedBetaFactorOnFile / conversionFactorForBeta; + values.m_betaFactorInForcheimerUnits = betaFactorForcheimer; } @@ -561,24 +556,42 @@ WellFractureIntersectionData RimStimPlanFractureTemplate::wellFractureIntersecti double conductivity = wellCell.getConductivityValue(); values.m_conductivity = conductivity; - auto nameUnit = widthParameterNameAndUnit(); - if (!nameUnit.first.isEmpty()) { - double widthInRequiredUnit = HUGE_VAL; + auto nameUnit = widthParameterNameAndUnit(); + if (!nameUnit.first.isEmpty()) { - auto resultValues = fractureGridResultsForUnitSystem( - nameUnit.first, nameUnit.second, m_activeTimeStepIndex, fractureTemplateUnit()); - - if (wellCellIndex < resultValues.size()) + double widthInRequiredUnit = HUGE_VAL; { - widthInRequiredUnit = resultValues[wellCellIndex]; + auto resultValues = fractureGridResultsForUnitSystem( + nameUnit.first, nameUnit.second, m_activeTimeStepIndex, fractureTemplateUnit()); + + if (wellCellIndex < resultValues.size()) + { + widthInRequiredUnit = resultValues[wellCellIndex]; + } + } + + if (widthInRequiredUnit != HUGE_VAL && fabs(widthInRequiredUnit) > 1e-20) + { + values.m_width = widthInRequiredUnit; + values.m_permeability = RigTransmissibilityEquations::permeability(conductivity, widthInRequiredUnit); } } + } - if (widthInRequiredUnit != HUGE_VAL && fabs(widthInRequiredUnit) > 1e-20) + { + auto nameUnit = betaFactorParameterNameAndUnit(); + std::vector betaFactorResultValues = + m_stimPlanFractureDefinitionData->fractureGridResults(nameUnit.first, nameUnit.second, m_activeTimeStepIndex); + + if (wellCellIndex < betaFactorResultValues.size()) { - values.m_width = widthInRequiredUnit; - values.m_permeability = RigTransmissibilityEquations::permeability(conductivity, widthInRequiredUnit); + double nativeBetaValue = betaFactorResultValues[wellCellIndex]; + + double conversionFactorForBeta = conversionFactorForBetaValues(); + double betaFactorForcheimer = nativeBetaValue / conversionFactorForBeta; + + values.m_betaFactorInForcheimerUnits = betaFactorForcheimer; } } } @@ -668,6 +681,32 @@ bool RimStimPlanFractureTemplate::isBetaFactorAvailableOnFile() const return !nameAndUnit.first.isEmpty(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimStimPlanFractureTemplate::conversionFactorForBetaValues() const +{ + auto nameUnit = betaFactorParameterNameAndUnit(); + + double conversionFactorForBeta = 1.0; + + QString trimmedUnit = nameUnit.second.trimmed().toLower(); + if (trimmedUnit == "/m") + { + conversionFactorForBeta = 1.01325E+08; + } + else if (trimmedUnit == "/cm") + { + conversionFactorForBeta = 1.01325E+06; + } + else if (trimmedUnit == "/ft") + { + conversionFactorForBeta = 3.088386E+07; + } + + return conversionFactorForBeta; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index 7b2cbbb123..8584da8194 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -114,6 +114,8 @@ private: std::pair betaFactorParameterNameAndUnit() const; bool isBetaFactorAvailableOnFile() const override; + double conversionFactorForBetaValues() const; + private: caf::PdmField m_activeTimeStepIndex; caf::PdmField m_conductivityResultNameOnFile; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp index ba5bae45c6..d398f88cef 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp @@ -231,6 +231,7 @@ void RimWellPathCompletions::setUnitSystemSpecificDefaults() { m_fishbonesCollection->setUnitSystemSpecificDefaults(); m_fractureCollection->setUnitSystemSpecificDefaults(); + m_perforationCollection->setUnitSystemSpecificDefaults(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index f408e6ed2b..3eb2af41a9 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -481,12 +481,16 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicPasteSummaryCurveFeature"; menuBuilder << "RicPasteSummaryCrossPlotCurveFeature"; + menuBuilder << "Separator"; menuBuilder << "RicNewSummaryCurveFeature"; menuBuilder << "RicDuplicateSummaryCurveFeature"; menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; menuBuilder << "RicDuplicateSummaryCrossPlotCurveFeature"; menuBuilder << "Separator"; + menuBuilder << "RicSetSourceSteppingSummaryCurveFeature"; + menuBuilder << "RicClearSourceSteppingSummaryCurveFeature"; + menuBuilder << "Separator"; menuBuilder << "RicCopyReferencesToClipboardFeature"; menuBuilder << "Separator"; menuBuilder << "RicEditSummaryCurveCalculationFeature"; @@ -508,6 +512,9 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if (dynamic_cast(uiItem)) { menuBuilder << "RicNewSummaryEnsembleCurveSetFeature"; + menuBuilder << "Separator"; + menuBuilder << "RicSetSourceSteppingEnsembleCurveSetFeature"; + menuBuilder << "RicClearSourceSteppingEnsembleCurveSetFeature"; } else if (dynamic_cast(uiItem)) { diff --git a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp index 1f75f6ca5b..d7fa52466b 100644 --- a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp @@ -781,9 +781,13 @@ bool RimContourMapProjection::hasResultInCell(uint i, uint j) const //-------------------------------------------------------------------------------------------------- double RimContourMapProjection::calculateValueInCell(uint i, uint j) const { - if (!isColumnResult() && view()->cellResult()->scalarResultIndex() == cvf::UNDEFINED_SIZE_T) + if (!isColumnResult()) { - return 0.0; // Special case of NONE-result. Show 0 all over to ensure we see something. + if (!view()->cellResult()->isFlowDiagOrInjectionFlooding() && + view()->cellResult()->scalarResultIndex() == cvf::UNDEFINED_SIZE_T) + { + return 0.0; // Special case of NONE-result. Show 0 all over to ensure we see something. + } } const std::vector>& matchingCells = cellsAtIJ(i, j); if (!matchingCells.empty()) diff --git a/ApplicationCode/ProjectDataModel/RimContourMapView.cpp b/ApplicationCode/ProjectDataModel/RimContourMapView.cpp index f89151e80d..db7fbc9101 100644 --- a/ApplicationCode/ProjectDataModel/RimContourMapView.cpp +++ b/ApplicationCode/ProjectDataModel/RimContourMapView.cpp @@ -214,10 +214,7 @@ void RimContourMapView::updateGeometry() appendPickPointVisToModel(); - if (m_overlayInfoConfig->isActive()) - { - m_overlayInfoConfig()->update3DInfo(); - } + m_overlayInfoConfig()->update3DInfo(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 6c46324d5b..9319263aca 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -384,7 +384,7 @@ const RigVirtualPerforationTransmissibilities* RimEclipseCase::computeAndGetVirt { for (const auto& r : wellResultBranch.m_branchResultPoints) { - if (r.isValid()) + if (r.isCell()) { RigCompletionData compData( wellRes->m_wellName, diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 936aa73dbe..54f7b8feeb 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -49,6 +49,7 @@ #include "cafPdmUiTreeSelectionEditor.h" #include "cafUtils.h" +#include #include namespace caf @@ -861,6 +862,11 @@ bool RimEclipseResultDefinition::hasDynamicResult() const //-------------------------------------------------------------------------------------------------- void RimEclipseResultDefinition::initAfterRead() { + if (m_flowSolution() == nullptr) + { + assignFlowSolutionFromCase(); + } + m_porosityModelUiField = m_porosityModel; m_resultTypeUiField = m_resultType; m_resultVariableUiField = m_resultVariable; @@ -868,42 +874,6 @@ void RimEclipseResultDefinition::initAfterRead() m_flowSolutionUiField = m_flowSolution(); m_selectedInjectorTracersUiField = m_selectedInjectorTracers; - if (m_flowSolution() == nullptr) - { - assignFlowSolutionFromCase(); - } - - if (m_flowSolution()) - { - std::vector selectedInjectorTracers; - std::vector selectedProducerTracers; - for (const QString& tracerName : m_selectedTracers_OBSOLETE()) - { - RimFlowDiagSolution::TracerStatusType tracerStatus = m_flowSolution()->tracerStatusOverall(tracerName); - if (tracerStatus == RimFlowDiagSolution::INJECTOR) - { - selectedInjectorTracers.push_back(tracerName); - } - else if (tracerStatus == RimFlowDiagSolution::PRODUCER) - { - selectedProducerTracers.push_back(tracerName); - } - else if (tracerStatus == RimFlowDiagSolution::VARYING || tracerStatus == RimFlowDiagSolution::UNDEFINED) - { - selectedInjectorTracers.push_back(tracerName); - selectedProducerTracers.push_back(tracerName); - } - } - if (!selectedInjectorTracers.empty()) - { - setSelectedInjectorTracers(selectedInjectorTracers); - } - if (!selectedProducerTracers.empty()) - { - setSelectedProducerTracers(selectedProducerTracers); - } - } - this->updateUiIconFromToggleField(); } @@ -1159,6 +1129,43 @@ void RimEclipseResultDefinition::defineEditorAttribute(const caf::PdmFieldHandle } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultDefinition::onEditorWidgetsCreated() +{ + if (m_flowSolution() && !m_selectedTracers_OBSOLETE().empty()) + { + std::vector selectedTracers; + selectedTracers.swap(m_selectedTracers_OBSOLETE.v()); + + std::set allInjectorTracers = setOfTracersOfType(true); + std::set allProducerTracers = setOfTracersOfType(false); + + std::vector selectedInjectorTracers; + std::vector selectedProducerTracers; + for (const QString& tracerName : selectedTracers) + { + if (allInjectorTracers.count(tracerName)) + { + selectedInjectorTracers.push_back(tracerName); + } + if (allProducerTracers.count(tracerName)) + { + selectedProducerTracers.push_back(tracerName); + } + } + if (!selectedInjectorTracers.empty()) + { + setSelectedInjectorTracers(selectedInjectorTracers); + } + if (!selectedProducerTracers.empty()) + { + setSelectedProducerTracers(selectedProducerTracers); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index 1d7c7279d7..b84c8c371d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -115,7 +115,7 @@ public: void updateUiFieldsFromActiveResult(); protected: - virtual void updateLegendCategorySettings() {}; + virtual void updateLegendCategorySettings() {}; QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; @@ -123,6 +123,7 @@ protected: void initAfterRead() override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; + void onEditorWidgetsCreated() override; protected: caf::PdmField< caf::AppEnum< RiaDefines::ResultCatType > > m_resultType; @@ -174,6 +175,7 @@ private: QList calcOptionsForVariableUiFieldStandard(); QList calcOptionsForSelectedTracerField(bool injector); + QString timeOfFlightString(bool shorter) const; QString maxFractionTracerString(bool shorter) const; diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp index 5c64efa587..5feb88ef8a 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.cpp @@ -218,19 +218,7 @@ void RimPlotCurve::setCustomName(const QString& customName) //-------------------------------------------------------------------------------------------------- void RimPlotCurve::updateCurveVisibility(bool updateParentPlot) { - bool isVisibleInPossibleParent = true; - - { - RimSummaryCurveCollection* summaryCurveCollection = nullptr; - this->firstAncestorOrThisOfType(summaryCurveCollection); - if (summaryCurveCollection) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible(); - - RimEnsembleCurveSet* ensembleCurveSet = nullptr; - firstAncestorOrThisOfType(ensembleCurveSet); - if (ensembleCurveSet) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible(); - } - - if (m_showCurve() && m_parentQwtPlot && isVisibleInPossibleParent) + if (canCurveBeAttached()) { m_qwtPlotCurve->attach(m_parentQwtPlot); } @@ -282,7 +270,7 @@ void RimPlotCurve::updateCurvePresentation(bool updatePlotLegendAndTitle) void RimPlotCurve::setParentQwtPlotAndReplot(QwtPlot* plot) { m_parentQwtPlot = plot; - if (m_showCurve && m_parentQwtPlot) + if (canCurveBeAttached()) { m_qwtPlotCurve->attach(m_parentQwtPlot); m_parentQwtPlot->replot(); @@ -295,7 +283,7 @@ void RimPlotCurve::setParentQwtPlotAndReplot(QwtPlot* plot) void RimPlotCurve::setParentQwtPlotNoReplot(QwtPlot* plot) { m_parentQwtPlot = plot; - if (m_showCurve && m_parentQwtPlot) + if (canCurveBeAttached()) { m_qwtPlotCurve->attach(m_parentQwtPlot); } @@ -331,7 +319,7 @@ void RimPlotCurve::detachQwtCurve() void RimPlotCurve::reattachQwtCurve() { detachQwtCurve(); - if (m_parentQwtPlot && m_showCurve) + if (canCurveBeAttached()) { m_qwtPlotCurve->attach(m_parentQwtPlot); } @@ -454,6 +442,36 @@ void RimPlotCurve::curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering) uiOrdering.add(&m_curveName); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotCurve::canCurveBeAttached() const +{ + if (!m_parentQwtPlot) + { + return false; + } + + if (!m_showCurve()) + { + return false; + } + + bool isVisibleInPossibleParent = true; + + { + RimSummaryCurveCollection* summaryCurveCollection = nullptr; + this->firstAncestorOrThisOfType(summaryCurveCollection); + if (summaryCurveCollection) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible(); + + RimEnsembleCurveSet* ensembleCurveSet = nullptr; + firstAncestorOrThisOfType(ensembleCurveSet); + if (ensembleCurveSet) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible(); + } + + return isVisibleInPossibleParent; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimPlotCurve.h b/ApplicationCode/ProjectDataModel/RimPlotCurve.h index 8150d873b1..51bf266ada 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimPlotCurve.h @@ -109,6 +109,9 @@ protected: void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering); void curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering); +private: + bool canCurveBeAttached() const; + protected: QPointer m_parentQwtPlot; RiuQwtPlotCurve* m_qwtPlotCurve; diff --git a/ApplicationCode/ProjectDataModel/RimSimWellInView.cpp b/ApplicationCode/ProjectDataModel/RimSimWellInView.cpp index fb89640b24..fad3f8b63a 100644 --- a/ApplicationCode/ProjectDataModel/RimSimWellInView.cpp +++ b/ApplicationCode/ProjectDataModel/RimSimWellInView.cpp @@ -174,11 +174,14 @@ std::vector RimSimWellInView::wellPipeBranches() const this->firstAncestorOrThisOfTypeAsserted(eclipseCase); RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData(); CVF_ASSERT(caseData); + if (caseData) + { + bool includeCellCenters = this->isUsingCellCenterForPipe(); + bool detectBrances = simWellCollection->isAutoDetectingBranches; - bool includeCellCenters = this->isUsingCellCenterForPipe(); - bool detectBrances = simWellCollection->isAutoDetectingBranches; - - return caseData->simulationWellBranches(this->name(), includeCellCenters, detectBrances); + return caseData->simulationWellBranches(this->name(), includeCellCenters, detectBrances); + } + return std::vector(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp b/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp index eeeb6ce0a8..ff6c5d8695 100644 --- a/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp +++ b/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp @@ -74,6 +74,7 @@ RimTimeStepFilter::RimTimeStepFilter() m_interval.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName()); CAF_PDM_InitField(&m_timeStepNamesFromFile, "TimeStepsFromFile", std::vector(), "TimeSteps From File", "", "", ""); + m_timeStepNamesFromFile.xmlCapability()->disableIO(); CAF_PDM_InitField(&m_dateFormat, "DateFormat", QString("yyyy-MM-dd"), "Date Format", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_filteredTimeSteps, "TimeStepIndicesToImport", "Select From Time Steps", "", "", ""); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 4cb05f2da7..9b9c41119a 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -660,6 +660,25 @@ void RimEnsembleCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrd } uiTreeOrdering.skipRemainingChildren(true); + + // Reset dynamic icon + this->setUiIcon(QIcon()); + // Get static one + QIcon icon = this->uiIcon(); + + RimEnsembleCurveSetCollection* coll = nullptr; + this->firstAncestorOrThisOfType(coll); + if (coll && coll->curveSetForSourceStepping() == this) + { + QPixmap combined = icon.pixmap(16, 16); + QPainter painter(&combined); + QPixmap updownpixmap(":/StepUpDownCorner16x16.png"); + painter.drawPixmap(0,0,updownpixmap); + + icon = QIcon(combined); + } + + this->setUiIcon(icon); } //-------------------------------------------------------------------------------------------------- @@ -1028,7 +1047,6 @@ void RimEnsembleCurveSet::updateStatisticsCurves(const std::vectorsetSummaryCaseY(m_ensembleStatCase.get()); curve->setSummaryAddressY(address); curve->setLeftOrRightAxisY(m_plotAxis()); - curve->setZOrder(1000); curve->updateCurveVisibility(false); curve->loadDataAndUpdate(false); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 31e76d9ea6..0a02f51d9c 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" #include "RiaColorTables.h" +#include "RiaStdStringTools.h" #include "RifReaderEclipseSummary.h" @@ -50,6 +51,13 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() CAF_PDM_InitField(&m_showCurves, "IsActive", true, "Show Curves", "", "", ""); m_showCurves.uiCapability()->setUiHidden(true); + + CAF_PDM_InitFieldNoDefault(&m_ySourceStepping, "YSourceStepping", "", "", "", ""); + m_ySourceStepping = new RimSummaryPlotSourceStepping; + m_ySourceStepping->setSourceSteppingType(RimSummaryPlotSourceStepping::Y_AXIS); + m_ySourceStepping.uiCapability()->setUiHidden(true); + m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden(true); + m_ySourceStepping.xmlCapability()->disableIO(); } //-------------------------------------------------------------------------------------------------- @@ -193,6 +201,80 @@ size_t RimEnsembleCurveSetCollection::curveSetCount() const return m_curveSets.size(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimEnsembleCurveSetCollection::fieldsToShowInToolbar() +{ + if (m_ySourceStepping) + { + return m_ySourceStepping->fieldsToShowInToolbar(); + } + + return std::vector(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleCurveSetCollection::setCurveSetForSourceStepping(RimEnsembleCurveSet* curveSet) +{ + m_curveSetForSourceStepping = curveSet; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEnsembleCurveSet* RimEnsembleCurveSetCollection::curveSetForSourceStepping() const +{ + return m_curveSetForSourceStepping; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimEnsembleCurveSetCollection::curveSetsForSourceStepping() const +{ + std::vector steppingCurveSets; + + if (m_curveSetForSourceStepping) + { + steppingCurveSets.push_back(m_curveSetForSourceStepping); + + { + // Add corresponding history/summary curve with or without H + + const std::string historyIdentifier = "H"; + + std::string quantity = m_curveSetForSourceStepping->summaryAddress().quantityName(); + + std::string candidateName; + if (RiaStdStringTools::endsWith(quantity, historyIdentifier)) + { + candidateName = quantity.substr(0, quantity.size() - 1); + } + else + { + candidateName = quantity + historyIdentifier; + } + + for (const auto& c : curveSets()) + { + if (c->summaryAddress().quantityName() == candidateName) + { + steppingCurveSets.push_back(c); + } + } + } + } + else + { + steppingCurveSets = curveSets(); + } + + return steppingCurveSets; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -228,6 +310,16 @@ void RimEnsembleCurveSetCollection::fieldChangedByUi(const caf::PdmFieldHandle* } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleCurveSetCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + auto group = uiOrdering.addNewGroup("Data Source"); + + m_ySourceStepping()->uiOrdering(uiConfigName, *group); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h index db962437a0..faffca881c 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h @@ -25,6 +25,8 @@ #include "cafPdmObject.h" class RimEnsembleCurveSet; +class RimSummaryPlotSourceStepping; +class RimSummaryCurve; class QwtPlot; class QwtPlotCurve; @@ -55,9 +57,16 @@ public: std::vector curveSets() const; size_t curveSetCount() const; + void deleteAllCurveSets(); void setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet); + + // Functions related to source stepping + std::vector fieldsToShowInToolbar(); + void setCurveSetForSourceStepping(RimEnsembleCurveSet* curve); + RimEnsembleCurveSet* curveSetForSourceStepping() const; + std::vector curveSetsForSourceStepping() const; private: caf::PdmFieldHandle* objectToggleField() override; @@ -65,10 +74,15 @@ private: void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + private: caf::PdmField m_showCurves; caf::PdmChildArrayField m_curveSets; + caf::PdmChildField m_ySourceStepping; + caf::PdmPointer m_currentEnsembleCurveSet; + caf::PdmPointer m_curveSetForSourceStepping; }; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index 2e86872f69..7165de359d 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -147,6 +147,8 @@ void RimEnsembleStatisticsCase::calculate(const std::vector sum std::vector values; reader->values(inputAddress, &values); + if (timeSteps.size() != values.size()) continue; + RiaTimeHistoryCurveResampler resampler; resampler.setCurveData(values, timeSteps); if (inputAddress.hasAccumulatedData()) resampler.resampleAndComputePeriodEndValues(DateTimePeriod::DAY); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 3f06e82ace..d513634176 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -142,6 +142,9 @@ RimSummaryCurve::RimSummaryCurve() m_curveNameConfig = new RimSummaryCurveAutoName; + CAF_PDM_InitField(&m_isTopZWithinCategory, "isTopZWithinCategory", false, "", "", "", ""); + m_isTopZWithinCategory.uiCapability()->setUiHidden(true); + m_symbolSkipPixelDistance = 10.0f; m_curveThickness = 2; } @@ -450,6 +453,8 @@ void RimSummaryCurve::onLoadDataAndUpdate(bool updateParentPlot) updateConnectedEditors(); + setZIndexFromCurveInfo(); + if (isCurveVisible()) { std::vector curveValuesY = this->valuesY(); @@ -560,6 +565,33 @@ void RimSummaryCurve::updateLegendsInPlot() plot->updateAllLegendItems(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) +{ + RimPlotCurve::defineUiTreeOrdering(uiTreeOrdering, uiConfigName); + + // Reset dynamic icon + this->setUiIcon(QIcon()); + // Get static one + QIcon icon = this->uiIcon(); + + RimSummaryCurveCollection* coll = nullptr; + this->firstAncestorOrThisOfType(coll); + if (coll && coll->curveForSourceStepping() == this) + { + QPixmap combined = icon.pixmap(16, 16); + QPainter painter(&combined); + QPixmap updownpixmap(":/StepUpDownCorner16x16.png"); + painter.drawPixmap(0,0,updownpixmap); + + icon = QIcon(combined); + } + + this->setUiIcon(icon); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -660,6 +692,44 @@ void RimSummaryCurve::appendOptionItemsForSummaryAddresses(QListisObservedData()) + { + zOrder = RiuQwtPlotCurve::Z_SINGLE_CURVE_OBSERVED; + } + else if (sumAddr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS) + { + zOrder = RiuQwtPlotCurve::Z_ENSEMBLE_STAT_CURVE; + } + else if (sumCase->ensemble()) + { + zOrder = RiuQwtPlotCurve::Z_ENSEMBLE_CURVE; + } + else + { + zOrder = RiuQwtPlotCurve::Z_SINGLE_CURVE_NON_OBSERVED; + } + } + + if (m_isTopZWithinCategory) + { + zOrder += 1.0; + } + + setZOrder(zOrder); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -747,6 +817,14 @@ void RimSummaryCurve::markCachedDataForPurge() if(reader) reader->markForCachePurge(m_yValuesCurveVariable->address()); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurve::setAsTopZWithinCategory(bool enable) +{ + m_isTopZWithinCategory = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -785,6 +863,11 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow(); mainPlotWindow->updateSummaryPlotToolBar(); + + if (m_showCurve() == true) + { + plot->summaryCurveCollection()->setCurveAsTopZWithinCategory(this); + } } else if (changedField == &m_plotAxis) { diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h index 7ae8d0ea0a..f5553f5fc3 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -80,6 +80,9 @@ public: void forceUpdateCurveAppearanceFromCaseType(); void markCachedDataForPurge(); + + void setAsTopZWithinCategory(bool enable); + void setZIndexFromCurveInfo(); protected: // RimPlotCurve overrides @@ -90,6 +93,9 @@ protected: void updateLegendsInPlot() override; + + void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; + private: RifSummaryReaderInterface* valuesSummaryReaderX() const; RifSummaryReaderInterface* valuesSummaryReaderY() const; @@ -126,4 +132,5 @@ private: caf::PdmChildField m_curveNameConfig; caf::PdmField> m_plotAxis; + caf::PdmField m_isTopZWithinCategory; }; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index c218bb1159..2df7fd9040 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -19,6 +19,7 @@ #include "RimSummaryCurveCollection.h" #include "RiaApplication.h" +#include "RiaStdStringTools.h" #include "RifReaderEclipseSummary.h" @@ -192,6 +193,72 @@ std::vector RimSummaryCurveCollection::curves() const return m_curves.childObjects(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryCurveCollection::curvesForSourceStepping(RimSummaryPlotSourceStepping::SourceSteppingType steppingType) const +{ + std::vector stepCurves; + + if (m_curveForSourceStepping) + { + stepCurves.push_back(m_curveForSourceStepping); + + { + // Add corresponding history/summary curve with or without H + + const std::string historyIdentifier = "H"; + + std::string quantity; + + if (steppingType == RimSummaryPlotSourceStepping::X_AXIS) + { + quantity = m_curveForSourceStepping->summaryAddressX().quantityName(); + } + else if (steppingType == RimSummaryPlotSourceStepping::Y_AXIS) + { + quantity = m_curveForSourceStepping->summaryAddressY().quantityName(); + } + + std::string candidateName; + if (RiaStdStringTools::endsWith(quantity, historyIdentifier)) + { + candidateName = quantity.substr(0, quantity.size() - 1); + } + else + { + candidateName = quantity + historyIdentifier; + } + + for (const auto& c : curves()) + { + if (steppingType == RimSummaryPlotSourceStepping::X_AXIS) + { + if (c->summaryCaseX() == m_curveForSourceStepping->summaryCaseX() && + c->summaryAddressX().quantityName() == candidateName) + { + stepCurves.push_back(c); + } + } + else if (steppingType == RimSummaryPlotSourceStepping::Y_AXIS) + { + if (c->summaryCaseY() == m_curveForSourceStepping->summaryCaseY() && + c->summaryAddressY().quantityName() == candidateName) + { + stepCurves.push_back(c); + } + } + } + } + } + else + { + stepCurves = curves(); + } + + return stepCurves; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -335,6 +402,42 @@ void RimSummaryCurveCollection::handleKeyPressEvent(QKeyEvent* keyEvent) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurveCollection::setCurveAsTopZWithinCategory(RimSummaryCurve* curve) +{ + for (const auto& c : m_curves) + { + if (c == curve) + { + c->setAsTopZWithinCategory(true); + } + else + { + c->setAsTopZWithinCategory(false); + } + + c->setZIndexFromCurveInfo(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurveCollection::setCurveForSourceStepping(RimSummaryCurve* curve) +{ + m_curveForSourceStepping = curve; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurve* RimSummaryCurveCollection::curveForSourceStepping() const +{ + return m_curveForSourceStepping; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index 66539de4be..26b908f8d1 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -19,6 +19,8 @@ #pragma once +#include "RimSummaryPlotSourceStepping.h" + #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" @@ -29,7 +31,6 @@ class QwtPlot; class QwtPlotCurve; class RimSummaryCase; class RimSummaryCurve; -class RimSummaryPlotSourceStepping; class QKeyEvent; //================================================================================================== @@ -56,6 +57,7 @@ public: void deleteCurve(RimSummaryCurve* curve); std::vector curves() const; + std::vector curvesForSourceStepping(RimSummaryPlotSourceStepping::SourceSteppingType steppingType) const; void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase); void deleteAllCurves(); @@ -67,6 +69,11 @@ public: void handleKeyPressEvent(QKeyEvent* keyEvent); + void setCurveAsTopZWithinCategory(RimSummaryCurve* curve); + + void setCurveForSourceStepping(RimSummaryCurve* curve); + RimSummaryCurve* curveForSourceStepping() const; + private: caf::PdmFieldHandle* objectToggleField() override; void defineObjectEditorAttribute(QString uiConfigName, @@ -86,5 +93,6 @@ private: caf::PdmChildField m_unionSourceStepping; caf::PdmPointer m_currentSummaryCurve; + caf::PdmPointer m_curveForSourceStepping; }; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 8908b83320..360fa4a08e 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -549,6 +549,22 @@ bool RimSummaryPlot::containsResamplableCurves() const return !m_gridTimeHistoryCurves.empty() || resamplableSummaryCurveCount > 0; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RimSummaryPlot::singleColorCurveCount() const +{ + auto allCurveSets = ensembleCurveSetCollection()->curveSets(); + size_t colorIndex = std::count_if(allCurveSets.begin(), allCurveSets.end(), [](RimEnsembleCurveSet* curveSet) + { + return curveSet->colorMode() == RimEnsembleCurveSet::SINGLE_COLOR; + }); + + colorIndex += curveCount(); + + return colorIndex; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1000,6 +1016,10 @@ void RimSummaryPlot::deleteCurves(const std::vector& curves) } } } + + + RiuPlotMainWindowTools::refreshToolbars(); + updateCaseNameHasChanged(); } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h index 3b76f856a5..7af9067aaa 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -132,6 +132,8 @@ public: void updatePlotInfoLabel(); bool containsResamplableCurves() const; + + size_t singleColorCurveCount() const; // RimViewWindow overrides public: QWidget* createViewWidget(QWidget* mainWindowParent) override; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 8e83d82db3..f3fd72eea5 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -25,6 +25,8 @@ #include "RifSummaryReaderInterface.h" #include "RimDataSourceSteppingTools.h" +#include "RimEnsembleCurveSet.h" +#include "RimEnsembleCurveSetCollection.h" #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" @@ -35,6 +37,7 @@ #include "RiuPlotMainWindow.h" +#include "RiaStdStringTools.h" #include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiItem.h" #include "cafPdmUiListEditor.h" @@ -51,11 +54,22 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() CAF_PDM_InitObject("Summary Curves Modifier", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_summaryCase, "CurveCase", "Case", "", "", ""); + + CAF_PDM_InitField(&m_includeEnsembleCasesForCaseStepping, + "IncludeEnsembleCasesForCaseStepping", + false, + "Allow Stepping on Ensemble cases", + "", + "", + ""); + CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "GroupName", "Group Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_quantity, "Quantities", "Quantity", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_ensemble, "Ensemble", "Ensemble", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_placeholderForLabel, "Placeholder", "", "", "", ""); m_placeholderForLabel = "No common identifiers detected"; m_placeholderForLabel.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); @@ -88,6 +102,22 @@ void RimSummaryPlotSourceStepping::applyPrevCase() modifyCurrentIndex(&m_summaryCase, -1); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotSourceStepping::applyNextEnsemble() +{ + modifyCurrentIndex(&m_ensemble, 1); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotSourceStepping::applyPrevEnsemble() +{ + modifyCurrentIndex(&m_ensemble, -1); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -162,82 +192,159 @@ void RimSummaryPlotSourceStepping::defineUiOrdering(QString uiConfigName, caf::P QList RimSummaryPlotSourceStepping::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { - if (fieldNeedingOptions == &m_placeholderForLabel) + QList options; + + if (fieldNeedingOptions == &m_includeEnsembleCasesForCaseStepping) { - return QList(); + return caf::PdmObject::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); } - - if (fieldNeedingOptions == &m_summaryCase) + else if (fieldNeedingOptions == &m_placeholderForLabel) { - QList options; - - RimProject* proj = RiaApplication::instance()->project(); - for (auto sumCase : proj->allSummaryCases()) + options; + } + else if (fieldNeedingOptions == &m_summaryCase) + { + auto summaryCases = RimSummaryPlotSourceStepping::summaryCasesForSourceStepping(); + for (auto sumCase : summaryCases) { options.append(caf::PdmOptionItemInfo(sumCase->caseName(), sumCase)); } return options; } + else if (fieldNeedingOptions == &m_ensemble) + { + RimProject* proj = RiaApplication::instance()->project(); + for (auto ensemble : proj->summaryGroups()) + { + if (ensemble->isEnsemble()) + { + options.append(caf::PdmOptionItemInfo(ensemble->name(), ensemble)); + } + } - std::vector identifierTexts; + return options; + } std::vector readers = summaryReadersForCurves(); if (!readers.empty()) { - RiaSummaryCurveAnalyzer* analyzer = analyzerForReader(readers.front()); - - if (fieldNeedingOptions == &m_wellName) + if (fieldNeedingOptions == &m_quantity) { - identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL); - } - else if (fieldNeedingOptions == &m_region) - { - identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION); - } - else if (fieldNeedingOptions == &m_wellGroupName) - { - identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP); - } - else if (fieldNeedingOptions == &m_quantity) - { - RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfTypeAsserted(curveCollection); - RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD; - if (curveCollection->curves().size() > 0) + auto addresses = addressesCurveCollection(); + if (!addresses.empty()) { - category = curveCollection->curves()[0]->summaryAddressY().category(); + category = addresses.begin()->category(); } - RiaSummaryCurveAnalyzer quantityAnalyzer; + std::map displayAndValueStrings; - for (auto reader : readers) { - auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category); - quantityAnalyzer.appendAdresses(subset); + RiaSummaryCurveAnalyzer quantityAnalyzer; + + for (auto reader : readers) + { + if (reader != nullptr) + { + auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category); + quantityAnalyzer.appendAdresses(subset); + } + } + + RiaSummaryCurveAnalyzer analyzerForCurves; + analyzerForCurves.appendAdresses(addressesCurveCollection()); + + if (analyzerForCurves.quantityNamesWithHistory().empty()) + { + auto quantities = quantityAnalyzer.quantities(); + for (const auto& s : quantities) + { + QString valueString = QString::fromStdString(s); + + displayAndValueStrings[valueString] = valueString; + } + } + else + { + auto quantitiesWithHistory = quantityAnalyzer.quantityNamesWithHistory(); + for (const auto& s : quantitiesWithHistory) + { + QString valueString = QString::fromStdString(s); + QString displayString = valueString + " (H)"; + + displayAndValueStrings[displayString] = valueString; + } + + auto quantitiesNoHistory = quantityAnalyzer.quantityNamesNoHistory(); + for (const auto& s : quantitiesNoHistory) + { + QString valueString = QString::fromStdString(s); + + displayAndValueStrings[valueString] = valueString; + } + } } - for (const auto& quantity : quantityAnalyzer.quantities()) + for (const auto& displayAndValue : displayAndValueStrings) { - identifierTexts.push_back(QString::fromStdString(quantity)); + options.append(caf::PdmOptionItemInfo(displayAndValue.first, displayAndValue.second)); + } + + if (options.isEmpty()) + { + options.push_back(caf::PdmOptionItemInfo("None", "None")); } } - } - - QList options; - if (identifierTexts.size() > 0) - { - for (const auto& text : identifierTexts) + else { - options.append(caf::PdmOptionItemInfo(text, text)); + RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID; + + if (fieldNeedingOptions == &m_wellName) + { + category = RifEclipseSummaryAddress::SUMMARY_WELL; + } + else if (fieldNeedingOptions == &m_region) + { + category = RifEclipseSummaryAddress::SUMMARY_REGION; + } + else if (fieldNeedingOptions == &m_wellGroupName) + { + category = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP; + } + + std::set identifierTexts; + + if (category != RifEclipseSummaryAddress::SUMMARY_INVALID) + { + for (auto reader : readers) + { + auto analyzer = analyzerForReader(reader); + + if (analyzer) + { + for (const auto& t : analyzer->identifierTexts(category)) + { + identifierTexts.insert(t); + } + } + } + } + + if (!identifierTexts.empty()) + { + for (const auto& text : identifierTexts) + { + options.append(caf::PdmOptionItemInfo(text, text)); + } + } + else + { + options.push_back(caf::PdmOptionItemInfo("None", "None")); + } } } - else - { - options.push_back(caf::PdmOptionItemInfo("None", "None")); - } return options; } @@ -249,27 +356,90 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c const QVariant& oldValue, const QVariant& newValue) { + std::vector curves; + RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfTypeAsserted(curveCollection); + this->firstAncestorOrThisOfType(curveCollection); + if (curveCollection) + { + curves = curveCollection->curves(); + } + + RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr; + this->firstAncestorOrThisOfType(ensembleCurveColl); + + if (changedField == &m_includeEnsembleCasesForCaseStepping) + { + if (curveCollection) + { + curveCollection->updateConnectedEditors(); + } + + if (ensembleCurveColl) + { + ensembleCurveColl->updateConnectedEditors(); + } + + RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow(); + bool forceUpdateOfFieldsInToolbar = true; + mainPlotWindow->updateSummaryPlotToolBar(forceUpdateOfFieldsInToolbar); + + return; + } bool triggerLoadDataAndUpdate = false; + std::string oldValueString = oldValue.toString().toStdString(); + std::string newValueString = newValue.toString().toStdString(); + if (changedField == &m_summaryCase) { if (m_summaryCase()) { - for (auto curve : curveCollection->curves()) + caf::PdmPointer variantHandle = oldValue.value>(); + RimSummaryCase* previousCase = dynamic_cast(variantHandle.p()); + + for (auto curve : curves) { if (isYAxisStepping()) { - bool doSetAppearance = curve->summaryCaseY()->isObservedData() != m_summaryCase->isObservedData(); - curve->setSummaryCaseY(m_summaryCase); - if (doSetAppearance) curve->forceUpdateCurveAppearanceFromCaseType(); + if (previousCase == curve->summaryCaseY()) + { + bool doSetAppearance = curve->summaryCaseY()->isObservedData() != m_summaryCase->isObservedData(); + curve->setSummaryCaseY(m_summaryCase); + if (doSetAppearance) curve->forceUpdateCurveAppearanceFromCaseType(); + } } if (isXAxisStepping()) { - curve->setSummaryCaseX(m_summaryCase); + if (previousCase == curve->summaryCaseX()) + { + curve->setSummaryCaseX(m_summaryCase); + } + } + } + + triggerLoadDataAndUpdate = true; + } + + m_wellName.uiCapability()->updateConnectedEditors(); + m_wellGroupName.uiCapability()->updateConnectedEditors(); + m_region.uiCapability()->updateConnectedEditors(); + m_quantity.uiCapability()->updateConnectedEditors(); + } + else if (changedField == &m_ensemble) + { + if (m_ensemble() && ensembleCurveColl) + { + caf::PdmPointer variantHandle = oldValue.value>(); + RimSummaryCaseCollection* previousCollection = dynamic_cast(variantHandle.p()); + + for (auto curveSet : ensembleCurveColl->curveSets()) + { + if (curveSet->summaryCaseCollection() == previousCollection) + { + curveSet->setSummaryCaseCollection(m_ensemble); } } @@ -283,28 +453,30 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c } else if (changedField == &m_wellName) { - for (auto curve : curveCollection->curves()) + for (auto curve : curves) { if (isYAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressY(); - if (RifEclipseSummaryAddress::isDependentOnWellName(adr)) - { - adr.setWellName(m_wellName().toStdString()); - - curve->setSummaryAddressY(adr); - } + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL, &adr); + curve->setSummaryAddressY(adr); } if (isXAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressX(); - if (RifEclipseSummaryAddress::isDependentOnWellName(adr)) - { - adr.setWellName(m_wellName().toStdString()); + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL, &adr); + curve->setSummaryAddressX(adr); + } + } - curve->setSummaryAddressX(adr); - } + if (ensembleCurveColl) + { + for (auto curveSet : ensembleCurveColl->curveSets()) + { + auto adr = curveSet->summaryAddress(); + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL, &adr); + curveSet->setSummaryAddress(adr); } } @@ -312,28 +484,30 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c } else if (changedField == &m_region) { - for (auto curve : curveCollection->curves()) + for (auto curve : curves) { if (isYAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressY(); - if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION) - { - adr.setRegion(m_region()); - - curve->setSummaryAddressY(adr); - } + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_REGION, &adr); + curve->setSummaryAddressY(adr); } if (isXAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressX(); - if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION) - { - adr.setRegion(m_region()); + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_REGION, &adr); + curve->setSummaryAddressX(adr); + } + } - curve->setSummaryAddressX(adr); - } + if (ensembleCurveColl) + { + for (auto curveSet : ensembleCurveColl->curveSets()) + { + auto adr = curveSet->summaryAddress(); + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_REGION, &adr); + curveSet->setSummaryAddress(adr); } } @@ -341,51 +515,61 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c } else if (changedField == &m_quantity) { - for (auto curve : curveCollection->curves()) + for (auto curve : curves) { if (isYAxisStepping()) { - RifEclipseSummaryAddress adr = curve->summaryAddressY(); - adr.setQuantityName(m_quantity().toStdString()); - + auto adr = curve->summaryAddressY(); + updateHistoryAndSummaryQuantityIfMatching(oldValue, newValue, &adr); curve->setSummaryAddressY(adr); } if (isXAxisStepping()) { - RifEclipseSummaryAddress adr = curve->summaryAddressX(); - adr.setQuantityName(m_quantity().toStdString()); - + auto adr = curve->summaryAddressX(); + updateHistoryAndSummaryQuantityIfMatching(oldValue, newValue, &adr); curve->setSummaryAddressX(adr); } } + if (ensembleCurveColl) + { + for (auto curveSet : ensembleCurveColl->curveSets()) + { + auto adr = curveSet->summaryAddress(); + updateHistoryAndSummaryQuantityIfMatching(oldValue, newValue, &adr); + curveSet->setSummaryAddress(adr); + } + } + triggerLoadDataAndUpdate = true; } else if (changedField == &m_wellGroupName) { - for (auto curve : curveCollection->curves()) + for (auto curve : curves) { if (isYAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressY(); - if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP) - { - adr.setWellGroupName(m_wellGroupName().toStdString()); - - curve->setSummaryAddressY(adr); - } + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, &adr); + curve->setSummaryAddressY(adr); } if (isXAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressX(); - if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP) - { - adr.setWellGroupName(m_wellGroupName().toStdString()); + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, &adr); + curve->setSummaryAddressX(adr); + } + } - curve->setSummaryAddressX(adr); - } + if (ensembleCurveColl) + { + for (auto curveSet : ensembleCurveColl->curveSets()) + { + auto adr = curveSet->summaryAddress(); + updateAddressIfMatching(oldValue, newValue, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, &adr); + curveSet->setSummaryAddress(adr); } } @@ -400,12 +584,20 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c summaryPlot->updatePlotTitle(); summaryPlot->loadDataAndUpdate(); + if (ensembleCurveColl) + { + ensembleCurveColl->updateConnectedEditors(); + } + RimSummaryCrossPlot* summaryCrossPlot = dynamic_cast(summaryPlot); if (summaryCrossPlot) { // Trigger update of curve collection (and summary toolbar in main window), as the visibility of combo boxes might // have been changed due to the updates in this function - curveCollection->updateConnectedEditors(); + if (curveCollection) + { + curveCollection->updateConnectedEditors(); + } RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow(); mainPlotWindow->updateSummaryPlotToolBar(); @@ -420,18 +612,38 @@ std::vector RimSummaryPlotSourceStepping::summaryRea { std::vector readers; RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfTypeAsserted(curveCollection); + this->firstAncestorOrThisOfType(curveCollection); - for (auto curve : curveCollection->curves()) + if (curveCollection) { - if (isYAxisStepping() && curve->summaryCaseY()) + for (auto curve : curveCollection->curves()) { - readers.push_back(curve->summaryCaseY()->summaryReader()); - } + if (isYAxisStepping() && curve->summaryCaseY()) + { + readers.push_back(curve->summaryCaseY()->summaryReader()); + } - if (isXAxisStepping() && curve->summaryCaseX()) + if (isXAxisStepping() && curve->summaryCaseX()) + { + readers.push_back(curve->summaryCaseX()->summaryReader()); + } + } + } + + RimEnsembleCurveSetCollection* ensembleCollection = nullptr; + this->firstAncestorOrThisOfType(ensembleCollection); + if (ensembleCollection) + { + auto curveSets = ensembleCollection->curveSets(); + for (const RimEnsembleCurveSet* curveSet : curveSets) { - readers.push_back(curve->summaryCaseX()->summaryReader()); + for (auto curve : curveSet->curves()) + { + if (isYAxisStepping() && curve->summaryCaseY()) + { + readers.push_back(curve->summaryCaseY()->summaryReader()); + } + } } } @@ -474,19 +686,31 @@ std::set RimSummaryPlotSourceStepping::addressesCurveC RimSummaryCurveCollection* curveCollection = nullptr; this->firstAncestorOrThisOfType(curveCollection); - if (!curveCollection) return addresses; - - auto curves = curveCollection->curves(); - for (auto c : curves) + if (curveCollection) { - if (isYAxisStepping()) + auto curves = curveCollection->curvesForSourceStepping(m_sourceSteppingType); + for (auto c : curves) { - addresses.insert(c->summaryAddressY()); - } + if (isYAxisStepping()) + { + addresses.insert(c->summaryAddressY()); + } - if (isXAxisStepping()) + if (isXAxisStepping()) + { + addresses.insert(c->summaryAddressX()); + } + } + } + + RimEnsembleCurveSetCollection* ensembleCollection = nullptr; + this->firstAncestorOrThisOfType(ensembleCollection); + if (ensembleCollection) + { + auto curveSets = ensembleCollection->curveSetsForSourceStepping(); + for (const RimEnsembleCurveSet* curveSet : curveSets) { - addresses.insert(c->summaryAddressX()); + addresses.insert(curveSet->summaryAddress()); } } @@ -505,7 +729,7 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect if (!curveCollection) return sumCases; - auto curves = curveCollection->curves(); + auto curves = curveCollection->curvesForSourceStepping(m_sourceSteppingType); for (auto c : curves) { if (isYAxisStepping()) @@ -528,10 +752,12 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect std::vector RimSummaryPlotSourceStepping::computeVisibleFieldsAndSetFieldVisibility() { m_summaryCase.uiCapability()->setUiHidden(true); + m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden(true); m_wellName.uiCapability()->setUiHidden(true); m_wellGroupName.uiCapability()->setUiHidden(true); m_region.uiCapability()->setUiHidden(true); m_quantity.uiCapability()->setUiHidden(true); + m_ensemble.uiCapability()->setUiHidden(true); std::vector fields; @@ -546,61 +772,108 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi m_summaryCase.uiCapability()->setUiHidden(false); fields.push_back(&m_summaryCase); + + m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden(false); } } - RiaSummaryCurveAnalyzer analyzer; - analyzer.appendAdresses(addressesCurveCollection()); - - RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID; + auto ensembleColl = ensembleCollection(); + if (ensembleColl.size() == 1) { - if (analyzer.categories().size() == 1) + RimProject* proj = RiaApplication::instance()->project(); + + if (proj->summaryGroups().size() > 1) { - category = *(analyzer.categories().begin()); + m_ensemble = *(ensembleColl.begin()); + + m_ensemble.uiCapability()->setUiHidden(false); + + fields.push_back(&m_ensemble); } } - if (category != RifEclipseSummaryAddress::SUMMARY_INVALID) + std::vector fieldsCommonForAllCurves; + { - if (analyzer.wellNames().size() == 1) - { - QString txt = QString::fromStdString(*(analyzer.wellNames().begin())); - m_wellName = txt; - m_wellName.uiCapability()->setUiHidden(false); + RiaSummaryCurveAnalyzer analyzer; + analyzer.appendAdresses(addressesCurveCollection()); - fields.push_back(&m_wellName); + RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID; + { + if (analyzer.categories().size() == 1) + { + category = *(analyzer.categories().begin()); + } } - if (analyzer.wellGroupNames().size() == 1) + if (category != RifEclipseSummaryAddress::SUMMARY_INVALID) { - QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin())); - m_wellGroupName = txt; - m_wellGroupName.uiCapability()->setUiHidden(false); + if (analyzer.wellNames().size() == 1) + { + QString txt = QString::fromStdString(*(analyzer.wellNames().begin())); + m_wellName = txt; + m_wellName.uiCapability()->setUiHidden(false); - fields.push_back(&m_wellGroupName); + fieldsCommonForAllCurves.push_back(&m_wellName); + } + + if (analyzer.wellGroupNames().size() == 1) + { + QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin())); + m_wellGroupName = txt; + m_wellGroupName.uiCapability()->setUiHidden(false); + + fieldsCommonForAllCurves.push_back(&m_wellGroupName); + } + + if (analyzer.regionNumbers().size() == 1) + { + m_region = *(analyzer.regionNumbers().begin()); + m_region.uiCapability()->setUiHidden(false); + + fieldsCommonForAllCurves.push_back(&m_region); + } + + if (!analyzer.quantityNameForTitle().empty()) + { + QString txt = QString::fromStdString(analyzer.quantityNameForTitle()); + m_quantity = txt; + m_quantity.uiCapability()->setUiHidden(false); + + fieldsCommonForAllCurves.push_back(&m_quantity); + } } + } - if (analyzer.regionNumbers().size() == 1) - { - m_region = *(analyzer.regionNumbers().begin()); - m_region.uiCapability()->setUiHidden(false); - - fields.push_back(&m_region); - } - - if (analyzer.quantities().size() == 1) - { - QString txt = QString::fromStdString(*(analyzer.quantities().begin())); - m_quantity = txt; - m_quantity.uiCapability()->setUiHidden(false); - - fields.push_back(&m_quantity); - } + for (const auto& f : fieldsCommonForAllCurves) + { + fields.push_back(f); } return fields; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RimSummaryPlotSourceStepping::ensembleCollection() const +{ + std::set sumCases; + + RimEnsembleCurveSetCollection* curveCollection = nullptr; + this->firstAncestorOrThisOfType(curveCollection); + + if (!curveCollection) return sumCases; + + auto curves = curveCollection->curveSets(); + for (auto c : curves) + { + sumCases.insert(c->summaryCaseCollection()); + } + + return sumCases; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -653,6 +926,119 @@ void RimSummaryPlotSourceStepping::modifyCurrentIndex(caf::PdmValueField* valueF RimDataSourceSteppingTools::modifyCurrentIndex(valueField, options, indexOffset); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlotSourceStepping::updateAddressIfMatching(const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress::SummaryVarCategory category, + RifEclipseSummaryAddress* adr) +{ + if (!adr) return false; + + if (category == RifEclipseSummaryAddress::SUMMARY_REGION) + { + int oldInt = oldValue.toInt(); + int newInt = newValue.toInt(); + + if (adr->regionNumber() == oldInt) + { + adr->setRegion(newInt); + + return true; + } + } + else if (category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP) + { + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if (adr->wellGroupName() == oldString) + { + adr->setWellGroupName(newString); + + return true; + } + } + else if (RifEclipseSummaryAddress::isDependentOnWellName(category)) + { + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if (adr->wellName() == oldString) + { + adr->setWellName(newString); + + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlotSourceStepping::updateHistoryAndSummaryQuantityIfMatching(const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress* adr) +{ + if (!adr) return false; + + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if (adr->quantityName() == oldString) + { + adr->setQuantityName(newString); + + return true; + } + + std::string correspondingOldString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName(oldString); + std::string correspondingNewString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName(newString); + + if (adr->quantityName() == correspondingOldString) + { + adr->setQuantityName(correspondingNewString); + + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlotSourceStepping::summaryCasesForSourceStepping() +{ + std::vector cases; + + RimProject* proj = RiaApplication::instance()->project(); + for (auto sumCase : proj->allSummaryCases()) + { + if (sumCase->isObservedData()) continue; + + RimSummaryCaseCollection* sumCaseColl = nullptr; + sumCase->firstAncestorOrThisOfType(sumCaseColl); + + if (sumCaseColl && sumCaseColl->isEnsemble()) + { + if (m_includeEnsembleCasesForCaseStepping()) + { + cases.push_back(sumCase); + } + } + else + { + cases.push_back(sumCase); + } + } + + return cases; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index e6526f902d..3ae616aff9 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -31,7 +31,9 @@ #include class RimSummaryCase; +class RimSummaryCurve; class RifSummaryReaderInterface; +class RimSummaryCaseCollection; //================================================================================================== /// @@ -56,6 +58,9 @@ public: void applyNextCase(); void applyPrevCase(); + void applyNextEnsemble(); + void applyPrevEnsemble(); + void applyNextQuantity(); void applyPrevQuantity(); @@ -83,6 +88,7 @@ private: std::set addressesCurveCollection() const; std::set summaryCasesCurveCollection() const; std::vector computeVisibleFieldsAndSetFieldVisibility(); + std::set ensembleCollection() const; bool isXAxisStepping() const; bool isYAxisStepping() const; @@ -91,13 +97,29 @@ private: void modifyCurrentIndex(caf::PdmValueField* valueField, int indexOffset); + static bool updateAddressIfMatching(const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress::SummaryVarCategory category, + RifEclipseSummaryAddress* adr); + + static bool updateHistoryAndSummaryQuantityIfMatching(const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress* adr); + + std::vector summaryCasesForSourceStepping(); + private: caf::PdmPtrField m_summaryCase; + caf::PdmPtrField m_ensemble; + caf::PdmField m_wellName; caf::PdmField m_wellGroupName; caf::PdmField m_region; caf::PdmField m_quantity; caf::PdmField m_placeholderForLabel; + + caf::PdmField m_includeEnsembleCasesForCaseStepping; + SourceSteppingType m_sourceSteppingType; std::pair m_curveAnalyzerForReader; diff --git a/ApplicationCode/Resources/ResInsight.qrc b/ApplicationCode/Resources/ResInsight.qrc index 2441691d61..c0353f52ce 100644 --- a/ApplicationCode/Resources/ResInsight.qrc +++ b/ApplicationCode/Resources/ResInsight.qrc @@ -140,6 +140,8 @@ ToggleOnOff16x16.png ToggleOnOthersOff16x16.png ExportCompletionsSymbol16x16.png + StepUpDown16x16.png + StepUpDownCorner16x16.png fs_CellFace.glsl diff --git a/ApplicationCode/Resources/StepUpDown16x16.png b/ApplicationCode/Resources/StepUpDown16x16.png new file mode 100644 index 0000000000..96caf453cc Binary files /dev/null and b/ApplicationCode/Resources/StepUpDown16x16.png differ diff --git a/ApplicationCode/Resources/StepUpDownCorner16x16.png b/ApplicationCode/Resources/StepUpDownCorner16x16.png new file mode 100644 index 0000000000..8d410e2983 Binary files /dev/null and b/ApplicationCode/Resources/StepUpDownCorner16x16.png differ diff --git a/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp index a370883155..ee344ec73f 100644 --- a/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp @@ -22,6 +22,7 @@ #include "RiaBaseDefs.h" #include "RiaPreferences.h" +#include "RimEnsembleCurveSetCollection.h" #include "RimProject.h" #include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" @@ -43,6 +44,7 @@ #include "cafPdmUiToolBarEditor.h" #include "cafPdmUiTreeView.h" #include "cafQTreeViewStateSerializer.h" +#include "cafSelectionManager.h" #include #include @@ -494,19 +496,40 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::updateSummaryPlotToolBar() +void RiuPlotMainWindow::updateSummaryPlotToolBar(bool forceUpdateUi) { RimSummaryPlot* summaryPlot = dynamic_cast(m_activePlotViewWindow.p()); if (summaryPlot) { std::vector toolBarFields; - toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar(); - + + RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr; + + caf::PdmObjectHandle* selectedObj = + dynamic_cast(caf::SelectionManager::instance()->selectedItem()); + if (selectedObj) + { + selectedObj->firstAncestorOrThisOfType(ensembleCurveSetColl); + } + + if (ensembleCurveSetColl) + { + toolBarFields = ensembleCurveSetColl->fieldsToShowInToolbar(); + } + else + { + toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar(); + } + if (!m_summaryPlotToolBarEditor->isEditorDataValid(toolBarFields)) { m_summaryPlotToolBarEditor->setFields(toolBarFields); m_summaryPlotToolBarEditor->updateUi(); } + else if (forceUpdateUi) + { + m_summaryPlotToolBarEditor->updateUi(); + } m_summaryPlotToolBarEditor->show(); } @@ -693,6 +716,16 @@ void RiuPlotMainWindow::selectedObjectsChanged() m_pdmUiPropertyView->showProperties(firstSelectedObject); + if (firstSelectedObject) + { + RimSummaryPlot* summaryPlot = nullptr; + firstSelectedObject->firstAncestorOrThisOfType(summaryPlot); + if (summaryPlot) + { + updateSummaryPlotToolBar(); + } + } + if (uiItems.size() == 1 && m_allowActiveViewChangeFromSelection) { // Find the reservoir view or the Plot that the selected item is within diff --git a/ApplicationCode/UserInterface/RiuPlotMainWindow.h b/ApplicationCode/UserInterface/RiuPlotMainWindow.h index e49d7d052b..e18370b782 100644 --- a/ApplicationCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationCode/UserInterface/RiuPlotMainWindow.h @@ -81,7 +81,7 @@ public: void addToTemporaryWidgets(QWidget* widget); void updateWellLogPlotToolBar(); - void updateSummaryPlotToolBar(); + void updateSummaryPlotToolBar(bool forceUpdateUi = false); protected: void closeEvent(QCloseEvent* event) override; diff --git a/ApplicationCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationCode/UserInterface/RiuQwtPlotCurve.cpp index 3b2fb9c8c1..60f97cf916 100644 --- a/ApplicationCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationCode/UserInterface/RiuQwtPlotCurve.cpp @@ -55,6 +55,7 @@ RiuQwtPlotCurve::RiuQwtPlotCurve(const QString &title) m_errorBars->setStyle(QwtPlotIntervalCurve::CurveStyle::NoCurve); m_errorBars->setSymbol(new QwtIntervalSymbol(QwtIntervalSymbol::Bar)); m_errorBars->setItemAttribute(QwtPlotItem::Legend, false); + m_errorBars->setZ(Z_ERROR_BARS); m_showErrorBars = true; m_attachedToPlot = nullptr; diff --git a/ApplicationCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationCode/UserInterface/RiuQwtPlotCurve.h index 6d483db3f2..ac0d3a4e33 100644 --- a/ApplicationCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationCode/UserInterface/RiuQwtPlotCurve.h @@ -63,6 +63,16 @@ public: STYLE_DASH_DOT }; + // Z index. Higher Z is painted in front + enum ZIndex + { + Z_ENSEMBLE_CURVE = 100, + Z_ENSEMBLE_STAT_CURVE = 200, + Z_SINGLE_CURVE_NON_OBSERVED = 300, + Z_ERROR_BARS = 400, + Z_SINGLE_CURVE_OBSERVED = 500 + }; + public: explicit RiuQwtPlotCurve(const QString &title = QString::null); ~RiuQwtPlotCurve() override; diff --git a/ApplicationCode/UserInterface/RiuQwtSymbol.cpp b/ApplicationCode/UserInterface/RiuQwtSymbol.cpp index 092f8df2eb..e46f3d6cff 100644 --- a/ApplicationCode/UserInterface/RiuQwtSymbol.cpp +++ b/ApplicationCode/UserInterface/RiuQwtSymbol.cpp @@ -19,6 +19,8 @@ #include "RiuQwtSymbol.h" +#include "cvfAssert.h" + #include //-------------------------------------------------------------------------------------------------- @@ -130,7 +132,7 @@ void RiuQwtSymbol::renderSymbolLabel(QPainter *painter, const QPointF& position) { QSize symbolSize = QwtSymbol::size(); QRect symbolRect (position.x(), position.y(), symbolSize.width(), symbolSize.height()); - QRect labelRect = labelBoundingRect(symbolRect); + QRect labelRect = labelBoundingRect(painter, symbolRect); painter->drawText(labelRect.topLeft(), m_label); } @@ -145,24 +147,16 @@ void RiuQwtSymbol::setLabelPosition(LabelPosition labelPosition) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QRect RiuQwtSymbol::boundingRect() const +QRect RiuQwtSymbol::labelBoundingRect(const QPainter* painter, const QRect& symbolRect) const { - QRect symbolRect = QwtSymbol::boundingRect(); - QRect labelRect = labelBoundingRect(symbolRect); - return symbolRect.united(labelRect); -} + CVF_ASSERT(painter); -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QRect RiuQwtSymbol::labelBoundingRect(const QRect& symbolRect) const -{ QPoint symbolPosition = symbolRect.topLeft(); int symbolWidth = symbolRect.width(); - int labelWidth = QPainter().fontMetrics().width(m_label); - int labelHeight = QPainter().fontMetrics().height(); + int labelWidth = painter->fontMetrics().width(m_label); + int labelHeight = painter->fontMetrics().height(); QPoint labelPosition; if (m_labelPosition == LabelAboveSymbol) diff --git a/ApplicationCode/UserInterface/RiuQwtSymbol.h b/ApplicationCode/UserInterface/RiuQwtSymbol.h index d9e813a927..c3f7986645 100644 --- a/ApplicationCode/UserInterface/RiuQwtSymbol.h +++ b/ApplicationCode/UserInterface/RiuQwtSymbol.h @@ -55,15 +55,13 @@ public: RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, LabelPosition labelPosition = LabelAboveSymbol); - void renderSymbols(QPainter *painter, const QPointF *points, int numPoints) const override; - void renderSymbolLabel(QPainter *painter, const QPointF& position) const; + void renderSymbols(QPainter *painter, const QPointF *points, int numPoints) const override; + void renderSymbolLabel(QPainter *painter, const QPointF& position) const; QString label() const { return m_label; } void setLabelPosition(LabelPosition labelPosition); - QRect boundingRect() const override; - private: - QRect labelBoundingRect(const QRect& symbolRect) const; + QRect labelBoundingRect(const QPainter* painter, const QRect& symbolRect) const; private: QString m_label; diff --git a/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp b/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp index 85e9128111..8499376d50 100644 --- a/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafMemoryInspector.cpp @@ -41,6 +41,46 @@ std::map readProcessBytesLinux() } return quantities; } + +//-------------------------------------------------------------------------------------------------- +/// Read bytes of memory of different types for system from /proc/meminfo +/// See: http://man7.org/linux/man-pages/man5/proc.5.html +//-------------------------------------------------------------------------------------------------- +std::map readMemInfoLinuxMiB() +{ + std::map quantities; + uint64_t conversionToMiB = 1024; + QFile procMemInfo("/proc/meminfo"); + + if (procMemInfo.open(QIODevice::ReadOnly | QIODevice::Text)) + { + char buf[1024]; + qint64 lineLength = 0; + while (lineLength != -1) + { + lineLength = procMemInfo.readLine(buf, sizeof(buf)); + if (lineLength > 0) + { + QString line = QString::fromLatin1(buf, lineLength); + QStringList words = line.split(QRegExp(":*\\s+"), QString::SkipEmptyParts); + if (words.size() > 1) + { + bool ok = true; + unsigned long long value = words[1].toULongLong(&ok); + if (ok) + { + quantities[words[0]] = value / conversionToMiB; + } + else + { + quantities[words[0]] = 0u; + } + } + } + } + } + return quantities; +} #endif //-------------------------------------------------------------------------------------------------- /// @@ -93,7 +133,8 @@ uint64_t caf::MemoryInspector::getTotalVirtualMemoryMiB() long long totalVirtualMem = memInfo.totalram; totalVirtualMem += memInfo.totalswap; totalVirtualMem *= memInfo.mem_unit; - return totalVirtualMem / MIB_DIV; + uint64_t totalVirtualMemMiB = totalVirtualMem / MIB_DIV; + return totalVirtualMemMiB; #else return 0u; #endif @@ -137,8 +178,12 @@ uint64_t caf::MemoryInspector::getAvailableVirtualMemoryMiB() sysinfo(&memInfo); long long availVirtualMem = memInfo.freeram; availVirtualMem += memInfo.freeswap; + availVirtualMem += memInfo.bufferram; availVirtualMem *= memInfo.mem_unit; - return availVirtualMem / MIB_DIV; + uint64_t virtualMemoryWithoutCachedMiB = availVirtualMem / MIB_DIV; + uint64_t cachedMemMiB = readMemInfoLinuxMiB()["Cached"]; + uint64_t totalFreeVirtualMemoryMiB = virtualMemoryWithoutCachedMiB + cachedMemMiB; + return totalFreeVirtualMemoryMiB; #else return 0u; #endif diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index 817fcc7a86..81c805e864 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -54,6 +54,120 @@ namespace caf CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiComboBoxEditor); + +/* GIMP RGBA C-Source image dump (StepDown.c) */ + +static const struct { + unsigned int width; + unsigned int height; + unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ + unsigned char pixel_data[16 * 16 * 4 + 1]; +} stepDownImageData = { + 16, 16, 4, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000AAA\001\030\030\030\001" + "\037\037\037\001\020\020\020\001\004\004\004\001\016\016\016\001!!!\001\"\"\"\001(((\001\060\060\060\001$$" + "$\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000UUU\014FFF\242\030\030\030\256\037\037\037\256" + "\022\022\022\256\005\005\005\256\021\021\021\256'''\256...\256\061\061\061\256\067\067\067" + "\256&&&\256AAAzTTT\010\000\000\000\000\000\000\000\000xxx\014```\273\033\033\033\377&&&\377\"" + "\"\"\377\017\017\017\377\"\"\"\377LLL\377___\377^^^\377^^^\377AAA\376OOOXTT" + "T\001\000\000\000\000\000\000\000\000\000\000\000\000JJJ\071+++\343&&&\377%%%\377\017\017\017\377'''\377" + "WWW\377]]]\377hhh\377WWW\376NNN\300\177\177\177\032\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000KKK\004\066\066\066z\040\040\040\370\"\"\"\377\014\014\014\377$$$\377SSS\377" + "ccc\377bbb\377NNN\362\202\202\202=\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\064\064\064\040===\312\032\032\032\375\017\017\017\377$$$\377WWW\377bbb" + "\377MMM\374LLL\200iii\006\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000W" + "WW\001AAA\063###\330\007\007\007\377(((\377VVV\377UUU\377WWW\314\217\217\217\040\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000;;;\001\066\066" + "\066}\027\027\027\371(((\377TTT\377FFF\360\\\\\\C\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000TTT\015\025\025\025\036\040\040\040!<<<\"\"\"\067&&" + "&\070$$$\070---:CCC\060;;;\015\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000", +}; + +QIcon createStepDownIcon() +{ + QImage img(stepDownImageData.pixel_data,stepDownImageData.width, stepDownImageData.height, QImage::Format_ARGB32 ); + QPixmap pxMap; + pxMap = QPixmap::fromImage(img); + + return QIcon(pxMap); +} + +static const QIcon& stepDownIcon() +{ + static QIcon expandDownIcon(createStepDownIcon()); + return expandDownIcon; +} + +/* GIMP RGBA C-Source image dump (StepUp.c) */ + +static const struct { + unsigned int width; + unsigned int height; + unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ + unsigned char pixel_data[16 * 16 * 4 + 1]; +} stepUpImageData = { + 16, 16, 4, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000;;;\015CCC\060---:" + "$$$\070&&&\070\"\"\"\067///>,,,<---=\070\070\070E@@@?SSS\023\000\000\000\000\000\000\000\000\000\000" + "\000\000???\007\064\064\064\201\062\062\062\335\066\066\066\350\061\061\061\345)))\346$$$\344" + "&&&\353\034\034\034\351\035\035\035\352$$$\363%%%\355QQQ\264bbb\014\000\000\000\000\000\000" + "\000\000AAA\010///\220\032\032\032\343\035\035\035\336###\326###\335!!!\377\022\022\022" + "\377\034\034\034\374\024\024\024\326\015\015\015\316\007\007\007\314\071\071\071\256HHH\015" + "\000\000\000\000\000\000\000\000\000\000\000\000\"\"\"\022\040\040\040\066\026\026\026\061GGG\062ddd\266==" + "=\377\"\"\"\377???\360<<<<\040\040\040!\025\025\025\036TTT\015\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\\\\\\CFFF\360TTT\377(((\377\027\027" + "\027\371\066\066\066};;;\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\217\217\217\040WWW\314UUU\377VVV\377(((\377\007\007\007\377###\330" + "AAA\063WWW\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000iii\006LLL\200M" + "MM\374bbb\377WWW\377$$$\377\017\017\017\377\032\032\032\375===\312\064\064\064\040" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\202\202\202=NNN\362bbb\377" + "ccc\377SSS\377$$$\377\014\014\014\377\"\"\"\377\040\040\040\370\066\066\066zKKK\004" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\177\177\177\032NNN\300WWW\376hhh\377]]]\377" + "WWW\377'''\377\017\017\017\377%%%\377&&&\377+++\343JJJ\071\000\000\000\000\000\000\000\000\000" + "\000\000\000TTT\001OOOXAAA\376^^^\377^^^\377___\377LLL\377\"\"\"\377\017\017\017\377" + "\"\"\"\377&&&\377\033\033\033\377```\273xxx\014\000\000\000\000\000\000\000\000TTT\010AAAz&&&" + "\256\067\067\067\256\061\061\061\256...\256'''\256\021\021\021\256\005\005\005\256\022\022" + "\022\256\037\037\037\256\030\030\030\256FFF\242UUU\014\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000$$$\001\060\060\060\001(((\001\"\"\"\001!!!\001\016\016\016\001\004\004\004\001\020\020\020\001\037" + "\037\037\001\030\030\030\001AAA\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + "\000\000\000\000", +}; + +QIcon createStepUpIcon() +{ + QImage img(stepUpImageData.pixel_data,stepUpImageData.width, stepUpImageData.height, QImage::Format_ARGB32 ); + QPixmap pxMap; + pxMap = QPixmap::fromImage(img); + + return QIcon(pxMap); +} + +static const QIcon& stepUpIcon() +{ + static QIcon stepUpIcon(createStepUpIcon()); + return stepUpIcon; +} + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -129,22 +243,22 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName) if (m_comboBox->count() == 0 || m_comboBox->currentIndex() <= 0) { - QIcon disabledIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowUp).pixmap(16, 16, QIcon::Disabled)); + QIcon disabledIcon(stepUpIcon().pixmap(16, 16, QIcon::Disabled)); m_previousItemButton->setIcon(disabledIcon); } else { - m_previousItemButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowUp)); + m_previousItemButton->setIcon(stepUpIcon()); } if (m_comboBox->count() == 0 || m_comboBox->currentIndex() >= m_comboBox->count() - 1) { - QIcon disabledIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowDown).pixmap(16, 16, QIcon::Disabled)); + QIcon disabledIcon(stepDownIcon().pixmap(16, 16, QIcon::Disabled)); m_nextItemButton->setIcon(disabledIcon); } else { - m_nextItemButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowDown)); + m_nextItemButton->setIcon(stepDownIcon()); } // Update button texts diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp index addd9bce83..4967f6aeb3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp @@ -170,6 +170,13 @@ void PdmUiToolBarEditor::configureAndUpdateUi(const QString& uiConfigName) fieldEditor->updateUi(uiConfigName); } } + else + { + if (it->second) + { + it->second->updateUi(uiConfigName); + } + } } CAF_ASSERT(m_fields.size() == m_fieldViews.size()); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 318af8448a..8cf00ac3aa 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -259,9 +259,6 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi(const QString& uiConfigName) m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_treeView->setModel(m_proxyModel); - - connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection); - } bool optionsOnly = true; @@ -487,14 +484,6 @@ void PdmUiTreeSelectionEditor::customMenuRequested(const QPoint& pos) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous) -{ - currentChanged(current); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h index 5cb9fa88c3..8d53f83ed6 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.h @@ -103,7 +103,6 @@ protected: private slots: void customMenuRequested(const QPoint& pos); - void slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous); void slotSetSelectedOn(); void slotSetSelectedOff(); void slotSetSubItemsOn(); diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 1cfe71074a..f2db37ec88 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,10 +1,10 @@ set(RESINSIGHT_MAJOR_VERSION 2018) set(RESINSIGHT_MINOR_VERSION 11) -set(RESINSIGHT_PATCH_VERSION 0) +set(RESINSIGHT_PATCH_VERSION 1) # Opional text with no restrictions -#set(RESINSIGHT_VERSION_TEXT "-RC1") +#set(RESINSIGHT_VERSION_TEXT "-patch_RC02") # Optional text # Must be unique and increasing within one combination of major/minor/patch version