Adjustments to UI

* #9551: Guard nullpointer if no RFT data is present
* Hide RFT in tree view if no RFT file is found
* Avoid display of 3d main window when importing a summary case
* Use specific grid import feature instead of general file import feature
This commit is contained in:
Magne Sjaastad 2022-12-09 08:47:40 +01:00 committed by GitHub
parent 5ec32f8613
commit 7cb6c587c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 48 deletions

View File

@ -75,6 +75,6 @@ void RicImportEclipseCaseFeature::onActionTriggered( bool isChecked )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicImportEclipseCaseFeature::setupActionLook( QAction* actionToSetup ) void RicImportEclipseCaseFeature::setupActionLook( QAction* actionToSetup )
{ {
actionToSetup->setIcon( QIcon( ":/Case48x48.png" ) ); actionToSetup->setIcon( QIcon( ":/Case.svg" ) );
actionToSetup->setText( "Import Eclipse Case" ); actionToSetup->setText( "Import Eclipse Case" );
} }

View File

@ -201,10 +201,9 @@ QStringList RicImportGeneralDataFeature::getEclipseFileNamesWithDialog( RiaDefin
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectory( defaultDirectoryLabel( fileType ) ); QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectory( defaultDirectoryLabel( fileType ) );
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(), // Use nullptr as parent to this dialog, as this function is called from both plot window and main window
"Import Data File", QStringList fileNames = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Data File", defaultDir, fullPattern );
defaultDir,
fullPattern );
return fileNames; return fileNames;
} }

View File

