mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-14 09:22:13 -05:00
#3528 Allow deleting of the whole casing design table.
This commit is contained in:
1 parent
9abbdb2fd8
commit
b316aff35a
4 files changed
+50
-11
No files matched your search
@@ -42,6 +42,13 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled()
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -53,24 +60,32 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPathAttribute*> attributes;
|
||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
||||
if (attributes.size() > 0)
|
||||
{
|
||||
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
||||
{
|
||||
attributes[0]->firstAncestorOrThisOfTypeAsserted(wellPathAttributeCollection);
|
||||
for (RimWellPathAttribute* attributeToDelete : attributes)
|
||||
{
|
||||
wellPathAttributeCollection->deleteAttribute(attributeToDelete);
|
||||
}
|
||||
wellPathAttributeCollection->updateAllRequiredEditors();
|
||||
|
||||
if (wellPathAttributeCollection->attributes().empty())
|
||||
}
|
||||
else
|
||||
{
|
||||
wellPathAttributeCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>();
|
||||
if (wellPathAttributeCollection)
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
wellPathAttributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
wellPath->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(wellPath);
|
||||
wellPathAttributeCollection->deleteAllAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
if (wellPathAttributeCollection->attributes().empty())
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
wellPathAttributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
wellPath->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(wellPath);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,6 +93,16 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteWellPathAttributeFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete Attribute");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
std::vector<RimWellPathAttribute*> attributes;
|
||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||
if (attributes.size() > 0)
|
||||
{
|
||||
actionToSetup->setText("Delete Attribute");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
else if (caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>())
|
||||
{
|
||||
actionToSetup->setText("Delete Casing Design");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user