mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1772 Add command to store flow characteristics plots
This commit is contained in:
@@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredFlowCharacteristicsPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowFlowCharacteristicsPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h
|
||||
@@ -17,6 +18,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredFlowCharacteristicsPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowFlowCharacteristicsPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicAddStoredFlowCharacteristicsPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAddStoredFlowCharacteristicsPlotFeature, "RicAddStoredFlowCharacteristicsPlotFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddStoredFlowCharacteristicsPlotFeature::isCommandEnabled()
|
||||
{
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
RimFlowCharacteristicsPlot* flowCharacteristicsPlot = dynamic_cast<RimFlowCharacteristicsPlot*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
if (flowPlotColl->defaultFlowCharacteristicsPlot() == flowCharacteristicsPlot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
RimFlowCharacteristicsPlot* sourceObject = dynamic_cast<RimFlowCharacteristicsPlot*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
RimFlowCharacteristicsPlot* flowCharacteristicsPlot = dynamic_cast<RimFlowCharacteristicsPlot*>(sourceObject->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(flowCharacteristicsPlot);
|
||||
|
||||
flowPlotColl->addFlowCharacteristicsPlotToStoredPlots(flowCharacteristicsPlot);
|
||||
flowCharacteristicsPlot->resolveReferencesRecursively();
|
||||
|
||||
flowCharacteristicsPlot->loadDataAndUpdate();
|
||||
|
||||
flowPlotColl->updateConnectedEditors();
|
||||
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem(flowCharacteristicsPlot);
|
||||
mainPlotWindow->setExpanded(flowCharacteristicsPlot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddStoredFlowCharacteristicsPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
//actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setText("Add Stored Well Allocation Plot");
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RicAddStoredFlowCharacteristicsPlotFeature : 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;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimFishboneWellPath.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafCmdSelectionHelper.h"
|
||||
@@ -61,6 +62,7 @@ bool isDeletable(caf::PdmUiItem* uiItem)
|
||||
{
|
||||
// Enable delete of well allocation plots
|
||||
if (dynamic_cast<RimWellAllocationPlot*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimFlowCharacteristicsPlot*>(uiItem)) return true;
|
||||
|
||||
// Disable delete of all sub objects of a well allocation plot
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(uiItem);
|
||||
|
||||
@@ -64,16 +64,17 @@ public:
|
||||
virtual void zoomAll() override;
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
virtual void loadDataAndUpdate() override;
|
||||
|
||||
enum TimeSelectionType
|
||||
{
|
||||
ALL_AVAILABLE,
|
||||
SELECT_AVAILABLE
|
||||
};
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual void loadDataAndUpdate() override;
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
|
||||
@@ -40,7 +40,8 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "");
|
||||
m_defaultWellAllocPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Plots", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Well Allocation Plots", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedFlowCharacteristicsPlots, "StoredFlowCharacteristicsPlots", "Stored Flow Characteristics Plots", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -67,6 +68,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
delete m_flowCharacteristicsPlot;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
m_storedFlowCharacteristicsPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -74,7 +76,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
{
|
||||
caf::ProgressInfo plotProgress(m_storedWellAllocPlots.size() + 1, "");
|
||||
caf::ProgressInfo plotProgress(m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 1, "");
|
||||
|
||||
if (m_defaultWellAllocPlot) m_defaultWellAllocPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
@@ -84,6 +86,12 @@ void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
|
||||
for (RimFlowCharacteristicsPlot* p : m_storedFlowCharacteristicsPlots)
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,6 +102,7 @@ size_t RimFlowPlotCollection::plotCount() const
|
||||
size_t plotCount = 0;
|
||||
if (m_defaultWellAllocPlot) plotCount = 1;
|
||||
plotCount += m_storedWellAllocPlots.size();
|
||||
plotCount += m_storedFlowCharacteristicsPlots.size();
|
||||
return plotCount;
|
||||
}
|
||||
|
||||
@@ -105,6 +114,14 @@ void RimFlowPlotCollection::addWellAllocPlotToStoredPlots(RimWellAllocationPlot*
|
||||
m_storedWellAllocPlots.push_back(plot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::addFlowCharacteristicsPlotToStoredPlots(RimFlowCharacteristicsPlot* plot)
|
||||
{
|
||||
m_storedFlowCharacteristicsPlots.push_back(plot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
size_t plotCount() const;
|
||||
|
||||
void addWellAllocPlotToStoredPlots(RimWellAllocationPlot* plot);
|
||||
void addFlowCharacteristicsPlotToStoredPlots(RimFlowCharacteristicsPlot* plot);
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
|
||||
@@ -48,4 +49,5 @@ private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
};
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "RimFault.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@@ -351,6 +352,10 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicAddStoredWellAllocationPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowCharacteristicsPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddStoredFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowDiagSolution*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
|
||||
Reference in New Issue
Block a user