#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

@@ -66,6 +66,7 @@
#include "RimSummaryPlotCollection.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
@@ -113,6 +114,7 @@
#ifdef WIN32
#include <fcntl.h>
#endif
#include "RimFlowPlotCollection.h"
namespace caf
{
@@ -554,6 +556,7 @@ void RiaApplication::loadAndUpdatePlotData()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
{
@@ -563,9 +566,15 @@ void RiaApplication::loadAndUpdatePlotData()
{
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
}
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->flowPlotCollection())
{
flowColl = m_project->mainPlotCollection()->flowPlotCollection();
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->summaryPlots().size() : 0;
plotCount += flowColl ? flowColl->flowPlots().size() : 0;
caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
if (wlpColl)
@@ -585,6 +594,17 @@ void RiaApplication::loadAndUpdatePlotData()
plotProgress.incrementProgress();
}
}
if (flowColl)
{
flowColl->defaultPlot->loadDataAndUpdate();
for (RimWellAllocationPlot* p : flowColl->flowPlots())
{
p->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -1124,6 +1144,22 @@ RimSummaryPlot* RiaApplication::activeSummaryPlot()
return m_activeSummaryPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::setActiveWellAllocationPlot(RimWellAllocationPlot* wap)
{
m_activeWellAllocationPlot = wap;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RiaApplication::activeWellAllocationPlot()
{
return m_activeWellAllocationPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -53,6 +53,7 @@ class RimSummaryPlot;
class RimView;
class RimViewWindow;
class RimWellLogPlot;
class RimWellAllocationPlot;
class RiuMainPlotWindow;
class RiuRecentFileActionProvider;
@@ -100,6 +101,9 @@ public:
void setActiveSummaryPlot(RimSummaryPlot*);
RimSummaryPlot* activeSummaryPlot();
void setActiveWellAllocationPlot(RimWellAllocationPlot*);
RimWellAllocationPlot* activeWellAllocationPlot();
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
RimProject* project();
@@ -224,6 +228,7 @@ private:
caf::PdmPointer<RimView> m_activeReservoirView;
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
caf::PdmPointer<RimWellAllocationPlot> m_activeWellAllocationPlot;
caf::PdmPointer<RimProject> m_project;

View File

@@ -119,6 +119,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake

View File

@@ -0,0 +1,23 @@
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\FlowDiagnostics" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "RicShowWellAllocationPlotFeature.h"
#include "RiaApplication.h"
#include "RimEclipseWell.h"
#include "RimFlowPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimWellAllocationPlot.h"
#include "RiuMainPlotWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
if (collection.size() > 0)
{
RimEclipseWell* eclWell = collection[0];
if (RiaApplication::instance()->project())
{
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
if (flowPlotColl)
{
flowPlotColl->defaultPlot->setSimulationWell(eclWell);
flowPlotColl->defaultPlot->updateConnectedEditors();
// Make sure the summary plot window is created and visible
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
//RiaApplication::instance()->project()->updateConnectedEditors();
plotwindow->selectAsCurrentItem(flowPlotColl->defaultPlot);
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
actionToSetup->setText("Show Well Allocation Plot");
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "cafCmdFeature.h"
class RimEclipseWell;
//==================================================================================================
///
//==================================================================================================
class RicShowWellAllocationPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
};

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;

View File

@@ -26,6 +26,7 @@
#include "RimSummaryPlot.h"
#include "RimTreeViewStateSerializer.h"
#include "RimViewWindow.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RiuDragDrop.h"
@@ -33,6 +34,7 @@
#include "RiuSummaryQwtPlot.h"
#include "RiuToolTipMenu.h"
#include "RiuTreeViewEventFilter.h"
#include "RiuWellAllocationPlot.h"
#include "RiuWellLogPlot.h"
#include "cafCmdFeatureManager.h"
@@ -498,6 +500,24 @@ void RiuMainPlotWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
RiaApplication::instance()->setActiveSummaryPlot(NULL);
}
}
{
RiuWellAllocationPlot* wellAllocationPlotWidget = dynamic_cast<RiuWellAllocationPlot*>(subWindow->widget());
if (wellAllocationPlotWidget)
{
RimWellAllocationPlot* wellAllocationPlot = wellAllocationPlotWidget->ownerPlotDefinition();
if (wellAllocationPlot != RiaApplication::instance()->activeWellAllocationPlot())
{
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
projectTreeView()->selectAsCurrentItem(wellAllocationPlot);
}
}
else
{
RiaApplication::instance()->setActiveWellAllocationPlot(nullptr);
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -575,10 +595,9 @@ void RiuMainPlotWindow::selectedObjectsChanged()
// Well log plot
bool isActiveWellLogPlotChanged = false;
bool isActiveObjectChanged = false;
RimWellLogPlot* selectedWellLogPlot = dynamic_cast<RimWellLogPlot*>(firstSelectedObject);
if (!selectedWellLogPlot)
{
firstSelectedObject->firstAncestorOrThisOfType(selectedWellLogPlot);
@@ -590,20 +609,13 @@ void RiuMainPlotWindow::selectedObjectsChanged()
{
setActiveViewer(selectedWellLogPlot->viewWidget());
}
isActiveWellLogPlotChanged = true;
}
if (isActiveWellLogPlotChanged)
{
isActiveObjectChanged = true;
RiaApplication::instance()->setActiveWellLogPlot(selectedWellLogPlot);
}
// Summary plot
bool isActiveSummaryPlotChanged = false;
RimSummaryPlot* selectedSummaryPlot = dynamic_cast<RimSummaryPlot*>(firstSelectedObject);
if (!selectedSummaryPlot)
{
firstSelectedObject->firstAncestorOrThisOfType(selectedSummaryPlot);
@@ -615,15 +627,31 @@ void RiuMainPlotWindow::selectedObjectsChanged()
{
setActiveViewer(selectedSummaryPlot->viewWidget());
}
isActiveSummaryPlotChanged = true;
}
if (isActiveSummaryPlotChanged)
{
isActiveObjectChanged = true;
RiaApplication::instance()->setActiveSummaryPlot(selectedSummaryPlot);
}
if (isActiveWellLogPlotChanged || isActiveSummaryPlotChanged)
// Flow plot
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(firstSelectedObject);
if (!wellAllocationPlot)
{
firstSelectedObject->firstAncestorOrThisOfType(wellAllocationPlot);
}
if (wellAllocationPlot)
{
if (wellAllocationPlot->viewWidget())
{
setActiveViewer(wellAllocationPlot->viewWidget());
}
isActiveObjectChanged = true;
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
}
if (isActiveObjectChanged)
{
// The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window

View File

@@ -308,6 +308,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
caf::SelectionManager::instance()->setSelectedItem(well);
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicShowWellAllocationPlotFeature";
}
}