mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3090 Add delete of sub items of RimWellPathFractureCollection
This commit is contained in:
parent
29dd2cd093
commit
2ccdab12c3
@ -18,19 +18,18 @@
|
||||
|
||||
#include "RicDeleteSubItemsFeature.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
|
||||
#include "cafPdmUiItem.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature");
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,21 +62,39 @@ void RicDeleteSubItemsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if (!RicDeleteSubItemsFeature::hasDeletableSubItems(item)) continue;
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = dynamic_cast<RimSummaryPlotCollection*>(item);
|
||||
if (summaryPlotColl)
|
||||
{
|
||||
summaryPlotColl->summaryPlots.deleteAllChildObjects();
|
||||
auto collection = dynamic_cast<RimSummaryPlotCollection*>(item);
|
||||
if (collection)
|
||||
{
|
||||
collection->summaryPlots.deleteAllChildObjects();
|
||||
|
||||
summaryPlotColl->updateConnectedEditors();
|
||||
collection->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(item);
|
||||
if (wellPathColl)
|
||||
{
|
||||
wellPathColl->deleteAllWellPaths();
|
||||
auto collection = dynamic_cast<RimWellPathCollection*>(item);
|
||||
if (collection)
|
||||
{
|
||||
collection->deleteAllWellPaths();
|
||||
|
||||
wellPathColl->updateConnectedEditors();
|
||||
wellPathColl->scheduleRedrawAffectedViews();
|
||||
collection->updateConnectedEditors();
|
||||
collection->scheduleRedrawAffectedViews();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto collection = dynamic_cast<RimWellPathFractureCollection*>(item);
|
||||
if (collection)
|
||||
{
|
||||
collection->deleteFractures();
|
||||
|
||||
collection->updateConnectedEditors();
|
||||
|
||||
RimProject* proj = nullptr;
|
||||
collection->firstAncestorOrThisOfType(proj);
|
||||
if (proj) proj->reloadCompletionTypeResultsInAllViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,17 +113,29 @@ void RicDeleteSubItemsFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteSubItemsFeature::hasDeletableSubItems(caf::PdmUiItem* uiItem)
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = dynamic_cast<RimSummaryPlotCollection*>(uiItem);
|
||||
if (summaryPlotColl && summaryPlotColl->summaryPlots().size() > 0)
|
||||
{
|
||||
auto collection = dynamic_cast<RimSummaryPlotCollection*>(uiItem);
|
||||
if (collection && !collection->summaryPlots().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(uiItem);
|
||||
if (wellPathColl && wellPathColl->wellPaths().size() > 0)
|
||||
{
|
||||
auto collection = dynamic_cast<RimWellPathCollection*>(uiItem);
|
||||
if (collection && !collection->wellPaths().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto collection = dynamic_cast<RimWellPathFractureCollection*>(uiItem);
|
||||
if (collection && !collection->fractures().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user