mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor delete operations for pdm objects.
This commit is contained in:
committed by
Magne Sjaastad
parent
80ee1256e7
commit
c366e85682
@@ -20,41 +20,6 @@
|
||||
#include "RicDeleteItemExec.h"
|
||||
#include "RicDeleteItemExecData.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnalysisPlot.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCorrelationPlot.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafNotificationCenter.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmDocument.h"
|
||||
@@ -101,263 +66,7 @@ void RicDeleteItemExec::redo()
|
||||
|
||||
caf::PdmObjectHandle* parentObj = listField->ownerObject();
|
||||
parentObj->uiCapability()->updateConnectedEditors();
|
||||
|
||||
Rim3dView* view = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( view );
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>( view );
|
||||
|
||||
// Range Filters
|
||||
|
||||
RimCellRangeFilterCollection* rangeFilterColl;
|
||||
parentObj->firstAncestorOrThisOfType( rangeFilterColl );
|
||||
|
||||
if ( rangeFilterColl )
|
||||
{
|
||||
rangeFilterColl->updateDisplayModeNotifyManagedViews( nullptr );
|
||||
}
|
||||
|
||||
// Prop Filter
|
||||
|
||||
RimEclipsePropertyFilterCollection* eclipsePropColl;
|
||||
parentObj->firstAncestorOrThisOfType( eclipsePropColl );
|
||||
|
||||
RimGeoMechPropertyFilterCollection* geoMechPropColl;
|
||||
parentObj->firstAncestorOrThisOfType( geoMechPropColl );
|
||||
|
||||
if ( view && ( eclipsePropColl || geoMechPropColl ) )
|
||||
{
|
||||
view->scheduleGeometryRegen( PROPERTY_FILTERED );
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
// Intersections
|
||||
|
||||
RimIntersectionCollection* intersectionColl;
|
||||
parentObj->firstAncestorOrThisOfType( intersectionColl );
|
||||
if ( view && intersectionColl )
|
||||
{
|
||||
intersectionColl->syncronize2dIntersectionViews();
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
RimCase* parentCase = dynamic_cast<RimCase*>( parentObj );
|
||||
if ( parentCase ) // A view was deleted. Need to update the list of intersection views
|
||||
{
|
||||
parentCase->intersectionViewCollection()->syncFromExistingIntersections( true );
|
||||
}
|
||||
}
|
||||
|
||||
// Intersection Result Definitions
|
||||
|
||||
RimIntersectionResultsDefinitionCollection* separateIntersectResDefColl;
|
||||
parentObj->firstAncestorOrThisOfType( separateIntersectResDefColl );
|
||||
if ( gridView && separateIntersectResDefColl )
|
||||
{
|
||||
gridView->scheduleCreateDisplayModelAndRedraw();
|
||||
gridView->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
}
|
||||
|
||||
// SimWell Fractures
|
||||
RimSimWellInView* simWell;
|
||||
parentObj->firstAncestorOrThisOfType( simWell );
|
||||
if ( view && simWell )
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
RimFractureTemplateCollection* fracTemplateColl;
|
||||
parentObj->firstAncestorOrThisOfType( fracTemplateColl );
|
||||
if ( fracTemplateColl )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
{
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
std::vector<Rim3dView*> views;
|
||||
proj->allVisibleViews( views );
|
||||
for ( Rim3dView* visibleView : views )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseView*>( visibleView ) )
|
||||
{
|
||||
visibleView->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Well paths
|
||||
|
||||
RimWellPath* wellPath;
|
||||
parentObj->firstAncestorOrThisOfType( wellPath );
|
||||
|
||||
if ( wellPath )
|
||||
{
|
||||
wellPath->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimWellPathCollection* wellPathColl;
|
||||
parentObj->firstAncestorOrThisOfType( wellPathColl );
|
||||
|
||||
if ( wellPathColl )
|
||||
{
|
||||
wellPathColl->scheduleRedrawAffectedViews();
|
||||
wellPathColl->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
// Update due to deletion of curves (not tracks, handled separatly)
|
||||
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
parentObj->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
wellLogPlot->calculateAvailableDepthRange();
|
||||
wellLogPlot->updateZoom();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
RimWellLogTrack* wellLogPlotTrack;
|
||||
parentObj->firstAncestorOrThisOfType( wellLogPlotTrack );
|
||||
if ( wellLogPlotTrack )
|
||||
{
|
||||
wellLogPlotTrack->setAutoScaleXEnabled( true );
|
||||
wellLogPlotTrack->updateZoomInQwt();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
// Update due to delete plots
|
||||
// Make sure the plot collection disappears with the last plot
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotCollection = dynamic_cast<RimWellLogPlotCollection*>( parentObj );
|
||||
if ( wellLogPlotCollection )
|
||||
{
|
||||
if ( wellLogPlotCollection->wellLogPlots.empty() )
|
||||
{
|
||||
RimProject* project = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( project );
|
||||
if ( project )
|
||||
{
|
||||
project->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
// Linked views
|
||||
|
||||
RimViewLinkerCollection* viewLinkerCollection = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( viewLinkerCollection );
|
||||
if ( viewLinkerCollection )
|
||||
{
|
||||
viewLinkerCollection->uiCapability()->updateConnectedEditors();
|
||||
|
||||
RimProject* project = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( project );
|
||||
if ( project )
|
||||
{
|
||||
// Update visibility of top level Linked Views item in the project tree
|
||||
// Not visible if no views are linked
|
||||
project->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
// Formation names
|
||||
|
||||
RimFormationNamesCollection* formationNamesCollection;
|
||||
parentObj->firstAncestorOrThisOfType( formationNamesCollection );
|
||||
if ( formationNamesCollection )
|
||||
{
|
||||
for ( caf::PdmObjectHandle* reffingObj : referringObjects )
|
||||
{
|
||||
RimCase* aCase = dynamic_cast<RimCase*>( reffingObj );
|
||||
if ( aCase ) aCase->updateFormationNamesData();
|
||||
}
|
||||
}
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotCollection = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( summaryPlotCollection );
|
||||
if ( summaryPlotCollection )
|
||||
{
|
||||
summaryPlotCollection->updateSummaryNameHasChanged();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotCollection = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( summaryCrossPlotCollection );
|
||||
if ( summaryCrossPlotCollection )
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( ensembleCurveSetColl );
|
||||
if ( ensembleCurveSetColl )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
ensembleCurveSetColl->firstAncestorOrThisOfType( plot );
|
||||
if ( plot ) plot->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimEnsembleCurveFilterCollection* ensembleCurveFilterColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( ensembleCurveFilterColl );
|
||||
if ( ensembleCurveFilterColl )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
ensembleCurveFilterColl->firstAncestorOrThisOfType( plot );
|
||||
if ( plot ) plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
{
|
||||
RimAnnotationCollection* annotationColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( annotationColl );
|
||||
if ( annotationColl )
|
||||
{
|
||||
annotationColl->onAnnotationDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimAnnotationInViewCollection* annotationColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType( annotationColl );
|
||||
if ( annotationColl )
|
||||
{
|
||||
annotationColl->onAnnotationDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimSurfaceCollection* surfCollection;
|
||||
parentObj->firstAncestorOrThisOfType( surfCollection );
|
||||
if ( surfCollection )
|
||||
{
|
||||
surfCollection->updateViews();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimAnalysisPlot* analysisPlot;
|
||||
parentObj->firstAncestorOrThisOfType( analysisPlot );
|
||||
if ( analysisPlot )
|
||||
{
|
||||
analysisPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimCorrelationPlot* corrPlot;
|
||||
parentObj->firstAncestorOrThisOfType( corrPlot );
|
||||
if ( corrPlot )
|
||||
{
|
||||
corrPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
parentObj->onChildDeleted( listField, referringObjects );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user