#1842 RFT plot. Initial commit. Under construction...

This commit is contained in:
Bjørn Erik Jensen 2017-09-27 12:39:28 +02:00
parent 88902e8f03
commit 70a41709cf
20 changed files with 1888 additions and 1 deletions

View File

@ -7,6 +7,7 @@ endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogCurveExtractionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewRftPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogFileCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeatureImpl.h
@ -26,6 +27,7 @@ ${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.h
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogCurveExtractionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewRftPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogFileCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeatureImpl.cpp

View File

@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RicNewRftPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RiaApplication.h"
#include "RigWellLogCurveData.h"
#include "RimProject.h"
#include "RimView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellRftPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimRftPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RiuMainPlotWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <vector>
#include "RimEclipseWell.h"
#include "RiuSelectionManager.h"
CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::isCommandEnabled()
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
int branchIndex;
return (selectedWellLogPlotTrack() != nullptr || selectedWellPath() != nullptr || selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
{
if (RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()) return;
RimProject* proj = RiaApplication::instance()->project();
auto rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if (rftPlotColl)
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
QString plotName = QString("RFT: %1").arg(simWellSelItem != nullptr ? simWellSelItem->m_simWell->name : QString("(Unknown)"));
auto plot = new RimWellRftPlot();
rftPlotColl->rftPlots().push_back(plot);
plot->setDescription(plotName);
plot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->selectAsCurrentItem(plot);
mainPlotWindow->setExpanded(plot, true);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New RFT Plot");
actionToSetup->setIcon(QIcon(":/SummaryPlot16x16.png"));
}
//--------------------------------------------------------------------------------------------------
/// This method is not called from within this class, only by other classes
//--------------------------------------------------------------------------------------------------
RimWellRftPlot* RicNewRftPlotFeature::createNewRftPlot(RimRftPlotCollection* rftPlotColl)
{
auto plot = new RimWellRftPlot();
rftPlotColl->rftPlots().push_back(plot);
plot->setDescription(QString("RFT Plot %1").arg(rftPlotColl->rftPlots.size() + 1));
rftPlotColl->updateConnectedEditors();
plot->loadDataAndUpdate();
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewRftPlotFeature::selectedWellLogPlotTrack() const
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewRftPlotFeature::selectedWellPath() const
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWell* RicNewRftPlotFeature::selectedSimulationWell(int * branchIndex) const
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : NULL;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::caseAvailable() const
{
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
return cases.size() > 0;
}

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 RimView;
class RimWellLogExtractionCurve;
class RimWellLogTrack;
class RimWellPath;
class RimRftPlotCollection;
class RimWellRftPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewRftPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellRftPlot* createNewRftPlot(RimRftPlotCollection* rftPlotColl);
RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPath() const;
RimEclipseWell* selectedSimulationWell(int * branchIndex) const;
bool caseAvailable() const;
};

View File

@ -22,6 +22,7 @@
#include "RiaColorTables.h"
#include "RimWellAllocationPlot.h"
#include "RimWellRftPlot.h"
#include "RimWellLogCurve.h"
#include "cafSelectionManager.h"
@ -86,3 +87,17 @@ RimWellAllocationPlot* RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot(
return wellAllocationPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot* RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()
{
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
if (!destinationObject) return nullptr;
RimWellRftPlot* wellRftPlot = nullptr;
destinationObject->firstAncestorOrThisOfType(wellRftPlot);
return wellRftPlot;
}

View File

@ -23,6 +23,7 @@
class RimWellLogCurve;
class RimWellAllocationPlot;
class RimWellRftPlot;
//==================================================================================================
///
@ -33,4 +34,5 @@ public:
static cvf::Color3f curveColorFromTable(size_t index);
static std::vector<RimWellLogCurve*> selectedWellLogCurves();
static RimWellAllocationPlot* parentWellAllocationPlot();
static RimWellRftPlot* parentWellRftPlot();
};

View File

@ -65,6 +65,7 @@ ${CEE_CURRENT_LIST_DIR}RimCase.h
${CEE_CURRENT_LIST_DIR}RimViewController.h
${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimRftPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlot.h
${CEE_CURRENT_LIST_DIR}RimWellLogTrack.h
${CEE_CURRENT_LIST_DIR}RimWellLogCurve.h
@ -160,6 +161,7 @@ ${CEE_CURRENT_LIST_DIR}RimCase.cpp
${CEE_CURRENT_LIST_DIR}RimViewController.cpp
${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimRftPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogTrack.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogCurve.cpp

View File

@ -13,6 +13,8 @@ ${CEE_CURRENT_LIST_DIR}RimTofAccumulatedPhaseFractionsPlot.h
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.h
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.h
${CEE_CURRENT_LIST_DIR}RimFlowCharacteristicsPlot.h
${CEE_CURRENT_LIST_DIR}RimWellRftPlot.h
${CEE_CURRENT_LIST_DIR}RimWellRftPlotLegend.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -24,6 +26,8 @@ ${CEE_CURRENT_LIST_DIR}RimTofAccumulatedPhaseFractionsPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.cpp
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.cpp
${CEE_CURRENT_LIST_DIR}RimFlowCharacteristicsPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellRftPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellRftPlotLegend.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,817 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimWellRftPlot.h"
#include "RiaApplication.h"
#include "RigAccWellFlowCalculator.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResultAddress.h"
#include "RigFlowDiagResults.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSimulationWellCoordsAndMD.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellRftPlotLegend.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiuMainPlotWindow.h"
#include "RiuWellRftPlot.h"
#include "RiuWellLogTrack.h"
CAF_PDM_SOURCE_INIT(RimWellRftPlot, "WellRftPlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
namespace caf
{
template<>
void AppEnum<RimWellRftPlot::FlowType>::setUp()
{
addItem(RimWellRftPlot::ACCUMULATED, "ACCUMULATED", "Accumulated");
addItem(RimWellRftPlot::INFLOW, "INFLOW", "Inflow Rates");
setDefault(RimWellRftPlot::ACCUMULATED);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot::RimWellRftPlot()
{
CAF_PDM_InitObject("Well Allocation Plot", ":/WellAllocPlot16x16.png", "", "");
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_case, "CurveCase", "Case", "", "", "");
m_case.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", "");
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_flowType, "FlowType", "Flow Type", "", "", "");
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "");
CAF_PDM_InitField(&m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "");
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden(true);
m_accumulatedWellFlowPlot = new RimWellLogPlot;
m_accumulatedWellFlowPlot->setDepthUnit(RiaDefines::UNIT_NONE);
m_accumulatedWellFlowPlot->setDepthType(RimWellLogPlot::CONNECTION_NUMBER);
m_accumulatedWellFlowPlot->setTrackLegendsVisible(false);
m_accumulatedWellFlowPlot->uiCapability()->setUiIcon(QIcon(":/WellFlowPlot16x16.png"));
CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "");
m_totalWellAllocationPlot.uiCapability()->setUiHidden(true);
m_totalWellAllocationPlot = new RimTotalWellAllocationPlot;
CAF_PDM_InitFieldNoDefault(&m_WellRftPlotLegend, "WellAllocLegend", "Legend", "", "", "");
m_WellRftPlotLegend.uiCapability()->setUiHidden(true);
m_WellRftPlotLegend = new RimWellRftPlotLegend;
CAF_PDM_InitFieldNoDefault(&m_tofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot", "TOF Accumulated Phase Fractions", "", "", "");
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden(true);
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
this->setAsPlotMdiWindow();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot::~RimWellRftPlot()
{
removeMdiWindowFromMdiArea();
delete m_accumulatedWellFlowPlot();
delete m_totalWellAllocationPlot();
delete m_tofAccumulatedPhaseFractionsPlot();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::setFromSimulationWell(RimEclipseWell* simWell)
{
RimEclipseView* eclView;
simWell->firstAncestorOrThisOfType(eclView);
RimEclipseResultCase* eclCase;
simWell->firstAncestorOrThisOfType(eclCase);
m_case = eclCase;
m_wellName = simWell->wellResults()->m_wellName;
m_timeStep = eclView->currentTimeStep();
// Use the active flow diag solutions, or the first one as default
m_flowDiagSolution = eclView->cellResult()->flowDiagSolution();
if ( !m_flowDiagSolution )
{
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
}
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::deleteViewWidget()
{
if (m_WellRftPlotWidget)
{
m_WellRftPlotWidget->deleteLater();
m_WellRftPlotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::updateFromWell()
{
// Delete existing tracks
{
std::vector<RimWellLogTrack*> tracks;
accumulatedWellFlowPlot()->descendantsIncludingThisOfType(tracks);
for (RimWellLogTrack* t : tracks)
{
accumulatedWellFlowPlot()->removeTrack(t);
delete t;
}
}
CVF_ASSERT(accumulatedWellFlowPlot()->trackCount() == 0);
QString description;
if (m_flowType() == ACCUMULATED) description = "Accumulated Flow";
if (m_flowType() == INFLOW) description = "Inflow Rates";
accumulatedWellFlowPlot()->setDescription(description + " (" + m_wellName + ")");
if (!m_case) return;
const RigSingleWellResultsData* wellResults = m_case->eclipseCaseData()->findWellResult(m_wellName);
if (!wellResults) return;
// Set up the Accumulated Well Flow Calculator
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->eclipseCaseData(),
wellResults,
m_timeStep,
true,
true,
pipeBranchesCLCoords,
pipeBranchesCellIds);
std::map<QString, const std::vector<double>* > tracerFractionCellValues = findRelevantTracerCellFractions(wellResults);
std::unique_ptr< RigAccWellFlowCalculator > wfCalculator;
double smallContributionThreshold = 0.0;
if (m_groupSmallContributions()) smallContributionThreshold = m_smallContributionsThreshold;
if ( tracerFractionCellValues.size() )
{
bool isProducer = ( wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER
|| wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL));
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
pipeBranchesCellIds,
tracerFractionCellValues,
cellIdxCalc,
smallContributionThreshold,
isProducer));
}
else
{
if (pipeBranchesCLCoords.size() > 0)
{
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
pipeBranchesCellIds,
smallContributionThreshold));
}
}
auto depthType = accumulatedWellFlowPlot()->depthType();
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return;
// Create tracks and curves from the calculated data
size_t branchCount = pipeBranchesCLCoords.size();
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx)
{
// Skip Tiny dummy branches
if (pipeBranchesCellIds[brIdx].size() <= 3) continue;
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plotTrack->setDescription(QString("Branch %1").arg(brIdx + 1));
accumulatedWellFlowPlot()->addTrack(plotTrack);
const std::vector<double>& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop(brIdx) :
depthType == RimWellLogPlot::PSEUDO_LENGTH ? wfCalculator->pseudoLengthFromTop(brIdx) :
depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) :
std::vector<double>();
{
std::vector<QString> tracerNames = wfCalculator->tracerNames();
for (const QString& tracerName: tracerNames)
{
const std::vector<double>* accFlow = nullptr;
if (depthType == RimWellLogPlot::CONNECTION_NUMBER)
{
accFlow = &(m_flowType == ACCUMULATED ?
wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx):
wfCalculator->tracerFlowPrConnection(tracerName, brIdx));
}
else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
{
accFlow = &(m_flowType == ACCUMULATED ?
wfCalculator->accumulatedTracerFlowPrPseudoLength(tracerName, brIdx):
wfCalculator->tracerFlowPrPseudoLength(tracerName, brIdx));
}
addStackedCurve(tracerName, depthValues, *accFlow, plotTrack);
//TODO: THIs is the data to be plotted...
}
}
updateWellFlowPlotXAxisTitle(plotTrack);
}
QString wellStatusText = QString("(%1)").arg(RimWellRftPlot::wellStatusTextForTimeStep(m_wellName, m_case, m_timeStep));
QString flowTypeText = m_flowDiagSolution() ? "Well Allocation": "Well Flow";
setDescription(flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")");
/// Pie chart
m_totalWellAllocationPlot->clearSlices();
if (m_WellRftPlotWidget) m_WellRftPlotWidget->clearLegend();
if (wfCalculator)
{
std::vector<std::pair<QString, double> > totalTracerFractions = wfCalculator->totalTracerFractions() ;
for ( const auto& tracerVal : totalTracerFractions )
{
cvf::Color3f color;
if (m_flowDiagSolution)
color = m_flowDiagSolution->tracerColor(tracerVal.first);
else
color = getTracerColor(tracerVal.first);
double tracerPercent = 100*tracerVal.second;
m_totalWellAllocationPlot->addSlice(tracerVal.first, color, tracerPercent);
if ( m_WellRftPlotWidget ) m_WellRftPlotWidget->addLegendItem(tracerVal.first, color, tracerPercent);
}
}
if (m_WellRftPlotWidget) m_WellRftPlotWidget->showLegend(m_WellRftPlotLegend->isShowingLegend());
m_totalWellAllocationPlot->updateConnectedEditors();
accumulatedWellFlowPlot()->updateConnectedEditors();
m_tofAccumulatedPhaseFractionsPlot->reloadFromWell();
m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors();
if (m_WellRftPlotWidget) m_WellRftPlotWidget->updateGeometry();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<QString, const std::vector<double> *> RimWellRftPlot::findRelevantTracerCellFractions(const RigSingleWellResultsData* wellResults)
{
std::map<QString, const std::vector<double> *> tracerCellFractionValues;
if ( m_flowDiagSolution && wellResults->hasWellResult(m_timeStep) )
{
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(m_timeStep);
if ( prodType == RigWellResultFrame::PRODUCER
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
requestedTracerType = RimFlowDiagSolution::INJECTOR;
}
else
{
requestedTracerType = RimFlowDiagSolution::PRODUCER;
}
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
for ( const QString& tracerName : tracerNames )
{
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType )
{
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, tracerName.toStdString());
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions;
}
}
}
return tracerCellFractionValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{
RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
if (m_flowDiagSolution)
{
QString unitText;
switch ( unitSet )
{
case RiaEclipseUnitTools::UNITS_METRIC:
unitText = "[m<sup>3</sup>/day]";
break;
case RiaEclipseUnitTools::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RiaEclipseUnitTools::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
}
plotTrack->setXAxisTitle("Reservoir Flow Rate " + unitText);
}
else
{
QString unitText;
switch ( unitSet )
{
case RiaEclipseUnitTools::UNITS_METRIC:
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
break;
case RiaEclipseUnitTools::UNITS_FIELD:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
case RiaEclipseUnitTools::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
}
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::addStackedCurve(const QString& tracerName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack)
{
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow);
if ( m_flowDiagSolution )
{
curve->setColor(m_flowDiagSolution->tracerColor(tracerName));
}
else
{
curve->setColor(getTracerColor(tracerName));
}
plotTrack->addCurve(curve);
curve->loadDataAndUpdate(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::updateWidgetTitleWindowTitle()
{
updateMdiWindowTitle();
if (m_WellRftPlotWidget)
{
if (m_showPlotTitle)
{
m_WellRftPlotWidget->showTitle(m_userName);
}
else
{
m_WellRftPlotWidget->hideTitle();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellRftPlot::wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep)
{
QString statusText = "Undefined";
if (eclipseResultCase)
{
const RigSingleWellResultsData* wellResults = eclipseResultCase->eclipseCaseData()->findWellResult(wellName);
if (wellResults)
{
if (wellResults->hasWellResult(timeStep))
{
const RigWellResultFrame& wellResultFrame = wellResults->wellResultFrame(timeStep);
RigWellResultFrame::WellProductionType prodType = wellResultFrame.m_productionType;
switch (prodType)
{
case RigWellResultFrame::PRODUCER:
statusText = "Producer";
break;
case RigWellResultFrame::OIL_INJECTOR:
statusText = "Oil Injector";
break;
case RigWellResultFrame::GAS_INJECTOR:
statusText = "Gas Injector";
break;
case RigWellResultFrame::WATER_INJECTOR:
statusText = "Water Injector";
break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
break;
default:
break;
}
}
}
}
return statusText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellRftPlot::viewWidget()
{
return m_WellRftPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::zoomAll()
{
m_accumulatedWellFlowPlot()->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RimWellRftPlot::accumulatedWellFlowPlot()
{
return m_accumulatedWellFlowPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTotalWellAllocationPlot* RimWellRftPlot::totalWellFlowPlot()
{
return m_totalWellAllocationPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot * RimWellRftPlot::tofAccumulatedPhaseFractionsPlot()
{
return m_tofAccumulatedPhaseFractionsPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RimWellRftPlot::plotLegend()
{
return m_WellRftPlotLegend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultCase* RimWellRftPlot::rimCase()
{
return m_case();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellRftPlot::timeStep()
{
return m_timeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_wellName)
{
std::set<QString> sortedWellNames = this->findSortedWellNames();
QIcon simWellIcon(":/Well.png");
for ( const QString& wname: sortedWellNames )
{
options.push_back(caf::PdmOptionItemInfo(wname, wname, false, simWellIcon));
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
}
else if (fieldNeedingOptions == &m_timeStep)
{
QStringList timeStepNames;
if (m_case && m_case->eclipseCaseData())
{
timeStepNames = m_case->timeStepStrings();
}
for (int i = 0; i < timeStepNames.size(); i++)
{
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
}
}
else if (fieldNeedingOptions == &m_case)
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj);
if (proj)
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases);
for (RimEclipseResultCase* c : cases)
{
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
}
}
}
else if (fieldNeedingOptions == &m_flowDiagSolution)
{
if (m_case)
{
//std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
// options.push_back(caf::PdmOptionItemInfo("None", nullptr));
//for (RimFlowDiagSolution* flowSol : flowSols)
//{
// options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
//}
RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution();
options.push_back(caf::PdmOptionItemInfo("Well Flow", nullptr));
if (defaultFlowSolution)
{
options.push_back(caf::PdmOptionItemInfo("Allocation", defaultFlowSolution ));
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellRftPlot::wellName() const
{
return m_wellName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::removeFromMdiAreaAndDeleteViewWidget()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::showPlotLegend(bool doShow)
{
if (m_WellRftPlotWidget) m_WellRftPlotWidget->showLegend(doShow);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
{
updateWidgetTitleWindowTitle();
}
else if ( changedField == &m_case)
{
if ( m_flowDiagSolution && m_case )
{
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
}
else
{
m_flowDiagSolution = nullptr;
}
if (!m_case) m_timeStep = 0;
else if (m_timeStep >= static_cast<int>(m_case->timeStepDates().size()))
{
m_timeStep = std::max(0, ((int)m_case->timeStepDates().size()) - 1);
}
std::set<QString> sortedWellNames = findSortedWellNames();
if (!sortedWellNames.size()) m_wellName = "";
else if ( sortedWellNames.count(m_wellName()) == 0 ){ m_wellName = *sortedWellNames.begin();}
loadDataAndUpdate();
}
else if ( changedField == &m_wellName
|| changedField == &m_timeStep
|| changedField == &m_flowDiagSolution
|| changedField == &m_groupSmallContributions
|| changedField == &m_smallContributionsThreshold
|| changedField == &m_flowType )
{
loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<QString> RimWellRftPlot::findSortedWellNames()
{
std::set<QString> sortedWellNames;
if ( m_case && m_case->eclipseCaseData() )
{
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
{
sortedWellNames.insert(wellRes[wIdx]->m_wellName);
}
}
return sortedWellNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimWellRftPlot::snapshotWindowContent()
{
QImage image;
if (m_WellRftPlotWidget)
{
QPixmap pix = QPixmap::grabWidget(m_WellRftPlotWidget);
image = pix.toImage();
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_userName);
uiOrdering.add(&m_showPlotTitle);
caf::PdmUiGroup& dataGroup = *uiOrdering.addNewGroup("Plot Data");
dataGroup.add(&m_case);
dataGroup.add(&m_timeStep);
dataGroup.add(&m_wellName);
caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup("Options");
optionGroup.add(&m_flowDiagSolution);
optionGroup.add(&m_flowType);
optionGroup.add(&m_groupSmallContributions);
optionGroup.add(&m_smallContributionsThreshold);
m_smallContributionsThreshold.uiCapability()->setUiReadOnly(!m_groupSmallContributions());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::setDescription(const QString& description)
{
m_userName = description;
updateWidgetTitleWindowTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellRftPlot::description() const
{
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::loadDataAndUpdate()
{
updateMdiWindowVisibility();
updateFromWell();
m_accumulatedWellFlowPlot->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellRftPlot::createViewWidget(QWidget* mainWindowParent)
{
m_WellRftPlotWidget = new RiuWellRftPlot(this, mainWindowParent);
return m_WellRftPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellRftPlot::getTracerColor(const QString& tracerName)
{
if (tracerName == RIG_FLOW_OIL_NAME) return cvf::Color3f::DARK_GREEN;
if (tracerName == RIG_FLOW_GAS_NAME) return cvf::Color3f::DARK_RED;
if (tracerName == RIG_FLOW_WATER_NAME) return cvf::Color3f::BLUE;
return cvf::Color3f::DARK_GRAY;
}

View File

@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimViewWindow.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QPointer>
class RimEclipseResultCase;
class RimEclipseWell;
class RimFlowDiagSolution;
class RimTotalWellAllocationPlot;
class RimWellRftPlotLegend;
class RimWellLogPlot;
class RiuWellRftPlot;
class RimWellLogTrack;
class RimTofAccumulatedPhaseFractionsPlot;
class RigSingleWellResultsData;
namespace cvf {
class Color3f;
}
namespace caf {
class PdmOptionItemInfo;
}
//==================================================================================================
///
///
//==================================================================================================
class RimWellRftPlot : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
public:
enum FlowType { ACCUMULATED, INFLOW};
public:
RimWellRftPlot();
virtual ~RimWellRftPlot();
void setFromSimulationWell(RimEclipseWell* simWell);
void setDescription(const QString& description);
QString description() const;
virtual void loadDataAndUpdate() override;
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot();
caf::PdmObject* plotLegend();
RimEclipseResultCase* rimCase();
int timeStep();
QString wellName() const;
void removeFromMdiAreaAndDeleteViewWidget();
void showPlotLegend(bool doShow);
protected:
// Overridden PDM methods
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
std::set<QString> findSortedWellNames();
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual QImage snapshotWindowContent() override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
void updateFromWell();
std::map<QString, const std::vector<double> *> findRelevantTracerCellFractions(const RigSingleWellResultsData* wellResults);
void updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack);
void addStackedCurve(const QString& tracerName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack);
void updateWidgetTitleWindowTitle();
static QString wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep);
// RimViewWindow overrides
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
virtual void deleteViewWidget() override;
cvf::Color3f getTracerColor(const QString& tracerName);
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<bool> m_groupSmallContributions;
caf::PdmField<double> m_smallContributionsThreshold;
caf::PdmField<caf::AppEnum<FlowType> > m_flowType;
QPointer<RiuWellRftPlot> m_WellRftPlotWidget;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellRftPlotLegend*> m_WellRftPlotLegend;
caf::PdmChildField<RimTofAccumulatedPhaseFractionsPlot*> m_tofAccumulatedPhaseFractionsPlot;
};

View File

@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimWellRftPlotLegend.h"
#include "RimWellRftPlot.h"
CAF_PDM_SOURCE_INIT(RimWellRftPlotLegend, "WellRftPlotLegend");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlotLegend::RimWellRftPlotLegend()
{
CAF_PDM_InitObject("Legend", ":/WellAllocLegend16x16.png", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlotLegend::~RimWellRftPlotLegend()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellRftPlotLegend::objectToggleField()
{
return &m_showLegend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlotLegend::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_showLegend)
{
RimWellRftPlot* walp;
firstAncestorOrThisOfType(walp);
if (walp) walp->showPlotLegend(m_showLegend());
}
}

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmField.h"
#include "cafPdmObject.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellRftPlotLegend : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellRftPlotLegend();
virtual ~RimWellRftPlotLegend();
bool isShowingLegend() { return m_showLegend();}
protected:
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
caf::PdmField<bool> m_showLegend;
};

View File

@ -22,6 +22,7 @@
#include "RimFlowPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryPlotCollection.h"
#include "RimRftPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RiuMainWindow.h"
@ -43,6 +44,9 @@ RimMainPlotCollection::RimMainPlotCollection()
CAF_PDM_InitFieldNoDefault(&m_wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "");
m_wellLogPlotCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_rftPlotCollection, "RftPlotCollection", "", "", "", "");
m_rftPlotCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots", "", "", "");
m_summaryPlotCollection.uiCapability()->setUiHidden(true);
@ -50,6 +54,7 @@ RimMainPlotCollection::RimMainPlotCollection()
m_flowPlotCollection.uiCapability()->setUiHidden(true);
m_wellLogPlotCollection = new RimWellLogPlotCollection();
m_rftPlotCollection = new RimRftPlotCollection();
m_summaryPlotCollection = new RimSummaryPlotCollection();
m_flowPlotCollection = new RimFlowPlotCollection();
@ -61,6 +66,7 @@ RimMainPlotCollection::RimMainPlotCollection()
RimMainPlotCollection::~RimMainPlotCollection()
{
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
if (m_rftPlotCollection()) delete m_rftPlotCollection();
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
if (m_flowPlotCollection()) delete m_flowPlotCollection();
@ -90,6 +96,14 @@ RimWellLogPlotCollection* RimMainPlotCollection::wellLogPlotCollection()
return m_wellLogPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRftPlotCollection* RimMainPlotCollection::rftPlotCollection()
{
return m_rftPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -112,6 +126,7 @@ RimFlowPlotCollection* RimMainPlotCollection::flowPlotCollection()
void RimMainPlotCollection::deleteAllContainedObjects()
{
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
m_rftPlotCollection()->rftPlots.deleteAllChildObjects();
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();

View File

@ -28,6 +28,7 @@
class RimWellLogPlotCollection;
class RimRftPlotCollection;
class RimSummaryPlotCollection;
class RimSummaryPlot;
class RifReaderEclipseSummary;
@ -47,6 +48,7 @@ public:
virtual ~RimMainPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection();
RimRftPlotCollection* rftPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection();
RimFlowPlotCollection* flowPlotCollection();
@ -60,6 +62,7 @@ protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
caf::PdmChildField<RimRftPlotCollection*> m_rftPlotCollection;
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;

View File

@ -56,6 +56,7 @@
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RimRftPlotCollection.h"
#include "RimWellPathCollection.h"
#include "RimWellPathImport.h"
@ -908,7 +909,12 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
}
if (mainPlotCollection->flowPlotCollection())
if (mainPlotCollection->rftPlotCollection())
{
uiTreeOrdering.add(mainPlotCollection->rftPlotCollection());
}
if (mainPlotCollection->flowPlotCollection())
{
uiTreeOrdering.add(mainPlotCollection->flowPlotCollection());
}

View File

@ -0,0 +1,186 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimRftPlotCollection.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimWellLogPlot.h"
#include "RimWellRftPlot.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cvfAssert.h"
CAF_PDM_SOURCE_INIT(RimRftPlotCollection, "WellRftPlotCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRftPlotCollection::RimRftPlotCollection()
{
CAF_PDM_InitObject("RFT Plots", ":/WellLogPlots16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&rftPlots, "RftPlots", "", "", "", "");
rftPlots.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRftPlotCollection::~RimRftPlotCollection()
{
rftPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateSimWellExtractor(const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeom,
const RigEclipseCaseData* eclCaseData)
{
if (!(wellPathGeom && eclCaseData))
{
return nullptr;
}
for (size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx)
{
if (m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom)
{
return m_extractors[exIdx].p();
}
}
std::string errorIdName = (simWellName + " " + caseUserDescription).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor(eclCaseData, wellPathGeom, errorIdName);
m_extractors.push_back(extractor.p());
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase)
{
if (!(wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData()))
{
return NULL;
}
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry();
for (size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx)
{
if (m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom)
{
return m_extractors[exIdx].p();
}
}
std::string errorIdName = (wellPath->name() + " " + eclCase->caseUserDescription()).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor(eclCaseData, wellPathGeom, errorIdName);
m_extractors.push_back(extractor.p());
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* geomCase)
{
if (!(wellPath && geomCase && wellPath->wellPathGeometry() && geomCase->geoMechData()))
{
return NULL;
}
RigGeoMechCaseData* geomCaseData = geomCase->geoMechData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry();
for (size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx)
{
if (m_geomExtractors[exIdx]->caseData() == geomCaseData && m_geomExtractors[exIdx]->wellPathData() == wellPathGeom)
{
return m_geomExtractors[exIdx].p();
}
}
std::string errorIdName = (wellPath->name() + " " + geomCase->caseUserDescription()).toStdString();
cvf::ref<RigGeoMechWellLogExtractor> extractor = new RigGeoMechWellLogExtractor(geomCaseData, wellPathGeom, errorIdName);
m_geomExtractors.push_back(extractor.p());
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::removeExtractors(const RigWellPath* wellPath)
{
for (int eIdx = (int) m_extractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_extractors[eIdx]->wellPathData() == wellPath)
{
m_extractors.eraseAt(eIdx);
}
}
for (int eIdx = (int) m_geomExtractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_geomExtractors[eIdx]->wellPathData() == wellPath)
{
m_geomExtractors.eraseAt(eIdx);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::removeExtractors(const RigEclipseCaseData* caseData)
{
for (int eIdx = (int) m_extractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_extractors[eIdx]->caseData() == caseData)
{
m_extractors.eraseAt(eIdx);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::removeExtractors(const RigGeoMechCaseData* caseData)
{
for (int eIdx = (int) m_geomExtractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_geomExtractors[eIdx]->caseData() == caseData)
{
m_geomExtractors.eraseAt(eIdx);
}
}
}

View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmChildArrayField.h"
#include "cvfCollection.h"
class RimWellLogPlot;
class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor;
class RimGeoMechCase;
class RigEclipseCaseData;
class RigGeoMechCaseData;
class RigWellPath;
class RimWellPath;
class RimEclipseCase;
class RiuWellLogPlot;
class RimWellRftPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimRftPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimRftPlotCollection();
virtual ~RimRftPlotCollection();
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor(const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeom,
const RigEclipseCaseData* eclCaseData);
RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase);
RigGeoMechWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* eclCase);
void removeExtractors(const RigWellPath* wellPath);
void removeExtractors(const RigEclipseCaseData* caseData);
void removeExtractors(const RigGeoMechCaseData* caseData);
caf::PdmChildArrayField<RimWellRftPlot*> rftPlots;
private:
cvf::Collection<RigEclipseWellLogExtractor> m_extractors;
cvf::Collection<RigGeoMechWellLogExtractor> m_geomExtractors;
};

View File

@ -45,6 +45,7 @@ ${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.h
${CEE_CURRENT_LIST_DIR}RiuEditPerforationCollectionWidget.h
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
${CEE_CURRENT_LIST_DIR}RiuWellRftPlot.h
${CEE_CURRENT_LIST_DIR}RiuFlowCharacteristicsPlot.h
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.h
${CEE_CURRENT_LIST_DIR}RiuMessagePanel.h
@ -92,6 +93,7 @@ ${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RiuEditPerforationCollectionWidget.cpp
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.cpp
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.cpp
${CEE_CURRENT_LIST_DIR}RiuWellRftPlot.cpp
${CEE_CURRENT_LIST_DIR}RiuFlowCharacteristicsPlot.cpp
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.cpp
${CEE_CURRENT_LIST_DIR}RiuMessagePanel.cpp
@ -127,6 +129,7 @@ ${CEE_CURRENT_LIST_DIR}RiuQwtPlotWheelZoomer.h
${CEE_CURRENT_LIST_DIR}RiuEditPerforationCollectionWidget.h
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
${CEE_CURRENT_LIST_DIR}RiuWellRftPlot.h
${CEE_CURRENT_LIST_DIR}RiuFlowCharacteristicsPlot.h
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.h
${CEE_CURRENT_LIST_DIR}RiuMessagePanel.h

View File

@ -325,6 +325,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewRftPlotFeature";
commandIds << "RicShowWellAllocationPlotFeature";
commandIds << "RicPlotProductionRateFeature";
commandIds << "Separator";

View File

@ -0,0 +1,222 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiuWellRftPlot.h"
#include "RiaApplication.h"
#include "RimContextCommandBuilder.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellRftPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiuContextMenuLauncher.h"
#include "RiuNightchartsWidget.h"
#include "RiuPlotObjectPicker.h"
#include "cvfColor3.h"
#include <QBoxLayout>
#include <QContextMenuEvent>
#include <QLabel>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellRftPlot::RiuWellRftPlot(RimWellRftPlot* plotDefinition, QWidget* parent)
: m_plotDefinition(plotDefinition),
QFrame(parent)
{
Q_ASSERT(m_plotDefinition);
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout(mainLayout);
this->layout()->setMargin(0);
this->layout()->setSpacing(2);
m_titleLabel = new QLabel(this);
new RiuPlotObjectPicker(m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot());
QFont font = m_titleLabel->font();
font.setPointSize(14);
font.setBold(true);
m_titleLabel->setFont(font);
// White background
QPalette pal = this->palette();
pal.setColor(QPalette::Background, Qt::white);
this->setAutoFillBackground(true);
this->setPalette(pal);
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter);
auto plotWidgetsLayout = new QHBoxLayout();
auto rightColumnLayout = new QVBoxLayout();
mainLayout->addLayout(plotWidgetsLayout);
plotWidgetsLayout->addLayout(rightColumnLayout);
m_legendWidget = new RiuNightchartsWidget(this);
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
QStringList commandIds;
commandIds << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher(m_legendWidget, commandIds);
rightColumnLayout->addWidget(m_legendWidget);
m_legendWidget->showPie(false);
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot());
new RiuContextMenuLauncher(totalFlowAllocationWidget, commandIds);
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop);
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
rightColumnLayout->addStretch();
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
plotWidgetsLayout->addWidget(wellFlowWidget);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellRftPlot::~RiuWellRftPlot()
{
if (m_plotDefinition)
{
m_plotDefinition->handleMdiWindowClosed();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot* RiuWellRftPlot::ownerPlotDefinition()
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiuWellRftPlot::ownerViewWindow() const
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::showTitle(const QString& title)
{
m_titleLabel->show();
m_titleLabel->setText(title);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::hideTitle()
{
m_titleLabel->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::showLegend(bool doShow)
{
if (doShow)
m_legendWidget->show();
else
m_legendWidget->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::addLegendItem(const QString& name, const cvf::Color3f& color, float value)
{
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
m_legendWidget->addItem(name, sliceColor, value);
m_legendWidget->updateGeometry();
m_legendWidget->update();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::clearLegend()
{
m_legendWidget->clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellRftPlot::minimumSizeHint() const
{
return QSize(0, 100);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
QStringList commandIds;
commandIds << "RicShowContributingWellsFromPlotFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
if (menu.actions().size() > 0)
{
menu.exec(event->globalPos());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellRftPlot::sizeHint() const
{
return QSize(0, 0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::setDefaults()
{
}

View File

@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "qwt_plot.h"
#include "cafPdmPointer.h"
#include <QPointer>
#include <QFrame>
#include "RiuInterfaceToViewWindow.h"
class RimWellRftPlot;
class RiuNightchartsWidget;
class QLabel;
namespace cvf {
class Color3f;
}
//==================================================================================================
//
//
//
//==================================================================================================
class RiuWellRftPlot : public QFrame, public RiuInterfaceToViewWindow
{
Q_OBJECT;
public:
RiuWellRftPlot(RimWellRftPlot* plotDefinition, QWidget* parent = NULL);
virtual ~RiuWellRftPlot();
RimWellRftPlot* ownerPlotDefinition();
virtual RimViewWindow* ownerViewWindow() const override;
void showTitle(const QString& title);
void hideTitle();
void showLegend(bool doShow);
void addLegendItem(const QString& name, const cvf::Color3f& color, float value);
void clearLegend();
protected:
virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override;
virtual void contextMenuEvent(QContextMenuEvent *) override;
private:
void setDefaults();
private:
caf::PdmPointer<RimWellRftPlot> m_plotDefinition;
QPointer<RiuNightchartsWidget> m_legendWidget;
QPointer<QLabel> m_titleLabel;
};