diff --git a/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake index 93357db61e..23a333ee2d 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/WellLogCommands/CMakeLists_files.cmake @@ -29,6 +29,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -62,6 +63,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPhaseRftSegmentPlotFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp new file mode 100644 index 0000000000..249c1ec5cf --- /dev/null +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 "RicNewMultiPhaseRftSegmentPlotFeature.h" +#include "RicNewRftSegmentWellLogPlotFeature.h" + +#include "RicNewWellLogPlotFeatureImpl.h" +#include "RicWellLogPlotCurveFeatureImpl.h" +#include "RicWellLogTools.h" + +#include "RiaApplication.h" +#include "RiaRftDefines.h" + +#include "RifReaderOpmRft.h" + +#include "RimRftCase.h" +#include "RimRftTopologyCurve.h" +#include "RimSummaryCase.h" +#include "RimWellLogPlot.h" +#include "RimWellLogTrack.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewMultiPhaseRftSegmentPlotFeature, "RicNewMultiPhaseRftSegmentPlotFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewMultiPhaseRftSegmentPlotFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked ) +{ + auto rftCase = caf::SelectionManager::instance()->selectedItemOfType(); + if ( !rftCase ) return; + + RimSummaryCase* summaryCase = nullptr; + rftCase->firstAncestorOfType( summaryCase ); + if ( !summaryCase ) return; + + auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot(); + + QString wellName = "Unknown"; + + auto rftReader = summaryCase->rftReader(); + if ( rftReader ) + { + auto wellNames = rftReader->wellNames(); + if ( !wellNames.empty() ) wellName = *wellNames.begin(); + } + + std::vector resultNames = { "SEGGRAT", "SEGORAT", "SEGWRAT" }; + + std::vector branchTypes{ RiaDefines::RftBranchType::RFT_ANNULUS, + RiaDefines::RftBranchType::RFT_DEVICE, + RiaDefines::RftBranchType::RFT_TUBING }; + + for ( auto branchType : branchTypes ) + { + appendTrackAndCurveForBranchType( plot, resultNames, wellName, branchType, summaryCase ); + } + + RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( plot, wellName, summaryCase ); + + plot->loadDataAndUpdate(); + + RiuPlotMainWindowTools::onObjectAppended( plot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot, + const std::vector& resultNames, + const QString& wellName, + RiaDefines::RftBranchType branchType, + RimSummaryCase* summaryCase ) +{ + RimWellLogTrack* plotTrack = new RimWellLogTrack(); + plot->addPlot( plotTrack ); + plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) ); + + plot->loadDataAndUpdate(); + + for ( const auto& resultName : resultNames ) + { + auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase ); + curve->setIsStacked( true ); + curve->loadDataAndUpdate( true ); + + curve->updateAllRequiredEditors(); + RiuPlotMainWindowTools::setExpanded( curve ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewMultiPhaseRftSegmentPlotFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create RFT Multi Phase Segment Plot" ); + actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.h new file mode 100644 index 0000000000..af6c55f7f8 --- /dev/null +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 "RiaRftDefines.h" + +#include "cafCmdFeature.h" + +class RimWellLogPlot; +class RimSummaryCase; + +//================================================================================================== +/// +//================================================================================================== +class RicNewMultiPhaseRftSegmentPlotFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +private: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + + void setupActionLook( QAction* actionToSetup ) override; + + void appendTrackAndCurveForBranchType( RimWellLogPlot* plot, + const std::vector& resultNames, + const QString& wellName, + RiaDefines::RftBranchType branchType, + RimSummaryCase* summaryCase ); +}; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp index a59774981a..52a41c33a1 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp @@ -25,19 +25,13 @@ #include "RiaApplication.h" #include "RiaRftDefines.h" -#include "RifReaderEclipseRft.h" #include "RifReaderOpmRft.h" -#include "RigWellLogCurveData.h" - #include "RimRftCase.h" #include "RimRftTopologyCurve.h" #include "RimSummaryCase.h" -#include "RimWellLogExtractionCurve.h" -#include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "Riu3dSelectionManager.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" @@ -45,8 +39,6 @@ #include -#include - CAF_CMD_SOURCE_INIT( RicNewRftSegmentWellLogPlotFeature, "RicNewRftSegmentWellLogPlotFeature" ); //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.h index f591c5e6c8..377bf17d42 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.h @@ -32,6 +32,9 @@ class RicNewRftSegmentWellLogPlotFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; +public: + static void appendTopologyTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase ); + private: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; @@ -43,6 +46,4 @@ private: const QString& wellName, RiaDefines::RftBranchType branchType, RimSummaryCase* summaryCase ); - - void appendTopologyTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 5b1af4e6c3..b7c349ad88 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1088,6 +1088,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicNewRftWellLogPlotFeature"; menuBuilder << "RicNewRftSegmentWellLogPlotFeature"; + menuBuilder << "RicNewMultiPhaseRftSegmentPlotFeature"; } if ( dynamic_cast( firstUiItem ) )