(#435) Fixed reading well path files for existing well logs with the same well name

This commit is contained in:
Pål Hagen 2015-09-15 11:49:09 +02:00
parent 7efd3daa8b
commit a6cb14244d
2 changed files with 42 additions and 3 deletions

View File

@ -148,6 +148,8 @@ void RimWellPathCollection::readWellPathFiles()
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::addWellPaths( QStringList filePaths )
{
std::vector<RimWellPath*> wellPathArray;
foreach (QString filePath, filePaths)
{
// Check if this file is already open
@ -178,7 +180,7 @@ void RimWellPathCollection::addWellPaths( QStringList filePaths )
wellPath->setProject(m_project);
wellPath->setCollection(this);
wellPath->filepath = filePath;
wellPaths.push_back(wellPath);
wellPathArray.push_back(wellPath);
}
else
{
@ -191,15 +193,50 @@ void RimWellPathCollection::addWellPaths( QStringList filePaths )
wellPath->setCollection(this);
wellPath->filepath = filePath;
wellPath->wellPathIndexInFile = static_cast<int>(i);
wellPaths.push_back(wellPath);
wellPathArray.push_back(wellPath);
}
}
}
}
readWellPathFiles();
readAndAddWellPaths(wellPathArray);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray)
{
caf::ProgressInfo progress(wellPathArray.size(), "Reading well paths from file");
for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++)
{
RimWellPath* wellPath = wellPathArray[wpIdx];
wellPath->readWellPathFile();
progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name));
// If a well path with this name exists already, make it read the well path file
RimWellPath* existingWellPath = wellPathByName(wellPath->name);
if (existingWellPath)
{
existingWellPath->filepath = wellPath->filepath;
existingWellPath->wellPathIndexInFile = wellPath->wellPathIndexInFile;
existingWellPath->readWellPathFile();
delete wellPath;
}
else
{
wellPaths.push_back(wellPath);
}
progress.incrementProgress();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -94,6 +94,8 @@ private:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
virtual caf::PdmFieldHandle* objectToggleField();
void readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray);
caf::PdmPointer<RimProject> m_project;
cvf::ref<RivWellPathCollectionPartMgr> m_wellPathCollectionPartManager;