#1107 #1111 Added update of well allocation plot from 3D view

This commit is contained in:
Magne Sjaastad
2017-01-13 13:32:02 +01:00
parent 239322ba50
commit 723e0f9286
12 changed files with 317 additions and 20 deletions

View File

@@ -32,9 +32,13 @@ RimFlowPlotCollection::RimFlowPlotCollection()
{
CAF_PDM_InitObject("Flow Diagnostics Plots", ":/newIcon16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&flowPlots, "FlowPlots", "", "", "", "");
flowPlots.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&defaultPlot, "DefaultFlowPlot", "", "", "", "");
defaultPlot = new RimWellAllocationPlot;
defaultPlot->setDescription("Default Flow Diagnostics Plot");
defaultPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&flowPlots, "FlowPlots", "Stored Plots", "", "", "");
flowPlots.push_back(new RimWellAllocationPlot);
flowPlots.push_back(new RimWellAllocationPlot);
}

View File

@@ -20,6 +20,7 @@
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
class RimWellAllocationPlot;
@@ -34,5 +35,6 @@ public:
RimFlowPlotCollection();
virtual ~RimFlowPlotCollection();
caf::PdmChildField<RimWellAllocationPlot*> defaultPlot;
caf::PdmChildArrayField<RimWellAllocationPlot*> flowPlots;
};

View File

@@ -19,7 +19,11 @@
#include "RimWellAllocationPlot.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuWellAllocationPlot.h"
@@ -37,6 +41,8 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_showWindow.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Flow Diagnostics Plot"), "Name", "", "", "");
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
@@ -62,9 +68,7 @@ void RimWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
{
m_simulationWell = simWell;
setDescription(simWell->name());
updateViewerWidget();
updateFromWell();
}
//--------------------------------------------------------------------------------------------------
@@ -79,6 +83,22 @@ void RimWellAllocationPlot::deletePlotWidget()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateFromWell()
{
QString simName = "None";
if (m_simulationWell)
{
simName = m_simulationWell->name();
}
setDescription(simName);
updateViewerWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -94,6 +114,40 @@ void RimWellAllocationPlot::zoomAll()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_simulationWell)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
if (eclView && eclView->wellCollection())
{
RimEclipseWellCollection* coll = eclView->wellCollection();
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
QIcon simWellIcon(":/Well.png");
for (RimEclipseWell* eclWell : eclWells)
{
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
}
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -121,6 +175,10 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
{
updateViewerWidgetWindowTitle();
}
else if (changedField == &m_simulationWell)
{
updateFromWell();
}
}
//--------------------------------------------------------------------------------------------------
@@ -162,6 +220,14 @@ QString RimWellAllocationPlot::description() const
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::loadDataAndUpdate()
{
updateViewerWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -30,6 +30,10 @@
class RiuWellAllocationPlot;
class RimEclipseWell;
namespace caf {
class PdmOptionItemInfo;
}
//==================================================================================================
///
@@ -48,11 +52,16 @@ public:
void setDescription(const QString& description);
QString description() const;
void loadDataAndUpdate();
void handleViewerDeletion();
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
protected:
// Overridden PDM methods
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
@@ -66,6 +75,7 @@ private:
void updateViewerWidget();
void updateViewerWidgetWindowTitle();
void deletePlotWidget();
void updateFromWell();
private:
caf::PdmField<bool> m_showWindow;