From 4f25fb4463ed7cd1b97216c2e3f2f2e2fe83b945 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Nov 2023 14:25:52 +0100 Subject: [PATCH] Create multiple RFT plots based on the selected RFT plot Show a dialog with all available RFT wells, and let the user select from this list. Create a copy of the RFT plot, and replace well name in the copy. --- .../WellLogCommands/CMakeLists_files.cmake | 4 + .../RicCreateRftPlotsFeature.cpp | 167 ++++++++++++++++++ .../RicCreateRftPlotsFeature.h | 44 +++++ .../RicCreateRftPlotsFeatureUi.cpp | 67 +++++++ .../RicCreateRftPlotsFeatureUi.h | 49 +++++ .../WellLogCommands/RicNewRftPlotFeature.cpp | 39 +--- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 64 +++++-- .../ProjectDataModel/Flow/RimWellRftPlot.h | 4 +- .../RimContextCommandBuilder.cpp | 5 + 9 files changed, 400 insertions(+), 43 deletions(-) create mode 100644 ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp create mode 100644 ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.h create mode 100644 ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.cpp create mode 100644 ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.h diff --git a/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake index a6df37a9af..069574882e 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake @@ -31,6 +31,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCalculatedCurveFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeatureUi.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -66,6 +68,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCalculatedCurveFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicCreateRftPlotsFeatureUi.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp new file mode 100644 index 0000000000..274daa40f4 --- /dev/null +++ b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp @@ -0,0 +1,167 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023 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 "RicCreateRftPlotsFeature.h" + +#include "RiaLogging.h" + +#include "RicCreateRftPlotsFeatureUi.h" + +#include "RifReaderRftInterface.h" + +#include "RimMainPlotCollection.h" +#include "RimRftPlotCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimWellLogPlotNameConfig.h" +#include "RimWellLogTrack.h" +#include "RimWellPlotTools.h" +#include "RimWellRftPlot.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicCreateRftPlotsFeature, "RicCreateRftPlotsFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateRftPlotsFeature::onActionTriggered( bool isChecked ) +{ + auto sourcePlot = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + if ( !sourcePlot ) return; + + RimRftPlotCollection* rftPlotColl = RimMainPlotCollection::current()->rftPlotCollection(); + if ( !rftPlotColl ) return; + + std::set wellsWithRftData; + + auto dataSource = sourcePlot->dataSource(); + if ( auto summaryCollection = std::get_if( &dataSource ) ) + { + wellsWithRftData = ( *summaryCollection )->wellsWithRftData(); + } + else if ( auto summaryCase = std::get_if( &dataSource ) ) + { + RifReaderRftInterface* reader = ( *summaryCase )->rftReader(); + if ( reader ) + { + wellsWithRftData = reader->wellNames(); + } + } + + if ( wellsWithRftData.empty() ) return; + + RicCreateRftPlotsFeatureUi ui; + ui.setAllWellNames( { wellsWithRftData.begin(), wellsWithRftData.end() } ); + + caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &ui, "Select RFT wells", "" ); + if ( propertyDialog.exec() != QDialog::Accepted ) return; + + for ( const auto& wellName : ui.selectedWellNames() ) + { + appendRftPlotForWell( wellName, rftPlotColl, sourcePlot ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateRftPlotsFeature::appendRftPlotForWell( const QString& wellName, RimRftPlotCollection* rftPlotColl, RimWellRftPlot* sourcePlot ) +{ + if ( !rftPlotColl ) + { + RiaLogging::error( "Missing RFT plot collection, no RFT plot created." ); + return; + } + + if ( !sourcePlot ) + { + RiaLogging::error( "Missing source RFT plot, no RFT plot created." ); + return; + } + + // Create a RFT plot based on wellName, and reuse the data source selection in sourcePlot + + auto rftPlot = + dynamic_cast( sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + if ( !rftPlot ) return; + + rftPlot->setSimWellOrWellPathName( wellName ); + rftPlotColl->addPlot( rftPlot ); + rftPlot->resolveReferencesRecursively(); + rftPlot->applyInitialSelections( sourcePlot->dataSource() ); + + const auto generatedName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name + const QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( generatedName ); + + rftPlot->nameConfig()->setCustomName( plotName ); + + rftPlot->loadDataAndUpdate(); + rftPlotColl->updateConnectedEditors(); + + RiuPlotMainWindowTools::showPlotMainWindow(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateRftPlotsFeature::appendRftPlotForWell( const QString& wellName, RimRftPlotCollection* rftPlotColl ) +{ + if ( !rftPlotColl ) + { + RiaLogging::error( "Missing RFT plot collection, no RFT plot created." ); + return; + } + + // Create a default RFT plot based on well name, and toggle on all available data sources in this RFT plot + + auto rftPlot = new RimWellRftPlot(); + rftPlot->setSimWellOrWellPathName( wellName ); + + auto plotTrack = new RimWellLogTrack(); + rftPlot->addPlot( plotTrack ); + plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->plotCount() ) ); + + rftPlotColl->addPlot( rftPlot ); + rftPlot->applyInitialSelections( {} ); + + const auto generatedName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name + const QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( generatedName ); + + rftPlot->nameConfig()->setCustomName( plotName ); + rftPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM ); + rftPlot->loadDataAndUpdate(); + rftPlotColl->updateConnectedEditors(); + + RiuPlotMainWindowTools::showPlotMainWindow(); + RiuPlotMainWindowTools::onObjectAppended( rftPlot, plotTrack ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateRftPlotsFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create Multiple RFT Plots" ); + actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.h new file mode 100644 index 0000000000..2f738d0b0e --- /dev/null +++ b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023 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" + +#include + +#include + +class RimRftPlotCollection; +class RimWellRftPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicCreateRftPlotsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + + static void appendRftPlotForWell( const QString& wellName, RimRftPlotCollection* rftPlotColl ); + +private: + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + + void appendRftPlotForWell( const QString& wellName, RimRftPlotCollection* rftPlotColl, RimWellRftPlot* sourcePlot ); +}; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.cpp new file mode 100644 index 0000000000..da625734d2 --- /dev/null +++ b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023 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 "RicCreateRftPlotsFeatureUi.h" + +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_SOURCE_INIT( RicCreateRftPlotsFeatureUi, "RicCreateRftPlotsFeatureUi" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicCreateRftPlotsFeatureUi::RicCreateRftPlotsFeatureUi() +{ + CAF_PDM_InitObject( "RicCreateRftPlotsFeatureUi" ); + + CAF_PDM_InitFieldNoDefault( &m_selectedWellNames, "SelectedWellNames", "Well Names" ); + m_selectedWellNames.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateRftPlotsFeatureUi::setAllWellNames( const std::vector& wellNames ) +{ + m_allWellNames = wellNames; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicCreateRftPlotsFeatureUi::selectedWellNames() const +{ + return m_selectedWellNames(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RicCreateRftPlotsFeatureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + if ( fieldNeedingOptions == &m_selectedWellNames ) + { + for ( const auto& wellName : m_allWellNames ) + { + options.append( caf::PdmOptionItemInfo( wellName, wellName ) ); + } + } + + return options; +} diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.h b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.h new file mode 100644 index 0000000000..d24bd55fa8 --- /dev/null +++ b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeatureUi.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023 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 "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" + +#include + +#include + +//================================================================================================== +/// +//================================================================================================== +class RicCreateRftPlotsFeatureUi : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicCreateRftPlotsFeatureUi(); + + void setAllWellNames( const std::vector& wellNames ); + std::vector selectedWellNames() const; + +protected: + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; + +private: + caf::PdmField> m_selectedWellNames; + + std::vector m_allWellNames; +}; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp index 7831ebae6b..b7d0dfab25 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp @@ -18,16 +18,12 @@ #include "RicNewRftPlotFeature.h" +#include "RicCreateRftPlotsFeature.h" + #include "RimMainPlotCollection.h" #include "RimRftPlotCollection.h" #include "RimSimWellInView.h" -#include "RimWellLogPlot.h" -#include "RimWellLogPlotNameConfig.h" -#include "RimWellLogTrack.h" #include "RimWellPath.h" -#include "RimWellRftPlot.h" - -#include "RiuPlotMainWindowTools.h" #include "cafSelectionManagerTools.h" @@ -42,7 +38,7 @@ CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" ); //-------------------------------------------------------------------------------------------------- bool RicNewRftPlotFeature::isCommandEnabled() const { - RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject(); + auto* simWell = caf::firstAncestorOfTypeFromSelectedObject(); if ( simWell ) return true; if ( selectedWellName().isEmpty() ) @@ -63,28 +59,7 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked ) { QString wellName = selectedWellName(); - RimWellRftPlot* rftPlot = new RimWellRftPlot(); - - rftPlot->setSimWellOrWellPathName( wellName ); - - RimWellLogTrack* plotTrack = new RimWellLogTrack(); - rftPlot->addPlot( plotTrack ); - plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->plotCount() ) ); - - rftPlotColl->addPlot( rftPlot ); - rftPlot->applyInitialSelections(); - - wellName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name - QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName ); - - rftPlot->nameConfig()->setCustomName( plotName ); - rftPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM ); - - rftPlot->loadDataAndUpdate(); - rftPlotColl->updateConnectedEditors(); - - RiuPlotMainWindowTools::showPlotMainWindow(); - RiuPlotMainWindowTools::onObjectAppended( rftPlot, plotTrack ); + RicCreateRftPlotsFeature::appendRftPlotForWell( wellName, rftPlotColl ); } } @@ -102,11 +77,11 @@ void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- QString RicNewRftPlotFeature::selectedWellName() { - RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject(); + auto* simWell = caf::firstAncestorOfTypeFromSelectedObject(); if ( simWell ) return simWell->name(); - RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject(); + auto* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject(); if ( rimWellPath ) return rimWellPath->name(); - return QString(); + return {}; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index c62c830fb3..86882e2e1f 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -242,7 +242,7 @@ QString RimWellRftPlot::associatedSimWellName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::applyInitialSelections() +void RimWellRftPlot::applyInitialSelections( std::variant dataSource ) { std::map wellSources = findWellSources(); if ( m_wellPathNameOrSimWellName() == "None" && !wellSources.empty() ) @@ -250,22 +250,49 @@ void RimWellRftPlot::applyInitialSelections() m_wellPathNameOrSimWellName = wellSources.begin()->first; } + RimSummaryCaseCollection* ensemble = nullptr; + RimSummaryCase* summaryCase = nullptr; + + if ( auto summaryCollection = std::get_if( &dataSource ) ) + { + ensemble = *summaryCollection; + } + else if ( auto sumCase = std::get_if( &dataSource ) ) + { + summaryCase = *sumCase; + } + + bool summaryOrEnsembleSelected = ( summaryCase || ensemble ); + std::vector sourcesToSelect; const QString simWellName = associatedSimWellName(); - for ( RimEclipseResultCase* const rftCase : RimWellPlotTools::rftCasesForWell( simWellName ) ) + if ( !summaryOrEnsembleSelected ) { - sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA, rftCase ) ); - } + for ( RimEclipseResultCase* const rftCase : RimWellPlotTools::rftCasesForWell( simWellName ) ) + { + sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA, rftCase ) ); + } - for ( RimEclipseResultCase* const gridCase : RimWellPlotTools::gridCasesForWell( simWellName ) ) - { - sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA, gridCase ) ); - } + for ( RimEclipseResultCase* const gridCase : RimWellPlotTools::gridCasesForWell( simWellName ) ) + { + sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA, gridCase ) ); + } - for ( RimSummaryCaseCollection* const ensemble : RimWellPlotTools::rftEnsemblesForWell( simWellName ) ) + for ( RimSummaryCaseCollection* const ensemble : RimWellPlotTools::rftEnsemblesForWell( simWellName ) ) + { + sourcesToSelect.push_back( RifDataSourceForRftPlt( ensemble ) ); + } + + for ( auto singleCase : RiaSummaryTools::singleTopLevelSummaryCases() ) + { + sourcesToSelect.push_back( RifDataSourceForRftPlt( singleCase, nullptr, nullptr ) ); + } + } + else { - sourcesToSelect.push_back( RifDataSourceForRftPlt( ensemble ) ); + if ( summaryCase ) sourcesToSelect.push_back( RifDataSourceForRftPlt( summaryCase, nullptr, nullptr ) ); + if ( ensemble ) sourcesToSelect.push_back( RifDataSourceForRftPlt( ensemble ) ); } std::vector wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName ); @@ -1514,6 +1541,23 @@ RimWellRftEnsembleCurveSet* RimWellRftPlot::findEnsembleCurveSet( RimSummaryCase return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::variant RimWellRftPlot::dataSource() const +{ + // Return the first selected ensemble, if any + // If no ensemble is selected, return the first selected summary case, if any + + for ( const auto& source : m_selectedSources() ) + { + if ( source.ensemble() ) return source.ensemble(); + if ( source.summaryCase() ) return source.summaryCase(); + } + + return {}; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h index 168ff2f8d6..6cbb040255 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h @@ -38,6 +38,7 @@ #include #include #include +#include class RimEclipseCase; class RimEclipseResultCase; @@ -83,7 +84,8 @@ public: int branchIndex() const; - void applyInitialSelections(); + std::variant dataSource() const; + void applyInitialSelections( std::variant dataSource ); static const char* plotNameFormatString(); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 18e1b3bf52..15e13f6228 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -168,6 +168,7 @@ #include "RimWellPathFracture.h" #include "RimWellPathFractureCollection.h" #include "RimWellPltPlot.h" +#include "RimWellRftPlot.h" #ifdef USE_QTCHARTS #include "RimEnsembleFractureStatisticsPlotCollection.h" @@ -631,6 +632,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicDuplicateSummaryTableFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicCreateRftPlotsFeature"; + } else if ( dynamic_cast( firstUiItem ) && !dynamic_cast( firstUiItem ) ) { menuBuilder << "RicPasteWellLogPlotFeature";