#3255 Replace code that duplicates functionality in caf::SelectionManager

This commit is contained in:
Gaute Lindkvist
2018-08-22 12:04:42 +02:00
parent 12202fe4e6
commit 445e134d49
7 changed files with 18 additions and 55 deletions

View File

@@ -42,17 +42,6 @@
#include "cafSelectionManager.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicWellLogTools::selectedWellLogPlotTrack()
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -74,35 +63,6 @@ RimSimWellInView* RicWellLogTools::selectedSimulationWell(int *branchIndex)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::selectedWellPath()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::findWellPathFromSelection()
{
std::vector<caf::PdmObject*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)
{
caf::PdmObject* firstSelection = selection[0];
RimWellPath* wellPath;
firstSelection->firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
return wellPath;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
@@ -195,7 +155,7 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
{
RimWellPath* wellPath = findWellPathFromSelection();
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if (wellPath->wellLogFiles().size() > 0)
{
return wellPath;