mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
#13484 Auto-import PVD surfaces for command line and replace case
Extract auto-import logic into public static method importPvdSurfacesForGridFiles() and call it from: - Command line case loading (--case argument) - Replace case menu action
This commit is contained in:
1 parent
24be78f105
commit
079372ea85
4 files changed
+29
-5
No files matched your search
@@ -44,6 +44,7 @@
|
||||
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotViewToFileFeature.h"
|
||||
#include "EclipseCommands/RicImportEclipseCaseFeature.h"
|
||||
#include "HoloLensCommands/RicHoloLensSessionManager.h"
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||
@@ -813,6 +814,9 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
|
||||
{
|
||||
getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
// Auto-import matching PVD surface files for command-line loaded cases
|
||||
RicImportEclipseCaseFeature::importPvdSurfacesForGridFiles( fileNames, {} );
|
||||
}
|
||||
|
||||
if ( cvf::Option o = progOpt->option( "savesnapshots" ) )
|
||||
|
||||
@@ -77,9 +77,18 @@ void RicImportEclipseCaseFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
// Auto-import matching PVD surface files
|
||||
importPvdSurfacesForGridFiles( fileNames, allViewsBefore );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportEclipseCaseFeature::importPvdSurfacesForGridFiles( const QStringList& gridFileNames,
|
||||
const std::vector<RimEclipseView*>& viewsBeforeImport )
|
||||
{
|
||||
if ( RimSurfaceCollection* surfColl = RimTools::surfaceCollection() )
|
||||
{
|
||||
QStringList pvdFilesToImport = findPvdFilesToImport( fileNames );
|
||||
QStringList pvdFilesToImport = findPvdFilesToImport( gridFileNames );
|
||||
|
||||
if ( !pvdFilesToImport.isEmpty() )
|
||||
{
|
||||
@@ -100,6 +109,7 @@ void RicImportEclipseCaseFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
// Enable newly imported surfaces in new views, disable them in old views
|
||||
RimProject* project = RimProject::current();
|
||||
if ( project && !newlyImportedSurfaces.empty() )
|
||||
{
|
||||
// Process all views (both old and new)
|
||||
@@ -110,7 +120,8 @@ void RicImportEclipseCaseFeature::onActionTriggered( bool isChecked )
|
||||
if ( RimSurfaceInViewCollection* surfInViewColl = view->surfaceInViewCollection() )
|
||||
{
|
||||
// Check if this is a new view or an existing view
|
||||
bool isNewView = std::find( allViewsBefore.begin(), allViewsBefore.end(), view ) == allViewsBefore.end();
|
||||
bool isNewView =
|
||||
std::find( viewsBeforeImport.begin(), viewsBeforeImport.end(), view ) == viewsBeforeImport.end();
|
||||
|
||||
// Get all surface-in-view objects
|
||||
auto allSurfacesInView = surfInViewColl->descendantsIncludingThisOfType<RimSurfaceInView>();
|
||||
|
||||
@@ -31,10 +31,13 @@ class RicImportEclipseCaseFeature : public RicImportGeneralDataFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void importPvdSurfacesForGridFiles( const QStringList& gridFileNames,
|
||||
const std::vector<RimEclipseView*>& viewsBeforeImport );
|
||||
static std::vector<RimEclipseView*> allEclipseViews( RimProject* project );
|
||||
static QStringList findPvdFilesToImport( const QStringList& fileNames );
|
||||
|
||||
protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
static std::vector<RimEclipseView*> allEclipseViews( RimProject* project );
|
||||
static QStringList findPvdFilesToImport( const QStringList& fileNames );
|
||||
};
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "Summary/RiaSummaryTools.h"
|
||||
|
||||
#include "EclipseCommands/RicImportEclipseCaseFeature.h"
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
@@ -91,6 +92,11 @@ void RicReplaceCaseFeature::onActionTriggered( bool isChecked )
|
||||
QFileInfo fileInfoNew( fileName );
|
||||
eclipseResultCase->setCaseUserDescription( fileInfoNew.baseName() );
|
||||
|
||||
// Auto-import matching PVD surface files for the replaced case
|
||||
QStringList gridFileNames;
|
||||
gridFileNames << fileName;
|
||||
RicImportEclipseCaseFeature::importPvdSurfacesForGridFiles( gridFileNames, {} );
|
||||
|
||||
RiaEclipseFileNameTools helper( fileName );
|
||||
auto summaryFileNames = helper.findSummaryFileCandidates();
|
||||
if ( summaryCase && !summaryFileNames.empty() )
|
||||
|
||||
Reference in new issue
Block a user