Allow deleting of the last sub plot and have nice visible drop targets

This commit is contained in:
Gaute Lindkvist
2019-10-29 08:53:14 +01:00
parent 089ca3d39d
commit 38e0b150ac
15 changed files with 350 additions and 119 deletions

View File

@@ -137,6 +137,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.h
)
@@ -278,6 +279,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,76 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridPlotWindowCollection.h"
#include "RiaApplication.h"
#include "RimGridPlotWindow.h"
#include "RimProject.h"
CAF_PDM_SOURCE_INIT( RimGridPlotWindowCollection, "RimGridPlotWindowCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection::RimGridPlotWindowCollection()
{
CAF_PDM_InitObject( "Combination Plots", ":/WellFlowPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_gridPlotWindows, "GridPlotWindows", "Combination Plots", "", "", "" );
m_gridPlotWindows.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection::~RimGridPlotWindowCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindowCollection::deleteAllChildObjects()
{
m_gridPlotWindows.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridPlotWindow*> RimGridPlotWindowCollection::gridPlotWindows() const
{
return m_gridPlotWindows.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindow* RimGridPlotWindowCollection::createGridPlotWindow()
{
RimGridPlotWindow* plot = new RimGridPlotWindow();
plot->setAsPlotMdiWindow();
addGridPlotWindow( plot );
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindowCollection::addGridPlotWindow( RimGridPlotWindow* plot )
{
m_gridPlotWindows().push_back( plot );
}

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimGridPlotWindow;
//==================================================================================================
///
///
//==================================================================================================
class RimGridPlotWindowCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimGridPlotWindowCollection();
~RimGridPlotWindowCollection() override;
void deleteAllChildObjects();
std::vector<RimGridPlotWindow*> gridPlotWindows() const;
RimGridPlotWindow* createGridPlotWindow();
void addGridPlotWindow( RimGridPlotWindow* plot );
private:
caf::PdmChildArrayField<RimGridPlotWindow*> m_gridPlotWindows;
};

View File

@@ -23,6 +23,7 @@
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
@@ -84,6 +85,9 @@ RimMainPlotCollection::RimMainPlotCollection()
"" );
m_saturationPressurePlotCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_combinationPlotCollection, "RimGridPlotWindowCollection", "Combination Plots", "", "", "" );
m_combinationPlotCollection.uiCapability()->setUiHidden( true );
m_wellLogPlotCollection = new RimWellLogPlotCollection();
m_rftPlotCollection = new RimRftPlotCollection();
m_pltPlotCollection = new RimPltPlotCollection();
@@ -180,6 +184,14 @@ RimSaturationPressurePlotCollection* RimMainPlotCollection::saturationPressurePl
return m_saturationPressurePlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridPlotWindowCollection* RimMainPlotCollection::combinationPlotCollection()
{
return m_combinationPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -193,6 +205,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_gridCrossPlotCollection->deleteAllChildObjects();
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
m_saturationPressurePlotCollection()->deleteAllChildObjects();
m_combinationPlotCollection()->deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
@@ -244,6 +257,14 @@ void RimMainPlotCollection::updatePlotsWithFormations()
crossPlot->loadDataAndUpdate();
}
}
if ( m_combinationPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
{
plotWindow->loadDataAndUpdate();
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -258,6 +279,14 @@ void RimMainPlotCollection::updatePlotsWithCompletions()
wellLogPlot->loadDataAndUpdate();
}
}
if ( m_combinationPlotCollection )
{
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
{
plotWindow->loadDataAndUpdate();
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -30,6 +30,7 @@ class RimWellLogPlotCollection;
class RimRftPlotCollection;
class RimPltPlotCollection;
class RimGridCrossPlotCollection;
class RimGridPlotWindowCollection;
class RimSummaryPlotCollection;
class RimSummaryCrossPlotCollection;
class RimSummaryPlot;
@@ -58,6 +59,7 @@ public:
RimFlowPlotCollection* flowPlotCollection();
RimGridCrossPlotCollection* gridCrossPlotCollection();
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
RimGridPlotWindowCollection* combinationPlotCollection();
void deleteAllContainedObjects();
void updateCurrentTimeStepInPlots();
@@ -81,6 +83,7 @@ private:
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
caf::PdmChildField<RimGridPlotWindowCollection*> m_combinationPlotCollection;
caf::PdmField<bool> m_show;
};

View File

@@ -50,6 +50,7 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechModels.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimGridSummaryCase.h"
#include "RimGridView.h"
#include "RimIdenticalGridCaseGroup.h"
@@ -1303,6 +1304,10 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
{
itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() );
}
if ( mainPlotCollection->combinationPlotCollection() )
{
itemCollection->add( mainPlotCollection->combinationPlotCollection() );
}
}
uiTreeOrdering.add( m_plotTemplateFolderItem() );

View File

@@ -34,6 +34,7 @@
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimGridPlotWindowCollection.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCaseMainCollection.h"
@@ -176,5 +177,14 @@ void RimReloadCaseTools::updateAllPlots()
{
flowPlotCollection->loadDataAndUpdate();
}
RimGridPlotWindowCollection* gridPlotWindowCollection = project->mainPlotCollection()->combinationPlotCollection();
if ( gridPlotWindowCollection )
{
for ( RimGridPlotWindow* plotWindow : gridPlotWindowCollection->gridPlotWindows() )
{
plotWindow->loadDataAndUpdate();
}
}
}
}