#9364 Well Log Plot and Track: Activate and improve Show Plot Data

This commit is contained in:
Magne Sjaastad 2022-10-14 13:20:05 +02:00
parent 905b2abe53
commit c8d6e29447
3 changed files with 32 additions and 21 deletions

View File

@ -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<RimPlot*> selection;
std::vector<RimPlotWindow*> selection;
getSelection( selection );
int validPlots = 0;
@ -186,9 +187,9 @@ bool RicShowPlotDataFeature::isCommandEnabled()
return false;
}
if ( dynamic_cast<RimSummaryPlot*>( plot ) != nullptr ||
( dynamic_cast<RimWellLogPlot*>( plot ) != nullptr || dynamic_cast<RimGridCrossPlot*>( plot ) != nullptr ||
dynamic_cast<RimVfpPlot*>( plot ) != nullptr ) )
if ( dynamic_cast<RimSummaryPlot*>( plot ) || dynamic_cast<RimWellLogPlot*>( plot ) ||
dynamic_cast<RimWellLogTrack*>( plot ) || dynamic_cast<RimGridCrossPlot*>( plot ) ||
dynamic_cast<RimVfpPlot*>( plot ) )
{
validPlots++;
}
@ -217,46 +218,50 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
this->disableModelChangeContribution();
std::vector<RimPlot*> selection;
std::vector<RimPlotWindow*> selection;
getSelection( selection );
std::vector<RimSummaryPlot*> selectedSummaryPlots;
std::vector<RimWellLogPlot*> wellLogPlots;
std::vector<RimGridCrossPlot*> crossPlots;
std::vector<RimVfpPlot*> vfpPlots;
std::vector<RimWellLogTrack*> depthTracks;
for ( auto plot : selection )
{
auto sumPlot = dynamic_cast<RimSummaryPlot*>( plot );
if ( sumPlot )
if ( auto sumPlot = dynamic_cast<RimSummaryPlot*>( plot ) )
{
selectedSummaryPlots.push_back( sumPlot );
continue;
}
auto wellPlot = dynamic_cast<RimWellLogPlot*>( plot );
if ( wellPlot )
if ( auto wellPlot = dynamic_cast<RimWellLogPlot*>( plot ) )
{
wellLogPlots.push_back( wellPlot );
continue;
}
auto xPlot = dynamic_cast<RimGridCrossPlot*>( plot );
if ( xPlot )
if ( auto xPlot = dynamic_cast<RimGridCrossPlot*>( plot ) )
{
crossPlots.push_back( xPlot );
continue;
}
auto vfpPlot = dynamic_cast<RimVfpPlot*>( plot );
if ( vfpPlot )
if ( auto vfpPlot = dynamic_cast<RimVfpPlot*>( plot ) )
{
vfpPlots.push_back( vfpPlot );
continue;
}
if ( auto depthTrack = dynamic_cast<RimWellLogTrack*>( 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<RimPlot*>& selection )
void RicShowPlotDataFeature::getSelection( std::vector<RimPlotWindow*>& selection )
{
if ( sender() )
{
QVariant userData = this->userData();
if ( !userData.isNull() && userData.canConvert<void*>() )
{
RimPlot* plot = static_cast<RimPlot*>( userData.value<void*>() );
auto* plot = static_cast<RimPlotWindow*>( userData.value<void*>() );
if ( plot ) selection.push_back( plot );
}
}

View File

@ -20,11 +20,10 @@
#include "cafCmdFeature.h"
#include <functional>
#include <vector>
class RiuTabbedTextProvider;
class RimPlot;
class RimPlotWindow;
//==================================================================================================
///
@ -39,7 +38,7 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
void getSelection( std::vector<RimPlot*>& selection );
void getSelection( std::vector<RimPlotWindow*>& selection );
public:
static void showTabbedTextWindow( RiuTabbedTextProvider* textProvider );

View File

@ -1061,7 +1061,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
out += QString::number( curveDepth, 'f', 3 );
for ( std::vector<double> plotVector : curvesPlotXValues )
{
out += " \t" + QString::number( plotVector[i], 'g' );
out += QString( " %1" ).arg( QString::number( plotVector[i], 'f', 3 ), 12 );
}
out += "\n";
}