Select newest RimWellPath on import of formations and well paths

This commit is contained in:
Rebecca Cox 2017-11-29 08:42:37 +01:00
parent d2e590875d
commit e89d2c0717
4 changed files with 21 additions and 24 deletions

View File

@ -67,16 +67,11 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered(bool isChecked)
project->createDisplayModelAndRedrawAllViews();
RimOilField* oilField = project->activeOilField();
if (!oilField)
return;
if (!oilField) return;
if (oilField->wellPathCollection->wellPaths().size() > 0)
{
RimWellPath* wellPath = nullptr;
QString wellPathName = oilField->wellPathCollection->newestAddedWellName();
wellPath = oilField->wellPathCollection->wellPathByName(wellPathName);
RimWellPath* wellPath = oilField->wellPathCollection->newestAddedWellPath();
if (wellPath)
{
RiuMainWindow::instance()->selectAsCurrentItem(wellPath);

View File

@ -70,12 +70,7 @@ void RicWellPathsImportFileFeature::onActionTriggered(bool isChecked)
if (oilField->wellPathCollection->wellPaths().size() > 0)
{
RimWellPath* wellPath = nullptr;
QString wellPathName = oilField->wellPathCollection->newestAddedWellName();
wellPath = oilField->wellPathCollection->wellPathByName(wellPathName);
RimWellPath* wellPath = oilField->wellPathCollection->newestAddedWellPath();
if (wellPath)
{
RiuMainWindow::instance()->selectAsCurrentItem(wellPath);

View File

@ -99,8 +99,8 @@ RimWellPathCollection::RimWellPathCollection()
wellPaths.uiCapability()->setUiHidden(true);
m_wellPathImporter = new RifWellPathImporter;
m_newestAddedWellName = QString();
m_wellPathFormationsImporter = new RifWellPathFormationsImporter;
m_newestAddedWellPath = nullptr;
}
@ -249,11 +249,6 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellP
interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wellPathArray.size());
}
if (!wellPathArray.empty())
{
m_newestAddedWellName = wellPathArray.back()->name();
}
for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++)
{
RimWellPath* wellPath = wellPathArray[wpIdx];
@ -284,6 +279,11 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellP
progress.incrementProgress();
}
if (!wellPaths.empty())
{
m_newestAddedWellPath = wellPaths[wellPaths.size() - 1];
}
this->sortWellsByName();
}
@ -319,7 +319,6 @@ RimWellLogFile* RimWellPathCollection::addWellLogs(const QStringList& filePaths)
}
wellPath->addWellLogFile(logFileInfo);
m_newestAddedWellName = wellPath->name();
}
}
@ -348,7 +347,7 @@ void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths)
wellPaths.push_back(wellPath);
}
wellPath->setFormationsGeometry(it->second);
m_newestAddedWellName = wellPath->name();
m_newestAddedWellPath = wellPath;
}
}
@ -494,6 +493,14 @@ void RimWellPathCollection::deleteAllWellPaths()
m_wellPathImporter->clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellPathCollection::newestAddedWellPath()
{
return m_newestAddedWellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -66,8 +66,6 @@ public:
void setProject(RimProject* project);
QString newestAddedWellName() { return m_newestAddedWellName; }
enum WellVisibilityType
{
FORCE_ALL_OFF,
@ -95,6 +93,8 @@ public:
void removeWellPath(RimWellPath* wellPath);
void deleteAllWellPaths();
RimWellPath* newestAddedWellPath();
void readWellPathFormationFiles();
RimWellPath* wellPathByName(const QString& wellPathName) const;
@ -135,5 +135,5 @@ private:
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
QString m_newestAddedWellName;
caf::PdmPointer<RimWellPath> m_newestAddedWellPath;
};