Add Multi Phase Rft Segment Plot action

This commit is contained in:
Magne Sjaastad 2022-10-07 16:08:50 +02:00
parent 3f9f337e64
commit 05d7eac52c
6 changed files with 179 additions and 10 deletions

View File

@ -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})

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
CAF_CMD_SOURCE_INIT( RicNewMultiPhaseRftSegmentPlotFeature, "RicNewMultiPhaseRftSegmentPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewMultiPhaseRftSegmentPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
{
auto rftCase = caf::SelectionManager::instance()->selectedItemOfType<RimRftCase>();
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<QString> resultNames = { "SEGGRAT", "SEGORAT", "SEGWRAT" };
std::vector<RiaDefines::RftBranchType> 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<QString>& 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" ) );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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<QString>& resultNames,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase );
};

View File

@ -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 <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewRftSegmentWellLogPlotFeature, "RicNewRftSegmentWellLogPlotFeature" );
//--------------------------------------------------------------------------------------------------

View File

@ -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 );
};

View File

@ -1088,6 +1088,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
{
menuBuilder << "RicNewRftWellLogPlotFeature";
menuBuilder << "RicNewRftSegmentWellLogPlotFeature";
menuBuilder << "RicNewMultiPhaseRftSegmentPlotFeature";
}
if ( dynamic_cast<Rim3dView*>( firstUiItem ) )