From b6281c364dc0dc13cb2ef1337670008d8c3d565d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Mar 2023 08:10:33 +0100 Subject: [PATCH] Adjustments for release * Show segment plots in Well Log Plot collection * Improve menu text for operations related to segment plots * Show reservoir rates for annulus and device * Make sure curve objects are visible in the Project Tree * When importing the first summary case, expand case in project tree * Bump version --- .../RicSummaryPlotBuilder.cpp | 39 ++++++++++--------- .../Commands/RicImportSummaryCasesFeature.cpp | 8 ++++ .../RicNewMultiPhaseRftSegmentPlotFeature.cpp | 28 +++++++------ .../RicNewRftSegmentWellLogPlotFeature.cpp | 10 +++-- .../RicNewWellLogPlotFeatureImpl.cpp | 15 +------ .../RimContextCommandBuilder.cpp | 2 + .../Summary/RimFileSummaryCase.cpp | 2 +- .../ProjectDataModel/Summary/RimRftCase.cpp | 2 +- .../Summary/RimSummaryAddressCollection.cpp | 2 +- .../WellLog/RimWellLogRftCurve.cpp | 11 +++++- ResInsightVersion.cmake | 6 +-- 11 files changed, 67 insertions(+), 58 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index ab8c9a997b..6878880e00 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -463,6 +463,14 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPl summaryMultiPlot->updateAllRequiredEditors(); RiuPlotMainWindowTools::selectAsCurrentItem( plot ); + if ( !plot->curveSets().empty() ) + { + RiuPlotMainWindowTools::setExpanded( plot->curveSets().front() ); + } + else if ( !plot->summaryCurves().empty() ) + { + RiuPlotMainWindowTools::setExpanded( plot->summaryCurves().front() ); + } return summaryMultiPlot; } @@ -526,7 +534,16 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con if ( !plots.empty() ) { - RiuPlotMainWindowTools::selectAsCurrentItem( plots[0] ); + auto* plot = plots.front(); + RiuPlotMainWindowTools::selectAsCurrentItem( plot ); + if ( !plot->curveSets().empty() ) + { + RiuPlotMainWindowTools::setExpanded( plot->curveSets().front() ); + } + else if ( !plot->summaryCurves().empty() ) + { + RiuPlotMainWindowTools::setExpanded( plot->summaryCurves().front() ); + } } else { @@ -541,25 +558,9 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( RimSummaryPlot* plot ) { - auto* plotCollection = RimMainPlotCollection::current()->summaryMultiPlotCollection(); + std::vector plots{ plot }; - auto* summaryMultiPlot = new RimSummaryMultiPlot(); - summaryMultiPlot->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); - summaryMultiPlot->setRowCount( RiaDefines::RowCount::ROWS_1 ); - summaryMultiPlot->setAsPlotMdiWindow(); - plotCollection->addSummaryMultiPlot( summaryMultiPlot ); - - appendPlotsToSummaryMultiPlot( summaryMultiPlot, { plot } ); - - summaryMultiPlot->setDefaultRangeAggregationSteppingDimension(); - - plotCollection->updateAllRequiredEditors(); - summaryMultiPlot->loadDataAndUpdate(); - summaryMultiPlot->updateAllRequiredEditors(); - - RiuPlotMainWindowTools::selectAsCurrentItem( plot ); - - return summaryMultiPlot; + return createAndAppendSummaryMultiPlot( plots ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index 0897503bf2..156c96b76c 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -217,9 +217,17 @@ void RicImportSummaryCasesFeature::addSummaryCases( const std::vectorproject(); RimSummaryCaseMainCollection* sumCaseColl = proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr; + if ( !sumCaseColl ) return; + + bool expandFirstCase = sumCaseColl->allSummaryCases().empty(); sumCaseColl->addCases( cases ); sumCaseColl->updateAllRequiredEditors(); + + if ( expandFirstCase && !cases.empty() ) + { + RiuPlotMainWindowTools::setExpanded( cases.front() ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp index 0cf5cf3e91..cccbcb690b 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp @@ -75,22 +75,20 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked ) auto wellNames = rftReader->wellNames(); if ( !wellNames.empty() ) wellName = *wellNames.begin(); - appendTrackAndCurveForBranchType( plot, - "Reservoir Rates", - { "CONGRAT", "CONORAT", "CONWRAT" }, - wellName, - RiaDefines::RftBranchType::RFT_ANNULUS, - summaryCase ); - + // Reservoir rates can be available on both annulus and device + for ( auto branchType : { RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE } ) { - for ( auto branchType : - { RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE, RiaDefines::RftBranchType::RFT_TUBING } ) - { - QString trackName = caf::AppEnum::uiText( branchType ); - trackName += " Rates"; + QString trackName = "Reservoir Rates - " + caf::AppEnum::uiText( branchType ); + appendTrackAndCurveForBranchType( plot, trackName, { "CONGRAT", "CONORAT", "CONWRAT" }, wellName, branchType, summaryCase ); + } - appendTrackAndCurveForBranchType( plot, trackName, { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, summaryCase ); - } + for ( auto branchType : + { RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE, RiaDefines::RftBranchType::RFT_TUBING } ) + { + QString trackName = caf::AppEnum::uiText( branchType ); + trackName += " Rates"; + + appendTrackAndCurveForBranchType( plot, trackName, { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, summaryCase ); } RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( plot, wellName, summaryCase ); @@ -145,6 +143,6 @@ void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( Ri //-------------------------------------------------------------------------------------------------- void RicNewMultiPhaseRftSegmentPlotFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Create RFT Multi Phase Segment Plot" ); + actionToSetup->setText( "Create Multi Phase Segment Plot" ); actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp index 45f762e969..266d850f18 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp @@ -75,12 +75,16 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked ) auto wellNames = rftReader->wellNames(); if ( !wellNames.empty() ) wellName = *wellNames.begin(); + // Reservoir rates can be available on both annulus and device + for ( auto branchType : { RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE } ) { + QString trackName = "Reservoir Rates - " + caf::AppEnum::uiText( branchType ); + RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogTrackWithAutoUpdate(); plot->addPlot( plotTrack ); - plotTrack->setDescription( "Reservoir Rates" ); + plotTrack->setDescription( trackName ); - auto curve = createAndAddCurve( plotTrack, "CONGRAT", wellName, RiaDefines::RftBranchType::RFT_ANNULUS, summaryCase ); + auto curve = createAndAddCurve( plotTrack, "CONGRAT", wellName, branchType, summaryCase ); curve->setScaleFactor( 1e-3 ); curve->setFillStyle( Qt::SolidPattern ); } @@ -320,6 +324,6 @@ RimSummaryCase* RicNewRftSegmentWellLogPlotFeature::getSelectedOrFirstRftCase() //-------------------------------------------------------------------------------------------------- void RicNewRftSegmentWellLogPlotFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Create RFT Segment Plot" ); + actionToSetup->setText( "Create Segment Plot" ); actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index 0717895fd8..f52ed5fd25 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -87,20 +87,7 @@ RimWellBoreStabilityPlot* RicNewWellLogPlotFeatureImpl::createWellBoreStabilityP //-------------------------------------------------------------------------------------------------- RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createRftSegmentPlot() { - auto rftPlotCollection = RimMainPlotCollection::current()->rftPlotCollection(); - CVF_ASSERT( rftPlotCollection ); - - // Make sure the summary plot window is created - RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); - - RimWellLogPlot* plot = new RimWellLogPlot(); - plot->setAsPlotMdiWindow(); - - rftPlotCollection->addPlot( plot ); - - plot->nameConfig()->setCustomName( QString( "RFT Segment Plot %1" ).arg( rftPlotCollection->plotCount() ) ); - - rftPlotCollection->updateConnectedEditors(); + auto plot = createWellLogPlot(); plot->setDepthOrientation( RiaDefines::Orientation::HORIZONTAL ); plot->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE ); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index c992d63d24..0b2365085d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -538,6 +538,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "Separator"; menuBuilder << "RicNewWellLogPlotFeature"; menuBuilder << "RicNewWellBoreStabilityPlotFeature"; + menuBuilder << "RicNewMultiPhaseRftSegmentPlotFeature"; + menuBuilder << "RicNewRftSegmentWellLogPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 4b45280791..f9760d9668 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -66,7 +66,7 @@ RimFileSummaryCase::RimFileSummaryCase() CAF_PDM_InitFieldNoDefault( &m_additionalSummaryFilePath, "AdditionalSummaryFilePath", "Additional File Path (set invisible when ready)" ); m_additionalSummaryFilePath.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_rftCase, "RftCase", "RFT Case" ); + CAF_PDM_InitFieldNoDefault( &m_rftCase, "RftCase", "RFT Data" ); m_rftCase = new RimRftCase; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp index 23f4359019..3701dc4267 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimRftCase, "RimRftCase" ); //-------------------------------------------------------------------------------------------------- RimRftCase::RimRftCase() { - CAF_PDM_InitObject( "RFT Case ", ":/SummaryCases16x16.png", "", "" ); + CAF_PDM_InitObject( "RFT Data", ":/SummaryCases16x16.png", "", "" ); CAF_PDM_InitFieldNoDefault( &m_rftFilePath, "RftFilePath", "Rft File" ); m_rftFilePath.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 59bb7e664a..189d1616da 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -165,13 +165,13 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set errors = errorValues(); std::vector perPointLabels; - if ( values.empty() || values.size() != tvDepthVector.size() ) + auto anyValidValuesPresent = []( const std::vector& values ) -> bool { + for ( const auto& v : values ) + { + if ( RiaStatisticsTools::isValidNumber( v ) ) return true; + } + return false; + }; + + if ( !anyValidValuesPresent( values ) || ( values.size() != tvDepthVector.size() ) ) { clearCurveData(); this->detach( true ); diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 0598a29c3a..f91814b3bc 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,11 +1,11 @@ set(RESINSIGHT_MAJOR_VERSION 2023) -set(RESINSIGHT_MINOR_VERSION 01) -set(RESINSIGHT_PATCH_VERSION 1) +set(RESINSIGHT_MINOR_VERSION 03) +set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions #set(RESINSIGHT_VERSION_TEXT "-dev") -set(RESINSIGHT_VERSION_TEXT "-RC_02") +set(RESINSIGHT_VERSION_TEXT "-RC_01") # Optional text # Must be unique and increasing within one combination of major/minor/patch version