#12310 Summary plot and RFT plot adjustments

* Use vector name as axis object text, avoid identifier text
* Select the plot clicked at in the Project Tree
* Make sure RFT plots are updated when summary case and ensemble is changed
* Make sure all plots are updated for multiselect and toggle statistics
* Allow paste of plot on top level plot collection
* Allow multiple top level plots as destination for Append operations
This commit is contained in:
Magne Sjaastad
2025-03-31 08:02:00 +02:00
committed by GitHub
parent c4249e7a64
commit 3cd03c8e1c
30 changed files with 290 additions and 163 deletions
@@ -23,6 +23,7 @@
#include "RifEclipseSummaryAddress.h"
#include "RimDepthTrackPlot.h"
#include "RimMainPlotCollection.h"
#include "RimObservedDataCollection.h"
#include "RimOilField.h"
@@ -40,8 +41,11 @@
#include "RimSummaryPlot.h"
#include "RimSummaryTable.h"
#include "RimSummaryTableCollection.h"
#include "RimWellPlotTools.h"
#include "RimWellRftPlot.h"
#include "cafPdmObject.h"
#include "cafPdmObjectHandleTools.h"
#include <QRegularExpression>
@@ -385,7 +389,7 @@ bool RiaSummaryTools::isCalculationRequired( const RimUserDefinedCalculation* su
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::reloadSummaryCase( RimSummaryCase* summaryCase )
void RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( RimSummaryCase* summaryCase )
{
if ( !summaryCase ) return;
@@ -409,12 +413,15 @@ void RiaSummaryTools::reloadSummaryCase( RimSummaryCase* summaryCase )
multiPlot->updatePlotTitles();
}
auto depthTrackPlots = caf::PdmObjectHandleTools::referringAncestorOfType<RimDepthTrackPlot, RimSummaryCase>( { summaryCase } );
RimWellPlotTools::loadDataAndUpdateDepthTrackPlots( depthTrackPlots );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryTools::reloadSummaryEnsemble( RimSummaryEnsemble* ensemble )
void RiaSummaryTools::updateConnectedPlots( RimSummaryEnsemble* ensemble )
{
RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection();
for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() )
@@ -429,6 +436,9 @@ void RiaSummaryTools::reloadSummaryEnsemble( RimSummaryEnsemble* ensemble )
multiPlot->updatePlotTitles();
}
auto depthTrackPlots = caf::PdmObjectHandleTools::referringAncestorOfType<RimDepthTrackPlot, RimSummaryEnsemble>( { ensemble } );
RimWellPlotTools::loadDataAndUpdateDepthTrackPlots( depthTrackPlots );
}
//--------------------------------------------------------------------------------------------------
@@ -94,8 +94,8 @@ public:
static void copyCurveDataSources( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
static void copyCurveAxisData( RimSummaryCurve& curve, const RimSummaryCurve& otherCurve );
static void reloadSummaryCase( RimSummaryCase* summaryCase );
static void reloadSummaryEnsemble( RimSummaryEnsemble* ensemble );
static void reloadSummaryCaseAndUpdateConnectedPlots( RimSummaryCase* summaryCase );
static void updateConnectedPlots( RimSummaryEnsemble* ensemble );
static time_t calculateTimeThreshold( const time_t& minimum, const time_t& maximum );
@@ -18,12 +18,13 @@
#include "RicAppendSummaryCurvesForObjectsFeature.h"
#include "RiaGuiApplication.h"
#include "RicAppendSummaryPlotsForObjectsFeature.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RiuDockWidgetTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicAppendSummaryCurvesForObjectsFeature, "RicAppendSummaryCurvesForObjectsFeature" );
@@ -48,24 +49,25 @@ void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked
auto sumAddressCollections = RicAppendSummaryPlotsForObjectsFeature::selectedCollections();
if ( sumAddressCollections.empty() ) return;
RiaGuiApplication* app = RiaGuiApplication::instance();
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
if ( !summaryMultiPlot ) return;
RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( sumAddressCollections, summaryMultiPlot );
auto sourcePlots = summaryMultiPlot->summaryPlots();
std::vector<caf::PdmObjectHandle*> pdmObjects;
for ( auto summaryAdrCollection : sumAddressCollections )
{
pdmObjects.push_back( summaryAdrCollection );
}
for ( auto plot : sourcePlots )
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
for ( auto item : selectedTreeViewItems )
{
plot->handleDroppedObjects( pdmObjects );
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
if ( !summaryMultiPlot ) continue;
if ( !RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( sumAddressCollections, summaryMultiPlot ) ) continue;
for ( auto plot : summaryMultiPlot->summaryPlots() )
{
plot->handleDroppedObjects( pdmObjects );
}
}
}
@@ -18,16 +18,12 @@
#include "RicAppendSummaryCurvesForSummaryAddressesFeature.h"
#include "RiaGuiApplication.h"
#include "RicAppendSummaryPlotsForObjectsFeature.h"
#include "RimSummaryAddress.h"
#include "RimSummaryAddressCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RiuDockWidgetTools.h"
#include "cafSelectionManager.h"
#include <QAction>
@@ -47,17 +43,19 @@ bool RicAppendSummaryCurvesForSummaryAddressesFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicAppendSummaryCurvesForSummaryAddressesFeature::onActionTriggered( bool isChecked )
{
RiaGuiApplication* app = RiaGuiApplication::instance();
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
if ( !summaryMultiPlot ) return;
auto addresses = selectedAddresses();
if ( addresses.empty() ) return;
for ( auto plot : summaryMultiPlot->summaryPlots() )
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
for ( auto item : selectedTreeViewItems )
{
plot->handleDroppedObjects( addresses );
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
if ( !summaryMultiPlot ) continue;
for ( auto plot : summaryMultiPlot->summaryPlots() )
{
plot->handleDroppedObjects( addresses );
}
}
}
@@ -18,16 +18,13 @@
#include "RicAppendSummaryCurvesForSummaryCasesFeature.h"
#include "RiaGuiApplication.h"
#include "RicAppendSummaryPlotsForObjectsFeature.h"
#include "RimSummaryAddressCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryEnsemble.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RiuDockWidgetTools.h"
#include "cafSelectionManager.h"
#include <QAction>
@@ -39,7 +36,7 @@ CAF_CMD_SOURCE_INIT( RicAppendSummaryCurvesForSummaryCasesFeature, "RicAppendSum
//--------------------------------------------------------------------------------------------------
bool RicAppendSummaryCurvesForSummaryCasesFeature::isCommandEnabled() const
{
return !selectedCases().empty();
return !dragDropObjects().empty();
}
//--------------------------------------------------------------------------------------------------
@@ -47,17 +44,19 @@ bool RicAppendSummaryCurvesForSummaryCasesFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicAppendSummaryCurvesForSummaryCasesFeature::onActionTriggered( bool isChecked )
{
RiaGuiApplication* app = RiaGuiApplication::instance();
auto objectsForDrop = dragDropObjects();
if ( objectsForDrop.empty() ) return;
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
if ( !summaryMultiPlot ) return;
auto cases = selectedCases();
if ( cases.empty() ) return;
for ( auto plot : summaryMultiPlot->summaryPlots() )
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
for ( auto item : selectedTreeViewItems )
{
plot->handleDroppedObjects( cases );
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
if ( !summaryMultiPlot ) continue;
for ( auto plot : summaryMultiPlot->summaryPlots() )
{
plot->handleDroppedObjects( objectsForDrop );
}
}
}
@@ -76,23 +75,23 @@ void RicAppendSummaryCurvesForSummaryCasesFeature::setupActionLook( QAction* act
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmObjectHandle*> RicAppendSummaryCurvesForSummaryCasesFeature::selectedCases()
std::vector<caf::PdmObjectHandle*> RicAppendSummaryCurvesForSummaryCasesFeature::dragDropObjects()
{
// Make the object type general to match the expected type for handleDroppedObjects();
std::vector<caf::PdmObjectHandle*> generalObjects;
std::vector<caf::PdmObjectHandle*> objects;
{
std::vector<RimSummaryCase*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
std::vector<RimSummaryCase*> summaryCases;
caf::SelectionManager::instance()->objectsByType( &summaryCases );
generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() );
objects.insert( objects.begin(), summaryCases.begin(), summaryCases.end() );
}
{
std::vector<RimSummaryEnsemble*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
std::vector<RimSummaryEnsemble*> ensembles;
caf::SelectionManager::instance()->objectsByType( &ensembles );
generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() );
objects.insert( objects.begin(), ensembles.begin(), ensembles.end() );
}
return generalObjects;
return objects;
}
@@ -40,5 +40,5 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
static std::vector<caf::PdmObjectHandle*> selectedCases();
static std::vector<caf::PdmObjectHandle*> dragDropObjects();
};
@@ -18,10 +18,8 @@
#include "RicAppendSummaryPlotsForObjectsFeature.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaStdStringTools.h"
#include "Summary/RiaSummaryAddressAnalyzer.h"
#include "Summary/RiaSummaryAddressModifier.h"
#include "Summary/RiaSummaryPlotTools.h"
@@ -33,10 +31,10 @@
#include "RimSummaryCurve.h"
#include "RimSummaryEnsemble.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlot.h"
#include "cafAssert.h"
#include "RiuDockWidgetTools.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
@@ -181,12 +179,14 @@ void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked )
auto sumAddressCollections = selectedCollections();
if ( sumAddressCollections.empty() ) return;
RiaGuiApplication* app = RiaGuiApplication::instance();
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
for ( auto item : selectedTreeViewItems )
{
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
if ( !summaryMultiPlot ) continue;
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
if ( !summaryMultiPlot ) return;
appendPlots( summaryMultiPlot, sumAddressCollections );
appendPlots( summaryMultiPlot, sumAddressCollections );
}
}
//--------------------------------------------------------------------------------------------------
@@ -18,16 +18,12 @@
#include "RicAppendSummaryPlotsForSummaryAddressesFeature.h"
#include "RiaGuiApplication.h"
#include "RicAppendSummaryPlotsForObjectsFeature.h"
#include "RimSummaryAddress.h"
#include "RimSummaryAddressCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RiuDockWidgetTools.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
@@ -71,15 +67,18 @@ bool RicAppendSummaryPlotsForSummaryAddressesFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicAppendSummaryPlotsForSummaryAddressesFeature::onActionTriggered( bool isChecked )
{
RiaGuiApplication* app = RiaGuiApplication::instance();
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
if ( !summaryMultiPlot ) return;
auto addresses = selectedAddresses();
if ( addresses.empty() ) return;
appendPlotsForAddresses( summaryMultiPlot, addresses );
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
for ( auto item : selectedTreeViewItems )
{
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
if ( !summaryMultiPlot ) continue;
appendPlotsForAddresses( summaryMultiPlot, addresses );
}
}
//--------------------------------------------------------------------------------------------------
@@ -18,15 +18,14 @@
#include "RicAppendSummaryPlotsForSummaryCasesFeature.h"
#include "RiaGuiApplication.h"
#include "RicAppendSummaryPlotsForObjectsFeature.h"
#include "RimSummaryAddressCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryEnsemble.h"
#include "RimSummaryMultiPlot.h"
#include "RiuDockWidgetTools.h"
#include "cafSelectionManager.h"
#include <QAction>
@@ -49,15 +48,17 @@ bool RicAppendSummaryPlotsForSummaryCasesFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicAppendSummaryPlotsForSummaryCasesFeature::onActionTriggered( bool isChecked )
{
RiaGuiApplication* app = RiaGuiApplication::instance();
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
if ( !summaryMultiPlot ) return;
auto cases = selectedCases();
auto ensembles = selectedEnsembles();
RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, cases, ensembles );
auto selectedTreeViewItems = RiuDockWidgetTools::selectedItemsInTreeView( RiuDockWidgetTools::plotMainWindowPlotsTreeName() );
for ( auto item : selectedTreeViewItems )
{
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( item );
if ( !summaryMultiPlot ) continue;
RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, cases, ensembles );
}
}
//--------------------------------------------------------------------------------------------------
@@ -23,6 +23,7 @@
#include "RicDeleteItemFeature.h"
#include "RimDepthTrackPlot.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
@@ -31,10 +32,13 @@
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellPlotTools.h"
#include "RimWellRftPlot.h"
#include "RiuPlotMainWindow.h"
#include "cafAsyncObjectDeleter.h"
#include "cafPdmObjectHandleTools.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@@ -62,7 +66,8 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection();
std::set<RimSummaryMultiPlot*> plotsToUpdate;
std::set<RimWellLogPlot*> wellLogPlotsToDelete;
auto depthTrackPlots = caf::PdmObjectHandleTools::referringAncestorOfType<RimDepthTrackPlot, RimSummaryCase>( cases );
for ( RimSummaryCase* summaryCase : cases )
{
@@ -74,25 +79,12 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
}
plotsToUpdate.insert( multiPlot );
}
std::vector<caf::PdmObjectHandle*> referringObjects = summaryCase->objectsWithReferringPtrFields();
for ( auto object : referringObjects )
{
if ( !object ) continue;
RimWellLogPlot* wellLogPlot = object->firstAncestorOrThisOfType<RimWellLogPlot>();
if ( wellLogPlot ) wellLogPlotsToDelete.insert( wellLogPlot );
}
}
for ( auto wellLogPlot : wellLogPlotsToDelete )
{
RicDeleteItemFeature::deleteObject( wellLogPlot );
}
summaryCaseMainCollection->removeCases( cases );
RimWellPlotTools::loadDataAndUpdateDepthTrackPlots( depthTrackPlots );
for ( auto plot : plotsToUpdate )
{
plot->updateConnectedEditors();
@@ -21,6 +21,7 @@
#include "Summary/RiaSummaryTools.h"
#include "RimDeltaSummaryEnsemble.h"
#include "RimDepthTrackPlot.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
@@ -29,8 +30,10 @@
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RimWellPlotTools.h"
#include "cafPdmObject.h"
#include "cafPdmObjectHandleTools.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@@ -80,9 +83,9 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicDeleteSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryEnsemble*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.empty() ) return;
std::vector<RimSummaryEnsemble*> ensembles;
caf::SelectionManager::instance()->objectsByType( &ensembles );
if ( ensembles.empty() ) return;
QMessageBox msgBox;
msgBox.setIcon( QMessageBox::Question );
@@ -100,29 +103,29 @@ void RicDeleteSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
return;
}
if ( ret == QMessageBox::Yes )
auto depthTrackPlots = caf::PdmObjectHandleTools::referringAncestorOfType<RimDepthTrackPlot, RimSummaryEnsemble>( ensembles );
for ( RimSummaryEnsemble* ensemble : ensembles )
{
for ( RimSummaryEnsemble* summaryCaseCollection : selection )
if ( ret == QMessageBox::Yes )
{
RicDeleteSummaryCaseCollectionFeature::deleteSummaryCaseCollection( summaryCaseCollection );
RicDeleteSummaryCaseCollectionFeature::deleteSummaryCaseCollection( ensemble );
}
}
else if ( ret == QMessageBox::No )
{
for ( RimSummaryEnsemble* summaryCaseCollection : selection )
else if ( ret == QMessageBox::No )
{
RicDeleteSummaryCaseCollectionFeature::moveAllCasesToMainSummaryCollection( summaryCaseCollection );
RicDeleteSummaryCaseCollectionFeature::moveAllCasesToMainSummaryCollection( ensemble );
}
}
RimSummaryCaseMainCollection* summaryCaseMainCollection = selection[0]->firstAncestorOrThisOfTypeAsserted<RimSummaryCaseMainCollection>();
for ( RimSummaryEnsemble* caseCollection : selection )
RimSummaryCaseMainCollection* summaryCaseMainCollection = ensembles[0]->firstAncestorOrThisOfTypeAsserted<RimSummaryCaseMainCollection>();
for ( RimSummaryEnsemble* ensemble : ensembles )
{
summaryCaseMainCollection->removeEnsemble( caseCollection );
delete caseCollection;
summaryCaseMainCollection->removeEnsemble( ensemble );
delete ensemble;
}
RimWellPlotTools::loadDataAndUpdateDepthTrackPlots( depthTrackPlots );
summaryCaseMainCollection->updateConnectedEditors();
}
@@ -52,7 +52,7 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked )
std::vector<RimSummaryCase*> caseSelection = selectedSummaryCases();
for ( RimSummaryCase* summaryCase : caseSelection )
{
RiaSummaryTools::reloadSummaryCase( summaryCase );
RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase );
RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) );
}
@@ -116,7 +116,7 @@ void RicReplaceCaseFeature::onActionTriggered( bool isChecked )
{
summaryCase->setSummaryHeaderFileName( summaryFileNames.front() );
RiaSummaryTools::reloadSummaryCase( summaryCase );
RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase );
}
}
}
@@ -40,8 +40,9 @@ CAF_CMD_SOURCE_INIT( RicPasteSummaryMultiPlotFeature, "RicPasteSummaryMultiPlotF
//--------------------------------------------------------------------------------------------------
bool RicPasteSummaryMultiPlotFeature::isCommandEnabled() const
{
auto multiPlots = caf::selectedObjectsByTypeStrict<RimSummaryMultiPlot*>();
return !multiPlots.empty();
if ( !caf::selectedObjectsByType<RimSummaryMultiPlotCollection*>().empty() ) return true;
return !caf::selectedObjectsByTypeStrict<RimSummaryMultiPlot*>().empty();
}
//--------------------------------------------------------------------------------------------------
@@ -64,7 +64,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
const auto& newFileName = fileNames.front();
summaryCase->setSummaryHeaderFileName( newFileName );
RiaSummaryTools::reloadSummaryCase( summaryCase );
RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase );
RiaLogging::info( QString( "Replaced summary data for %1" ).arg( oldSummaryHeaderFilename ) );
@@ -84,6 +84,8 @@ void RicReplaceSummaryEnsembleFeature::onActionTriggered( bool isChecked )
sumCaseMainColl->updateAllRequiredEditors();
}
RiaSummaryTools::updateConnectedPlots( summaryEnsemble );
RiaLogging::info( QString( "Completed replace ensemble, new name is '" ) + summaryEnsemble->name() + "'" );
}
@@ -25,6 +25,7 @@
#include "RigEclipseResultAddress.h"
#include "Well/RigSimWellData.h"
#include "RimDepthTrackPlot.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"
#include "RimObservedDataCollection.h"
@@ -42,6 +43,7 @@
#include "RimWellLogRftCurve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellRftPlot.h"
#include <regex>
@@ -540,6 +542,24 @@ std::vector<RimPressureDepthData*> pressureDepthDataForWell( const QString& simW
return observedDataForWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void loadDataAndUpdateDepthTrackPlots( const std::set<RimDepthTrackPlot*>& depthTrackPlots )
{
for ( auto plot : depthTrackPlots )
{
plot->updateConnectedEditors();
if ( auto rftPlot = dynamic_cast<RimWellRftPlot*>( plot ) )
{
rftPlot->rebuildCurves();
}
plot->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -41,6 +41,7 @@ class RiuWellRftPlot;
class RigEclipseCaseData;
class RigEclipseResultAddress;
class RifReaderRftInterface;
class RimDepthTrackPlot;
namespace RimWellPlotTools
{
@@ -116,4 +117,5 @@ bool hasFlowData( const RimWellPath* wellPath );
std::vector<RimPressureDepthData*> pressureDepthData();
std::vector<RimPressureDepthData*> pressureDepthDataForWell( const QString& simWellName );
void loadDataAndUpdateDepthTrackPlots( const std::set<RimDepthTrackPlot*>& depthTrackPlots );
}; // namespace RimWellPlotTools
@@ -596,43 +596,45 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
else if ( m_showStatisticsCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT )
{
RimSummaryEnsemble* ensemble = curveDefToAdd.address().ensemble();
auto curveSet = findEnsembleCurveSet( ensemble );
std::set<RifEclipseRftAddress> rftAddresses =
curveSet->statisticsEclipseRftReader()->eclipseRftAddresses( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() );
for ( const auto& rftAddress : rftAddresses )
if ( auto curveSet = findEnsembleCurveSet( ensemble ) )
{
if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 )
std::set<RifEclipseRftAddress> rftAddresses =
curveSet->statisticsEclipseRftReader()->eclipseRftAddresses( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() );
for ( const auto& rftAddress : rftAddresses )
{
// Default statistics curves are P10, P50, P90 and mean
// It is not common to use P50 for ensemble RFT, so skip display of P50 to avoid confusion with mean
// https://github.com/OPM/ResInsight/issues/5238
if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 )
{
// Default statistics curves are P10, P50, P90 and mean
// It is not common to use P50 for ensemble RFT, so skip display of P50 to avoid confusion with mean
// https://github.com/OPM/ResInsight/issues/5238
continue;
}
continue;
}
if ( rftAddress.wellLogChannel() != RifEclipseRftAddress::RftWellLogChannelType::TVD )
{
auto curve = new RimWellLogRftCurve();
plotTrack->addCurve( curve );
curve->setEnsemble( ensemble );
curve->setEclipseCase( curveSet->eclipseCase() );
curve->setRftAddress( rftAddress );
curve->setObservedFmuRftData( findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
curve->setZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ) );
applyCurveAppearance( curve );
auto symbol = statisticsCurveSymbolFromAddress( rftAddress );
RiuPlotCurveSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress( rftAddress );
curve->setSymbol( symbol );
curve->setSymbolLabelPosition( labelPos );
curve->setSymbolSize( curve->symbolSize() + 3 );
curve->setSymbolSkipDistance( 150 );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
QString uiText = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( rftAddress.wellLogChannel() );
QString label = uiText.replace( ": Pressure", "" );
curve->setSymbolLabel( label );
curve->setLineThickness( 3 );
curve->setShowInLegend( !m_showEnsembleCurves );
if ( rftAddress.wellLogChannel() != RifEclipseRftAddress::RftWellLogChannelType::TVD )
{
auto curve = new RimWellLogRftCurve();
plotTrack->addCurve( curve );
curve->setEnsemble( ensemble );
curve->setEclipseCase( curveSet->eclipseCase() );
curve->setRftAddress( rftAddress );
curve->setObservedFmuRftData( findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
curve->setZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ) );
applyCurveAppearance( curve );
auto symbol = statisticsCurveSymbolFromAddress( rftAddress );
RiuPlotCurveSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress( rftAddress );
curve->setSymbol( symbol );
curve->setSymbolLabelPosition( labelPos );
curve->setSymbolSize( curve->symbolSize() + 3 );
curve->setSymbolSkipDistance( 150 );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
QString uiText = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( rftAddress.wellLogChannel() );
QString label = uiText.replace( ": Pressure", "" );
curve->setSymbolLabel( label );
curve->setLineThickness( 3 );
curve->setShowInLegend( !m_showEnsembleCurves );
}
}
}
}
@@ -1541,6 +1543,16 @@ RimWellRftEnsembleCurveSet* RimWellRftPlot::findEnsembleCurveSet( RimSummaryEnse
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::rebuildCurves()
{
createEnsembleCurveSets();
updateFormationsOnPlot();
syncCurvesFromUiSelection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -97,6 +97,8 @@ public:
RimWellRftEnsembleCurveSet* findEnsembleCurveSet( RimSummaryEnsemble* ensemble ) const;
void rebuildCurves();
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
@@ -98,7 +98,7 @@ void RimReloadCaseTools::reloadEclipseData( RimEclipseCase* eclipseCase, bool re
if ( reloadSummaryData )
{
auto summaryCase = RimReloadCaseTools::findSummaryCaseFromEclipseResultCase( dynamic_cast<RimEclipseResultCase*>( eclipseCase ) );
RiaSummaryTools::reloadSummaryCase( summaryCase );
RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase );
}
updateAllPlots();
@@ -74,6 +74,8 @@ RimEnsembleStatistics::RimEnsembleStatistics( RimEnsembleCurveSetInterface* pare
}
m_showColorField = true;
setNotifyAllFieldsInMultiFieldChangedEvents( true );
}
//--------------------------------------------------------------------------------------------------
@@ -84,7 +84,7 @@ void RimRftCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
{
auto parentCase = firstAncestorOfType<RimSummaryCase>();
if ( parentCase ) RiaSummaryTools::reloadSummaryCase( parentCase );
if ( parentCase ) RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( parentCase );
RimMainPlotCollection::current()->loadDataAndUpdateAllPlots();
}
@@ -493,7 +493,7 @@ void RimSummaryEnsembleSumo::fieldChangedByUi( const caf::PdmFieldHandle* change
updateConnectedEditors();
RiaSummaryTools::reloadSummaryEnsemble( this );
RiaSummaryTools::updateConnectedPlots( this );
}
}
@@ -238,7 +238,7 @@ QString axisTextForAddress( RifEclipseSummaryAddress address )
return QString::fromStdString( shortName );
}
auto candidate = QString::fromStdString( address.uiText() );
auto candidate = QString::fromStdString( address.vectorName() );
// Strip text starting with _ to avoid duplicate axis names
auto index = candidate.indexOf( "_" );
@@ -18,17 +18,14 @@
#include "RiuDockWidgetTools.h"
#include "RimEclipseView.h"
#include "RimGeoMechView.h"
#include "RiuMainWindow.h"
#include "cvfAssert.h"
#include "RiuPlotMainWindow.h"
#include "DockManager.h"
#include "DockWidget.h"
#include <QSettings>
#include "cafAssert.h"
#include "cafPdmUiTreeView.h"
//--------------------------------------------------------------------------------------------------
///
@@ -413,6 +410,40 @@ QIcon RiuDockWidgetTools::dockIcon( const QString dockWidgetName )
return QIcon( ":/view.svg" );
}
//--------------------------------------------------------------------------------------------------
// When a user clicks on an item in a tree view, or right-clicks for the context menu, the global selection is set to the activated object.
// This function can be used to get the selection from a different tree view
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmUiItem*> RiuDockWidgetTools::selectedItemsInTreeView( const QString& dockWidgetName )
{
ads::CDockWidget* dockWidget = nullptr;
if ( auto mainWindow = RiuMainWindow::instance() )
{
dockWidget = RiuDockWidgetTools::findDockWidget( mainWindow->dockManager(), dockWidgetName );
}
if ( !dockWidget )
{
if ( auto plotWindow = RiuPlotMainWindow::instance() )
{
dockWidget = RiuDockWidgetTools::findDockWidget( plotWindow->dockManager(), dockWidgetName );
}
}
if ( dockWidget )
{
if ( auto tree = dynamic_cast<caf::PdmUiTreeView*>( dockWidget->widget() ) )
{
std::vector<caf::PdmUiItem*> uiItems;
tree->selectedUiItems( uiItems );
return uiItems;
}
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -34,6 +34,11 @@ class CDockWidget;
class CDockManager;
}; // namespace ads
namespace caf
{
class PdmUiItem;
}; // namespace caf
//==================================================================================================
//
//
@@ -96,6 +101,8 @@ public:
static QIcon dockIcon( const QString dockWidgetName );
static std::vector<caf::PdmUiItem*> selectedItemsInTreeView( const QString& dockWidgetName );
private:
static QByteArray defaultEclipseDockState();
static QByteArray defaultGeoMechDockState();
@@ -570,6 +570,12 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
return true;
}
if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && ( mouseEvent->button() == Qt::LeftButton ) && m_plotDefinition )
{
// Select the plot clicked at in the Project Tree
RiuPlotMainWindowTools::selectAsCurrentItem( m_plotDefinition );
}
bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0;
if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton )
@@ -59,6 +59,7 @@ set(PROJECT_FILES
cafAsyncObjectDeleter.inl
cafAsyncWorkerManager.h
cafAsyncWorkerManager.cpp
cafPdmObjectHandleTools.h
)
add_library(${PROJECT_NAME} ${PROJECT_FILES})
@@ -0,0 +1,37 @@
#pragma once
namespace caf
{
namespace PdmObjectHandleTools
{
// Utility function to get all objects of a certain type from a vector of objects.
// firstAncestorOrThisOfType is applied to the referring objects of the source objects
//
// Example usage:
// std::vector<RimSummaryEnsemble*> ensembles;
// std::vector<RimDepthTrackPlot*> plots =
// caf::PdmObjectHandleTools::referringAncestorOfType<RimDepthTrackPlot, RimSummaryEnsemble>( ensembles );
//
template <typename DestinationType, typename SourceType>
std::set<DestinationType*> referringAncestorOfType( const std::vector<SourceType*>& sourceObjects )
{
std::set<DestinationType*> destinationObjects;
for ( auto source : sourceObjects )
{
if ( !source ) continue;
for ( auto object : source->objectsWithReferringPtrFields() )
{
if ( !object ) continue;
if ( auto candidate = object->template firstAncestorOrThisOfType<DestinationType>() )
{
destinationObjects.insert( candidate );
}
}
}
return destinationObjects;
}
} //namespace PdmObjectHandleTools
} //namespace caf