mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5106 Fix crash when importing multiple well paths with the same name
This commit is contained in:
parent
c5f21b75fa
commit
538e42f278
@ -316,7 +316,7 @@ bool RiaApplication::openFile( const QString& fileName )
|
|||||||
}
|
}
|
||||||
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
|
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
|
||||||
{
|
{
|
||||||
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
|
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{ fileName }, true );
|
||||||
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
|
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -849,8 +849,8 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Add a list of well path file paths (JSON files) to the well path collection
|
/// Add a list of well path file paths (JSON files) to the well path collection
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimFileWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths,
|
std::vector<RimWellPath*> RiaApplication::addWellPathsToModel( QList<QString> wellPathFilePaths,
|
||||||
QStringList* errorMessages )
|
QStringList* errorMessages )
|
||||||
{
|
{
|
||||||
CAF_ASSERT( errorMessages );
|
CAF_ASSERT( errorMessages );
|
||||||
|
|
||||||
@ -867,7 +867,7 @@ std::vector<RimFileWellPath*> RiaApplication::addWellPathsToModel( QList<QString
|
|||||||
m_project->updateConnectedEditors();
|
m_project->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RimFileWellPath*> wellPaths;
|
std::vector<RimWellPath*> wellPaths;
|
||||||
if ( oilField->wellPathCollection )
|
if ( oilField->wellPathCollection )
|
||||||
{
|
{
|
||||||
wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, errorMessages );
|
wellPaths = oilField->wellPathCollection->addWellPaths( wellPathFilePaths, errorMessages );
|
||||||
|
@ -54,7 +54,7 @@ class RigEclipseCaseData;
|
|||||||
class RimCommandObject;
|
class RimCommandObject;
|
||||||
class RimEclipseCase;
|
class RimEclipseCase;
|
||||||
class RimEclipseView;
|
class RimEclipseView;
|
||||||
class RimFileWellPath;
|
class RimWellPath;
|
||||||
class RimGridView;
|
class RimGridView;
|
||||||
class RimProject;
|
class RimProject;
|
||||||
class RimSummaryPlot;
|
class RimSummaryPlot;
|
||||||
@ -144,8 +144,8 @@ public:
|
|||||||
|
|
||||||
bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false );
|
bool openOdbCaseFromFile( const QString& fileName, bool applyTimeStepFilter = false );
|
||||||
|
|
||||||
std::vector<RimFileWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths, QStringList* errorMessages );
|
std::vector<RimWellPath*> addWellPathsToModel( QList<QString> wellPathFilePaths, QStringList* errorMessages );
|
||||||
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
|
void addWellPathFormationsToModel( QList<QString> wellPathFilePaths );
|
||||||
std::vector<RimWellLogFile*> addWellLogsToModel( const QList<QString>& wellLogFilePaths, QStringList* errorMessages );
|
std::vector<RimWellLogFile*> addWellLogsToModel( const QList<QString>& wellLogFilePaths, QStringList* errorMessages );
|
||||||
|
|
||||||
QString scriptDirectories() const;
|
QString scriptDirectories() const;
|
||||||
|
@ -103,11 +103,11 @@ RicfCommandResponse RicImportWellPaths::execute()
|
|||||||
RicfCommandResponse response;
|
RicfCommandResponse response;
|
||||||
if ( !wellPathFiles.empty() )
|
if ( !wellPathFiles.empty() )
|
||||||
{
|
{
|
||||||
std::vector<RimFileWellPath*> importedWellPaths = importWellPaths( wellPathFiles, &warningMessages );
|
std::vector<RimWellPath*> importedWellPaths = importWellPaths( wellPathFiles, &warningMessages );
|
||||||
if ( !importedWellPaths.empty() )
|
if ( !importedWellPaths.empty() )
|
||||||
{
|
{
|
||||||
RicImportWellPathsResult* wellPathsResult = new RicImportWellPathsResult;
|
RicImportWellPathsResult* wellPathsResult = new RicImportWellPathsResult;
|
||||||
for ( RimFileWellPath* wellPath : importedWellPaths )
|
for ( RimWellPath* wellPath : importedWellPaths )
|
||||||
{
|
{
|
||||||
wellPathsResult->wellPathNames.v().push_back( wellPath->name() );
|
wellPathsResult->wellPathNames.v().push_back( wellPath->name() );
|
||||||
}
|
}
|
||||||
@ -136,15 +136,15 @@ RicfCommandResponse RicImportWellPaths::execute()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimFileWellPath*> RicImportWellPaths::importWellPaths( const QStringList& wellPathFilePaths,
|
std::vector<RimWellPath*> RicImportWellPaths::importWellPaths( const QStringList& wellPathFilePaths,
|
||||||
QStringList* errorMessages )
|
QStringList* errorMessages )
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
|
||||||
// Remember the path to next time
|
// Remember the path to next time
|
||||||
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
|
app->setLastUsedDialogDirectory( "WELLPATH_DIR", QFileInfo( wellPathFilePaths.last() ).absolutePath() );
|
||||||
|
|
||||||
std::vector<RimFileWellPath*> wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages );
|
std::vector<RimWellPath*> wellPaths = app->addWellPathsToModel( wellPathFilePaths, errorMessages );
|
||||||
|
|
||||||
RimProject* project = app->project();
|
RimProject* project = app->project();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RimFileWellPath;
|
class RimWellPath;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -43,9 +43,8 @@ public:
|
|||||||
RicfCommandResponse execute() override;
|
RicfCommandResponse execute() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static std::vector<RimFileWellPath*> importWellPaths( const QStringList& wellPathFilePaths,
|
static std::vector<RimWellPath*> importWellPaths( const QStringList& wellPathFilePaths, QStringList* errorMessages );
|
||||||
QStringList* errorMessages );
|
static QStringList wellPathNameFilters();
|
||||||
static QStringList wellPathNameFilters();
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
|
@ -202,7 +202,7 @@ void RimWellPathCollection::loadDataAndUpdate()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList filePaths, QStringList* errorMessages )
|
std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList filePaths, QStringList* errorMessages )
|
||||||
{
|
{
|
||||||
CAF_ASSERT( errorMessages );
|
CAF_ASSERT( errorMessages );
|
||||||
|
|
||||||
@ -259,11 +259,12 @@ std::vector<RimFileWellPath*> RimWellPathCollection::addWellPaths( QStringList f
|
|||||||
}
|
}
|
||||||
|
|
||||||
readAndAddWellPaths( wellPathArray );
|
readAndAddWellPaths( wellPathArray );
|
||||||
|
CAF_ASSERT( wellPathArray.empty() );
|
||||||
|
|
||||||
scheduleRedrawAffectedViews();
|
scheduleRedrawAffectedViews();
|
||||||
updateAllRequiredEditors();
|
updateAllRequiredEditors();
|
||||||
|
|
||||||
return wellPathArray;
|
return wellPaths.childObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -304,7 +305,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
|||||||
|
|
||||||
progress.incrementProgress();
|
progress.incrementProgress();
|
||||||
}
|
}
|
||||||
|
wellPathArray.clear(); // This should not be used again. We may have deleted items
|
||||||
this->sortWellsByName();
|
this->sortWellsByName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ public:
|
|||||||
|
|
||||||
caf::PdmChildArrayField<RimWellPath*> wellPaths;
|
caf::PdmChildArrayField<RimWellPath*> wellPaths;
|
||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
std::vector<RimFileWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
|
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
|
||||||
|
|
||||||
void removeWellPath( RimWellPath* wellPath );
|
void removeWellPath( RimWellPath* wellPath );
|
||||||
void deleteAllWellPaths();
|
void deleteAllWellPaths();
|
||||||
|
Loading…
Reference in New Issue
Block a user