Select last imported wellPath on import, not last wellPath in collection

This commit is contained in:
Rebecca Cox
2017-11-12 21:57:25 +01:00
parent 3e40331c5b
commit a4484579e2
3 changed files with 19 additions and 2 deletions

View File

@@ -70,8 +70,16 @@ void RicWellPathsImportFileFeature::onActionTriggered(bool isChecked)
if (oilField->wellPathCollection->wellPaths().size() > 0) if (oilField->wellPathCollection->wellPaths().size() > 0)
{ {
RimWellPath* wellPath = oilField->wellPathCollection->wellPaths()[oilField->wellPathCollection->wellPaths().size() - 1];
RiuMainWindow::instance()->selectAsCurrentItem(wellPath); RimWellPath* wellPath = nullptr;
QString wellPathName = oilField->wellPathCollection->newestAddedWellName();
wellPath = oilField->wellPathCollection->wellPathByName(wellPathName);
if (wellPath)
{
RiuMainWindow::instance()->selectAsCurrentItem(wellPath);
}
} }
} }
} }

View File

@@ -96,6 +96,7 @@ RimWellPathCollection::RimWellPathCollection()
wellPaths.uiCapability()->setUiHidden(true); wellPaths.uiCapability()->setUiHidden(true);
m_wellPathImporter = new RifWellPathImporter; m_wellPathImporter = new RifWellPathImporter;
m_newestAddedWellName = QString();
} }
@@ -273,6 +274,11 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellP
progress.incrementProgress(); progress.incrementProgress();
} }
if (!wellPathArray.empty())
{
m_newestAddedWellName = wellPathArray.back()->name();
}
this->sortWellsByName(); this->sortWellsByName();
} }

View File

@@ -66,6 +66,8 @@ public:
void setProject(RimProject* project); void setProject(RimProject* project);
QString newestAddedWellName() { return m_newestAddedWellName; }
enum WellVisibilityType enum WellVisibilityType
{ {
FORCE_ALL_OFF, FORCE_ALL_OFF,
@@ -129,4 +131,5 @@ private:
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath(const RimWellPath* wellPath); RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath(const RimWellPath* wellPath);
RifWellPathImporter* m_wellPathImporter; RifWellPathImporter* m_wellPathImporter;
QString m_newestAddedWellName;
}; };