@ -475,19 +475,21 @@ RimWellLogCurve* RicWellLogTools::addSummaryRftCurve( RimWellLogTrack* plotTrack
curve->setSummaryCase( rimCase ); curve->setSummaryCase( rimCase );
auto rftReader = rimCase->rftReader(); auto rftReader = rimCase->rftReader();
if ( rftReader )
{
QString wellName;
auto wellNames = rftReader->wellNames();
if ( !wellNames.empty() ) wellName = *wellNames.begin();
QString wellName; QDateTime dateTime;
auto wellNames = rftReader->wellNames();
if ( !wellNames.empty() ) wellName = *wellNames.begin();
QDateTime dateTime; auto timeSteps = rftReader->availableTimeSteps( wellName );
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
auto timeSteps = rftReader->availableTimeSteps( wellName ); RifEclipseRftAddress adr =
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin(); RifEclipseRftAddress::createAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
curve->setRftAddress( adr );
RifEclipseRftAddress adr = }
RifEclipseRftAddress::createAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
curve->setRftAddress( adr );
plotTrack->addCurve( curve ); plotTrack->addCurve( curve );
@ -506,20 +508,23 @@ RimWellLogRftCurve* RicWellLogTools::addSummaryRftSegmentCurve( RimWellLogTrack*
auto curve = new RimWellLogRftCurve(); auto curve = new RimWellLogRftCurve();
curve->setSummaryCase( rimCase ); curve->setSummaryCase( rimCase );
auto rftReader = rimCase->rftReader(); auto rftReader = rimCase->rftReader();
if ( rftReader )
{
QDateTime dateTime;
QDateTime dateTime; auto timeSteps = rftReader->availableTimeSteps( wellName );
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
auto timeSteps = rftReader->availableTimeSteps( wellName ); RifEclipseRftAddress adr =
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin(); RifEclipseRftAddress::createBranchSegmentAddress( wellName, dateTime, resultName, 1, branchType );
curve->setRftAddress( adr );
curve->assignColorFromResultName( resultName );
curve->setLineThickness( 4 );
RifEclipseRftAddress adr = curve->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );
RifEclipseRftAddress::createBranchSegmentAddress( wellName, dateTime, resultName, 1, branchType ); }
curve->setRftAddress( adr );
curve->assignColorFromResultName( resultName );
curve->setLineThickness( 4 );
curve->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );
plotTrack->addCurve( curve ); plotTrack->addCurve( curve );
@ -535,6 +540,7 @@ bool RicWellLogTools::hasData( const QString& resultName,
RimSummaryCase* rimCase ) RimSummaryCase* rimCase )
{ {
auto rftReader = rimCase->rftReader(); auto rftReader = rimCase->rftReader();
if ( rftReader ) return false;
QDateTime dateTime; QDateTime dateTime;

View File

@ -24,6 +24,7 @@
#include "RicWellLogTools.h" #include "RicWellLogTools.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaPlotWindowRedrawScheduler.h" #include "RiaPlotWindowRedrawScheduler.h"
#include "RiaRftDefines.h" #include "RiaRftDefines.h"
@ -64,16 +65,19 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
rftCase->firstAncestorOfType( summaryCase ); rftCase->firstAncestorOfType( summaryCase );
if ( !summaryCase ) return; if ( !summaryCase ) return;
auto rftReader = summaryCase->rftReader();
if ( !rftReader )
{
RiaLogging::error( "Could not open RFT file or no RFT file present. " );
return;
}
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot(); auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
QString wellName = "Unknown"; QString wellName = "Unknown";
auto rftReader = summaryCase->rftReader(); auto wellNames = rftReader->wellNames();
if ( rftReader ) if ( !wellNames.empty() ) wellName = *wellNames.begin();
{
auto wellNames = rftReader->wellNames();
if ( !wellNames.empty() ) wellName = *wellNames.begin();
}
appendTrackAndCurveForBranchType( plot, appendTrackAndCurveForBranchType( plot,
"Connection Rates", "Connection Rates",

View File

@ -24,6 +24,7 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaColorTools.h" #include "RiaColorTools.h"
#include "RiaLogging.h"
#include "RiaPlotWindowRedrawScheduler.h" #include "RiaPlotWindowRedrawScheduler.h"
#include "RiaRftDefines.h" #include "RiaRftDefines.h"
@ -64,16 +65,18 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
rftCase->firstAncestorOfType( summaryCase ); rftCase->firstAncestorOfType( summaryCase );
if ( !summaryCase ) return; if ( !summaryCase ) return;
auto rftReader = summaryCase->rftReader();
if ( !rftReader )
{
RiaLogging::error( "Could not open RFT file or no RFT file present. " );
return;
}
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot(); auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
QString wellName = "Unknown"; QString wellName = "Unknown";
auto wellNames = rftReader->wellNames();
auto rftReader = summaryCase->rftReader(); if ( !wellNames.empty() ) wellName = *wellNames.begin();
if ( rftReader )
{
auto wellNames = rftReader->wellNames();
if ( !wellNames.empty() ) wellName = *wellNames.begin();
}
{ {
RimWellLogTrack* plotTrack = new RimWellLogTrack(); RimWellLogTrack* plotTrack = new RimWellLogTrack();
@ -197,15 +200,14 @@ void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* pl
const QString& wellName, const QString& wellName,
RimSummaryCase* summaryCase ) RimSummaryCase* summaryCase )
{ {
auto rftReader = dynamic_cast<RifReaderOpmRft*>( summaryCase->rftReader() );
if ( !rftReader ) return;
QDateTime dateTime; QDateTime dateTime;
int branchIndex = 1; int branchIndex = 1;
auto rftReader = dynamic_cast<RifReaderOpmRft*>( summaryCase->rftReader() ); auto timeSteps = rftReader->availableTimeSteps( wellName );
if ( rftReader ) if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
{
auto timeSteps = rftReader->availableTimeSteps( wellName );
if ( !timeSteps.empty() ) dateTime = *timeSteps.rbegin();
}
auto track = new RimWellLogTrack(); auto track = new RimWellLogTrack();
track->setDescription( "Topology" ); track->setDescription( "Topology" );

View File

@ -269,7 +269,12 @@ void RimFileSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field
void RimFileSummaryCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= "" */ ) void RimFileSummaryCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= "" */ )
{ {
RimSummaryCase::defineUiTreeOrdering( uiTreeOrdering, uiConfigName ); RimSummaryCase::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
uiTreeOrdering.add( m_rftCase() );
if ( rftReader() )
{
uiTreeOrdering.add( m_rftCase() );
}
uiTreeOrdering.skipRemainingChildren();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -594,7 +594,7 @@ void RiuMainWindow::createToolBars()
{ {
QToolBar* toolbar = addToolBar( tr( "Standard" ) ); QToolBar* toolbar = addToolBar( tr( "Standard" ) );
toolbar->setObjectName( toolbar->windowTitle() ); toolbar->setObjectName( toolbar->windowTitle() );
toolbar->addAction( cmdFeatureMgr->action( "RicImportGeneralDataFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicImportEclipseCaseFeature" ) );
toolbar->addAction( cmdFeatureMgr->action( "RicOpenProjectFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicOpenProjectFeature" ) );
toolbar->addAction( cmdFeatureMgr->action( "RicSaveProjectFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicSaveProjectFeature" ) );
} }

View File

@ -405,7 +405,7 @@ QStringList RiuPlotMainWindow::toolbarCommandIds( const QString& toolbarName )
if ( toolbarName.isEmpty() || toolbarName == "Standard" ) if ( toolbarName.isEmpty() || toolbarName == "Standard" )
{ {
commandIds << "RicImportGeneralDataFeature"; commandIds << "RicImportEclipseCaseFeature";
commandIds << "RicImportSummaryCaseFeature"; commandIds << "RicImportSummaryCaseFeature";
commandIds << "RicImportEnsembleFeature"; commandIds << "RicImportEnsembleFeature";
commandIds << "RicOpenProjectFeature"; commandIds << "RicOpenProjectFeature";