Refactor RimPlotWindow and RimPlotInterface

This commit is contained in:
Gaute Lindkvist
2019-11-15 10:12:19 +01:00
parent 4dd0651dae
commit d9043db5e0
40 changed files with 697 additions and 765 deletions

View File

@@ -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;