From c8d6e2944786ae6324f3e4564b3bcb3018dbc893 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 14 Oct 2022 13:20:05 +0200 Subject: [PATCH] #9364 Well Log Plot and Track: Activate and improve Show Plot Data --- .../RicShowPlotDataFeature.cpp | 46 ++++++++++++------- .../RicShowPlotDataFeature.h | 5 +- .../WellLog/RimWellLogTrack.cpp | 2 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp index 4c70fd8d58..a4d9d2bef7 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp @@ -25,12 +25,13 @@ #include "RimGridCrossPlot.h" #include "RimGridCrossPlotCurve.h" -#include "RimPlot.h" +#include "RimPlotWindow.h" #include "RimProject.h" #include "RimSummaryCrossPlot.h" #include "RimSummaryPlot.h" #include "RimVfpPlot.h" #include "RimWellLogPlot.h" +#include "RimWellLogTrack.h" #include "RiuPlotMainWindow.h" #include "RiuTextDialog.h" @@ -174,7 +175,7 @@ bool RicShowPlotDataFeature::isCommandEnabled() return true; } - std::vector selection; + std::vector selection; getSelection( selection ); int validPlots = 0; @@ -186,9 +187,9 @@ bool RicShowPlotDataFeature::isCommandEnabled() return false; } - if ( dynamic_cast( plot ) != nullptr || - ( dynamic_cast( plot ) != nullptr || dynamic_cast( plot ) != nullptr || - dynamic_cast( plot ) != nullptr ) ) + if ( dynamic_cast( plot ) || dynamic_cast( plot ) || + dynamic_cast( plot ) || dynamic_cast( plot ) || + dynamic_cast( plot ) ) { validPlots++; } @@ -217,46 +218,50 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked ) this->disableModelChangeContribution(); - std::vector selection; + std::vector selection; getSelection( selection ); std::vector selectedSummaryPlots; std::vector wellLogPlots; std::vector crossPlots; std::vector vfpPlots; + std::vector depthTracks; for ( auto plot : selection ) { - auto sumPlot = dynamic_cast( plot ); - if ( sumPlot ) + if ( auto sumPlot = dynamic_cast( plot ) ) { selectedSummaryPlots.push_back( sumPlot ); continue; } - auto wellPlot = dynamic_cast( plot ); - if ( wellPlot ) + if ( auto wellPlot = dynamic_cast( plot ) ) { wellLogPlots.push_back( wellPlot ); continue; } - auto xPlot = dynamic_cast( plot ); - if ( xPlot ) + if ( auto xPlot = dynamic_cast( plot ) ) { crossPlots.push_back( xPlot ); continue; } - auto vfpPlot = dynamic_cast( plot ); - if ( vfpPlot ) + if ( auto vfpPlot = dynamic_cast( plot ) ) { vfpPlots.push_back( vfpPlot ); continue; } + + if ( auto depthTrack = dynamic_cast( plot ) ) + { + depthTracks.push_back( depthTrack ); + continue; + } } - if ( selectedSummaryPlots.empty() && wellLogPlots.empty() && crossPlots.empty() && vfpPlots.empty() ) + if ( selectedSummaryPlots.empty() && wellLogPlots.empty() && crossPlots.empty() && vfpPlots.empty() && + depthTracks.empty() ) { CVF_ASSERT( false ); @@ -279,6 +284,13 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked ) RicShowPlotDataFeature::showTextWindow( title, text ); } + for ( auto* plot : depthTracks ) + { + QString title = plot->description(); + QString text = plot->asciiDataForPlotExport(); + RicShowPlotDataFeature::showTextWindow( title, text ); + } + for ( RimVfpPlot* vfpPlot : vfpPlots ) { QString title = vfpPlot->description(); @@ -339,14 +351,14 @@ void RicShowPlotDataFeature::showTextWindow( const QString& title, const QString //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicShowPlotDataFeature::getSelection( std::vector& selection ) +void RicShowPlotDataFeature::getSelection( std::vector& selection ) { if ( sender() ) { QVariant userData = this->userData(); if ( !userData.isNull() && userData.canConvert() ) { - RimPlot* plot = static_cast( userData.value() ); + auto* plot = static_cast( userData.value() ); if ( plot ) selection.push_back( plot ); } } diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h index a16effac74..f3ff0837fc 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h @@ -20,11 +20,10 @@ #include "cafCmdFeature.h" -#include #include class RiuTabbedTextProvider; -class RimPlot; +class RimPlotWindow; //================================================================================================== /// @@ -39,7 +38,7 @@ protected: void setupActionLook( QAction* actionToSetup ) override; private: - void getSelection( std::vector& selection ); + void getSelection( std::vector& selection ); public: static void showTabbedTextWindow( RiuTabbedTextProvider* textProvider ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index e0e7e11f77..e7f8c9089e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1061,7 +1061,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const out += QString::number( curveDepth, 'f', 3 ); for ( std::vector plotVector : curvesPlotXValues ) { - out += " \t" + QString::number( plotVector[i], 'g' ); + out += QString( " %1" ).arg( QString::number( plotVector[i], 'f', 3 ), 12 ); } out += "\n"; }