Well path delete command supports multi selection

This commit is contained in:
Magne Sjaastad
2017-02-23 08:42:27 +01:00
parent 8eb8a6fd3b
commit dc886b7e9c
2 changed files with 20 additions and 9 deletions

View File

@@ -29,6 +29,7 @@
namespace caf
{
CAF_CMD_SOURCE_INIT(RicWellPathDeleteFeature, "RicWellPathDeleteFeature");
@@ -40,7 +41,7 @@ bool RicWellPathDeleteFeature::isCommandEnabled()
std::vector<RimWellPath*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
if (objects.size() > 0)
{
return true;
}
@@ -58,13 +59,17 @@ void RicWellPathDeleteFeature::onActionTriggered(bool isChecked)
if (objects.size() == 0) return;
RimWellPath* wellPath = objects[0];
RimWellPath* firstWellPath = objects[0];
RimWellPathCollection* wellPathCollection = NULL;
wellPath->firstAncestorOrThisOfType(wellPathCollection);
RimWellPathCollection* wellPathCollection = nullptr;
firstWellPath->firstAncestorOrThisOfType(wellPathCollection);
if (!wellPathCollection) return;
wellPathCollection->removeWellPath(wellPath);;
delete wellPath;
for (RimWellPath* wellPath : objects)
{
wellPathCollection->removeWellPath(wellPath);;
delete wellPath;
}
wellPathCollection->uiCapability()->updateConnectedEditors();
wellPathCollection->scheduleGeometryRegenAndRedrawViews();
@@ -75,7 +80,7 @@ void RicWellPathDeleteFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicWellPathDeleteFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete Well Path");
actionToSetup->setText("Delete Well Path(s)");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}