Show error message if no flow data is available

This commit is contained in:
Magne Sjaastad 2024-04-25 09:14:24 +02:00
parent a993841671
commit 2b25ac87e7
4 changed files with 30 additions and 12 deletions

View File

@ -19,6 +19,8 @@
#include "RicNewPltPlotFeature.h"
#include "RiaLogging.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
@ -84,6 +86,15 @@ bool RicNewPltPlotFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
{
if ( RimWellPlotTools::wellPathsContainingFlow().empty() )
{
QString displayMessage =
"To create a PLT plot, either import a LAS file with observed production data or import a well path trajectory.";
RiaLogging::errorInMessageBox( nullptr, "No well data available to create a PLT plot", displayMessage );
return;
}
RimPltPlotCollection* pltPlotColl = RimMainPlotCollection::current()->pltPlotCollection();
if ( pltPlotColl )
{
@ -116,7 +127,6 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
pltPlot->nameConfig()->setCustomName( plotName );
pltPlot->setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM );
// pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors();

View File

@ -705,6 +705,20 @@ RimWellPath* RimWellPlotTools::wellPathByWellPathNameOrSimWellName( const QStrin
return wellPath != nullptr ? wellPath : proj->wellPathFromSimWellName( wellPathNameOrSimwellName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimWellPlotTools::wellPathsContainingFlow()
{
std::vector<RimWellPath*> wellPaths;
for ( RimWellPath* wellPath : RimProject::current()->allWellPaths() )
{
if ( wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData( wellPath ) ) wellPaths.push_back( wellPath );
}
return wellPaths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -77,6 +77,7 @@ public:
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow( const QString& wellName );
static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName );
static std::vector<RimWellPath*> wellPathsContainingFlow();
// RFT Only
private:

View File

@ -1031,18 +1031,11 @@ void RimWellPltPlot::syncSourcesIoFieldFromGuiField()
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options )
{
RimProject* proj = RimProject::current();
if ( proj != nullptr )
auto wellPathsContainingFlowData = RimWellPlotTools::wellPathsContainingFlow();
for ( const RimWellPath* const wellPath : wellPathsContainingFlowData )
{
// Observed wells
for ( const RimWellPath* const wellPath : proj->allWellPaths() )
{
const QString wellName = wellPath->name();
if ( wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData( wellPath ) )
options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
}
const QString wellName = wellPath->name();
options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
}
options.push_back( caf::PdmOptionItemInfo( "None", "" ) );