mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor RimPlotWindow and RimPlotInterface
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -52,7 +52,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimMultiPlot* multiPlot = nullptr;
|
||||
object->firstAncestorOrThisOfType( multiPlot );
|
||||
if ( dynamic_cast<RimPlotInterface*>( object ) && multiPlot )
|
||||
if ( dynamic_cast<RimPlotWindow*>( object ) && multiPlot )
|
||||
{
|
||||
plotsSelected++;
|
||||
}
|
||||
@@ -70,21 +70,19 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
|
||||
|
||||
std::vector<caf::PdmObject*> selection;
|
||||
std::vector<RimPlot*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
std::set<RimMultiPlot*> alteredPlotWindows;
|
||||
|
||||
for ( size_t i = 0; i < selection.size(); i++ )
|
||||
for ( RimPlot* plot : selection )
|
||||
{
|
||||
RimPlotInterface* plot = dynamic_cast<RimPlotInterface*>( selection[i] );
|
||||
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
selection[i]->firstAncestorOrThisOfType( plotWindow );
|
||||
plot->firstAncestorOrThisOfType( plotWindow );
|
||||
if ( plot && plotWindow )
|
||||
{
|
||||
alteredPlotWindows.insert( plotWindow );
|
||||
plotWindow->removePlot( plot );
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections( selection[i] );
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections( plot );
|
||||
|
||||
plotWindow->updateConnectedEditors();
|
||||
delete plot;
|
||||
|
||||
Reference in New Issue
Block a user