mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3528 Allow deleting of the whole casing design table.
This commit is contained in:
parent
9abbdb2fd8
commit
b316aff35a
@ -42,6 +42,13 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
if (caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -53,24 +60,32 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
std::vector<RimWellPathAttribute*> attributes;
|
std::vector<RimWellPathAttribute*> attributes;
|
||||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
||||||
if (attributes.size() > 0)
|
if (attributes.size() > 0)
|
||||||
{
|
{
|
||||||
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
|
||||||
attributes[0]->firstAncestorOrThisOfTypeAsserted(wellPathAttributeCollection);
|
attributes[0]->firstAncestorOrThisOfTypeAsserted(wellPathAttributeCollection);
|
||||||
for (RimWellPathAttribute* attributeToDelete : attributes)
|
for (RimWellPathAttribute* attributeToDelete : attributes)
|
||||||
{
|
{
|
||||||
wellPathAttributeCollection->deleteAttribute(attributeToDelete);
|
wellPathAttributeCollection->deleteAttribute(attributeToDelete);
|
||||||
}
|
}
|
||||||
wellPathAttributeCollection->updateAllRequiredEditors();
|
wellPathAttributeCollection->updateAllRequiredEditors();
|
||||||
|
}
|
||||||
if (wellPathAttributeCollection->attributes().empty())
|
else
|
||||||
|
{
|
||||||
|
wellPathAttributeCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>();
|
||||||
|
if (wellPathAttributeCollection)
|
||||||
{
|
{
|
||||||
RimWellPath* wellPath = nullptr;
|
wellPathAttributeCollection->deleteAllAttributes();
|
||||||
wellPathAttributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
|
||||||
wellPath->updateConnectedEditors();
|
|
||||||
Riu3DMainWindowTools::selectAsCurrentItem(wellPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
void RicDeleteWellPathAttributeFeature::setupActionLook(QAction* actionToSetup)
|
||||||
{
|
{
|
||||||
actionToSetup->setText("Delete Attribute");
|
std::vector<RimWellPathAttribute*> attributes;
|
||||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
#include "RimWellLogPlotCollection.h"
|
#include "RimWellLogPlotCollection.h"
|
||||||
#include "RimWellLogTrack.h"
|
#include "RimWellLogTrack.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
|
#include "RimWellPathAttributeCollection.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimWellPathCollection.h"
|
||||||
#include "RimWellPltPlot.h"
|
#include "RimWellPltPlot.h"
|
||||||
#include "RimWellRftPlot.h"
|
#include "RimWellRftPlot.h"
|
||||||
@ -312,6 +313,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder << "Separator";
|
menuBuilder << "Separator";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (dynamic_cast<RimWellPathAttributeCollection*>(uiItem))
|
||||||
|
{
|
||||||
|
menuBuilder << "RicDeleteWellPathAttributeFeature";
|
||||||
|
}
|
||||||
else if (dynamic_cast<Rim3dWellLogCurveCollection*>(uiItem) ||
|
else if (dynamic_cast<Rim3dWellLogCurveCollection*>(uiItem) ||
|
||||||
dynamic_cast<Rim3dWellLogExtractionCurve*>(uiItem) ||
|
dynamic_cast<Rim3dWellLogExtractionCurve*>(uiItem) ||
|
||||||
dynamic_cast<Rim3dWellLogFileCurve*>(uiItem) ||
|
dynamic_cast<Rim3dWellLogFileCurve*>(uiItem) ||
|
||||||
|
@ -100,6 +100,15 @@ void RimWellPathAttributeCollection::deleteAttribute(RimWellPathAttribute* attri
|
|||||||
this->updateAllReferringTracks();
|
this->updateAllReferringTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathAttributeCollection::deleteAllAttributes()
|
||||||
|
{
|
||||||
|
m_attributes.deleteAllChildObjects();
|
||||||
|
this->updateAllReferringTracks();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
std::vector<RimWellPathAttribute*> attributes() const;
|
std::vector<RimWellPathAttribute*> attributes() const;
|
||||||
void insertAttribute(RimWellPathAttribute* insertBefore, RimWellPathAttribute* attribute);
|
void insertAttribute(RimWellPathAttribute* insertBefore, RimWellPathAttribute* attribute);
|
||||||
void deleteAttribute(RimWellPathAttribute* attributeToDelete);
|
void deleteAttribute(RimWellPathAttribute* attributeToDelete);
|
||||||
|
void deleteAllAttributes();
|
||||||
protected:
|
protected:
|
||||||
void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override;
|
void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override;
|
||||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user