mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1373 Add feature ShowTotalAllocationData
This commit is contained in:
@@ -73,7 +73,7 @@ protected:
|
|||||||
virtual void onActionTriggered( bool isChecked );
|
virtual void onActionTriggered( bool isChecked );
|
||||||
virtual void setupActionLook( QAction* actionToSetup );
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
|
||||||
private:
|
public:
|
||||||
static void showTextWindow(const QString& title, const QString& text);
|
static void showTextWindow(const QString& title, const QString& text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
|
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
|
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -24,6 +25,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
|
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicShowTotalAllocationDataFeature.h"
|
||||||
|
|
||||||
|
#include "ApplicationCommands/RicShowPlotDataFeature.h"
|
||||||
|
|
||||||
|
#include "RimTotalWellAllocationPlot.h"
|
||||||
|
#include "RimWellAllocationPlot.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicShowTotalAllocationDataFeature, "RicShowTotalAllocationDataFeature");
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicShowTotalAllocationDataFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
|
||||||
|
|
||||||
|
if (wellAllocPlots.size() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicShowTotalAllocationDataFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
|
||||||
|
CVF_ASSERT(wellAllocPlots.size() > 0);
|
||||||
|
|
||||||
|
for (auto wellAllocPlot : wellAllocPlots)
|
||||||
|
{
|
||||||
|
QString txt = wellAllocPlot->description();
|
||||||
|
txt += "\n";
|
||||||
|
txt += "\n";
|
||||||
|
txt += wellAllocPlot->totalWellFlowPlot()->totalAllocationAsText();
|
||||||
|
|
||||||
|
QString title = "Total Allocation (" + wellAllocPlot->wellName() + ")";
|
||||||
|
|
||||||
|
RicShowPlotDataFeature::showTextWindow(title, txt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicShowTotalAllocationDataFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("Show Total Allocation");
|
||||||
|
//actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RimWellAllocationPlot*> RicShowTotalAllocationDataFeature::selectedWellAllocationPlots()
|
||||||
|
{
|
||||||
|
std::set<RimWellAllocationPlot*> wellAllocPlots;
|
||||||
|
|
||||||
|
std::vector<caf::PdmObject*> objects;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||||
|
for (auto obj : objects)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(obj);
|
||||||
|
|
||||||
|
RimWellAllocationPlot* parentPlot = nullptr;
|
||||||
|
obj->firstAncestorOrThisOfType(parentPlot);
|
||||||
|
|
||||||
|
if (parentPlot)
|
||||||
|
{
|
||||||
|
wellAllocPlots.insert(parentPlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wellAllocPlots;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
class RimWellAllocationPlot;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicShowTotalAllocationDataFeature : 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;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::set<RimWellAllocationPlot*> selectedWellAllocationPlots();
|
||||||
|
};
|
||||||
@@ -138,6 +138,24 @@ QString RimTotalWellAllocationPlot::description() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimTotalWellAllocationPlot::totalAllocationAsText() const
|
||||||
|
{
|
||||||
|
QString txt;
|
||||||
|
|
||||||
|
for (auto a : m_sliceInfo)
|
||||||
|
{
|
||||||
|
txt += a.first;
|
||||||
|
txt += "\t";
|
||||||
|
txt += QString::number(a.second);
|
||||||
|
txt += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -150,6 +168,8 @@ void RimTotalWellAllocationPlot::addSlice(const QString& name, const cvf::Color3
|
|||||||
m_wellTotalAllocationPlotWidget->addItem(name, sliceColor, value);
|
m_wellTotalAllocationPlotWidget->addItem(name, sliceColor, value);
|
||||||
m_wellTotalAllocationPlotWidget->update();
|
m_wellTotalAllocationPlotWidget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_sliceInfo.push_back(std::make_pair(name, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -163,6 +183,8 @@ void RimTotalWellAllocationPlot::clearSlices()
|
|||||||
m_wellTotalAllocationPlotWidget->clear();
|
m_wellTotalAllocationPlotWidget->clear();
|
||||||
m_wellTotalAllocationPlotWidget->update();
|
m_wellTotalAllocationPlotWidget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_sliceInfo.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class RiuWellAllocationPlot;
|
class RiuWellAllocationPlot;
|
||||||
class RimEclipseWell;
|
class RimEclipseWell;
|
||||||
class RimWellLogPlot;
|
class RimWellLogPlot;
|
||||||
@@ -55,6 +57,7 @@ public:
|
|||||||
|
|
||||||
void setDescription(const QString& description);
|
void setDescription(const QString& description);
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
QString totalAllocationAsText() const;
|
||||||
|
|
||||||
void addSlice(const QString& name, const cvf::Color3f& color, float value);
|
void addSlice(const QString& name, const cvf::Color3f& color, float value);
|
||||||
void clearSlices();
|
void clearSlices();
|
||||||
@@ -80,4 +83,6 @@ private:
|
|||||||
caf::PdmField<QString> m_userName;
|
caf::PdmField<QString> m_userName;
|
||||||
|
|
||||||
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
|
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
|
||||||
|
|
||||||
|
std::vector<std::pair<QString, float> > m_sliceInfo;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -660,9 +660,9 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_case) m_timeStep = 0;
|
if (!m_case) m_timeStep = 0;
|
||||||
else if (m_timeStep >= m_case->timeStepDates().size())
|
else if (m_timeStep >= static_cast<int>(m_case->timeStepDates().size()))
|
||||||
{
|
{
|
||||||
m_timeStep = std::max(0, ((int)m_case->timeStepDates().size()) - 1);
|
m_timeStep = std::max(0, ((int)m_case->timeStepDates().size()) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<QString> sortedWellNames = findSortedWellNames();
|
std::set<QString> sortedWellNames = findSortedWellNames();
|
||||||
|
|||||||
@@ -390,6 +390,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||||
|
|
||||||
commandIds << "RicShowPlotDataFeature";
|
commandIds << "RicShowPlotDataFeature";
|
||||||
|
commandIds << "RicShowTotalAllocationDataFeature";
|
||||||
|
|
||||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||||
|
|
||||||
// Work in progress -- End
|
// Work in progress -- End
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
|||||||
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
|
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
|
||||||
|
|
||||||
QStringList commandIds;
|
QStringList commandIds;
|
||||||
commandIds << "RicShowWellAllocationDataFeature";
|
commandIds << "RicShowTotalAllocationDataFeature";
|
||||||
new RiuContextMenuLauncher(m_legendWidget, commandIds);
|
new RiuContextMenuLauncher(m_legendWidget, commandIds);
|
||||||
|
|
||||||
rightColumnLayout->addWidget(m_legendWidget);
|
rightColumnLayout->addWidget(m_legendWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user