mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merged in VFP-tables commit 95f1742eab2b9dae391a253a5452b0f143d07abd.
This commit is contained in:
parent
a180fc431b
commit
d1fc39a51c
@ -77,6 +77,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.h
|
||||
@ -241,6 +243,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimVfpPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimVfpPlotCollection.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
@ -98,6 +99,9 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_stimPlanModelPlotCollection, "StimPlanModelPlotCollection", "", "", "", "" );
|
||||
m_stimPlanModelPlotCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpPlotCollection, "VfpPlotCollection", "", "", "", "" );
|
||||
m_vfpPlotCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
||||
m_rftPlotCollection = new RimRftPlotCollection();
|
||||
m_pltPlotCollection = new RimPltPlotCollection();
|
||||
@ -110,6 +114,7 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
m_analysisPlotCollection = new RimAnalysisPlotCollection;
|
||||
m_correlationPlotCollection = new RimCorrelationPlotCollection;
|
||||
m_stimPlanModelPlotCollection = new RimStimPlanModelPlotCollection;
|
||||
m_vfpPlotCollection = new RimVfpPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -208,6 +213,14 @@ RimMultiPlotCollection* RimMainPlotCollection::multiPlotCollection()
|
||||
return m_multiPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlotCollection* RimMainPlotCollection::vfpPlotCollection()
|
||||
{
|
||||
return m_vfpPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -246,6 +259,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
m_saturationPressurePlotCollection()->deleteAllChildObjects();
|
||||
m_multiPlotCollection()->deleteAllChildObjects();
|
||||
m_vfpPlotCollection()->deleteAllChildObjects();
|
||||
m_analysisPlotCollection()->deleteAllPlots();
|
||||
m_correlationPlotCollection()->deleteAllPlots();
|
||||
m_stimPlanModelPlotCollection()->deleteAllPlots();
|
||||
|
@ -41,6 +41,7 @@ class RimEclipseResultCase;
|
||||
class RimFlowPlotCollection;
|
||||
class RimSaturationPressurePlotCollection;
|
||||
class RimStimPlanModelPlotCollection;
|
||||
class RimVfpPlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -66,6 +67,7 @@ public:
|
||||
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
|
||||
RimMultiPlotCollection* multiPlotCollection();
|
||||
RimStimPlanModelPlotCollection* stimPlanModelPlotCollection();
|
||||
RimVfpPlotCollection* vfpPlotCollection();
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
void updateCurrentTimeStepInPlots();
|
||||
@ -93,6 +95,7 @@ private:
|
||||
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
|
||||
caf::PdmChildField<RimMultiPlotCollection*> m_multiPlotCollection;
|
||||
caf::PdmChildField<RimStimPlanModelPlotCollection*> m_stimPlanModelPlotCollection;
|
||||
caf::PdmChildField<RimVfpPlotCollection*> m_vfpPlotCollection;
|
||||
|
||||
caf::PdmField<bool> m_show;
|
||||
};
|
||||
|
@ -81,6 +81,7 @@
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimValveTemplate.h"
|
||||
#include "RimValveTemplateCollection.h"
|
||||
#include "RimVfpPlotCollection.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimViewWindow.h"
|
||||
@ -1453,6 +1454,11 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
{
|
||||
itemCollection->add( mainPlotCollection->stimPlanModelPlotCollection() );
|
||||
}
|
||||
|
||||
if ( mainPlotCollection->vfpPlotCollection() )
|
||||
{
|
||||
itemCollection->add( mainPlotCollection->vfpPlotCollection() );
|
||||
}
|
||||
}
|
||||
|
||||
uiTreeOrdering.add( scriptCollection() );
|
||||
|
472
ApplicationCode/ProjectDataModel/RimVfpPlot.cpp
Normal file
472
ApplicationCode/ProjectDataModel/RimVfpPlot.cpp
Normal file
@ -0,0 +1,472 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor 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 "RimVfpPlot.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_legend_label.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "cvfDebugTimer.h"
|
||||
#include "cvfTrace.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimVfpPlot, "VfpPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot::RimVfpPlot()
|
||||
{
|
||||
// TODO: add icon
|
||||
CAF_PDM_InitObject( "VFP Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
|
||||
|
||||
m_showWindow = false;
|
||||
m_showPlotLegends = true;
|
||||
|
||||
setAsPlotMdiWindow();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlot::~RimVfpPlot()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::setDataSourceParameters( RimEclipseResultCase* eclipseResultCase, QString targetWellName )
|
||||
{
|
||||
m_case = eclipseResultCase;
|
||||
m_wellName = targetWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimVfpPlot::viewer()
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::setAutoScaleXEnabled( bool /*enabled*/ )
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::setAutoScaleXEnabled()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::setAutoScaleYEnabled( bool /*enabled*/ )
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::setAutoScaleYEnabled()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::updateAxes()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::updateAxes()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::updateLegend()
|
||||
{
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide the legend when in multiplot mode, as the legend is handeled by the multi plot grid layout
|
||||
bool doShowLegend = false;
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
doShowLegend = m_showPlotLegends;
|
||||
}
|
||||
|
||||
if ( doShowLegend )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->insertLegend( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::updateZoomInQwt()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::updateZoomInQwt()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::updateZoomFromQwt()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::updateZoomFromQwt()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimVfpPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::asciiDataForPlotExport()" );
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::reattachAllCurves()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::reattachAllCurves()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::detachAllCurves()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::detachAllCurves()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimVfpPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::findPdmObjectFromQwtCurve()" );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ )
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::onAxisSelected()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimVfpPlot::description() const
|
||||
{
|
||||
return uiName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimVfpPlot::viewWidget()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::viewWidget()" );
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimVfpPlot::snapshotWindowContent()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::snapshotWindowContent()" );
|
||||
|
||||
QImage image;
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
QPixmap pix = m_plotWidget->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::zoomAll()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::zoomAll()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::doRemoveFromCollection()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::doRemoveFromCollection()" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::createViewWidget()" );
|
||||
|
||||
// It seems we risk being called multiple times
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
// m_plotWidget->setAutoReplot( false );
|
||||
|
||||
updateLegend();
|
||||
onLoadDataAndUpdate();
|
||||
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::deleteViewWidget()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::deleteViewWidget()" );
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setParent( nullptr );
|
||||
delete m_plotWidget;
|
||||
m_plotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::onLoadDataAndUpdate()" );
|
||||
cvf::DebugTimer tim( "RimVfpPlot::onLoadDataAndUpdate()" );
|
||||
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
|
||||
updateLegend();
|
||||
|
||||
QString phaseString = "N/A";
|
||||
if ( m_case && m_case->ensureReservoirCaseIsOpen() )
|
||||
{
|
||||
// TODO: extract data from data file
|
||||
|
||||
// TODO: populate with real data
|
||||
populatePlotWidgetWithCurveData( m_plotWidget );
|
||||
|
||||
// TODO: Maybe display the phase?
|
||||
// if ( m_phase == RiaDefines::OIL_PHASE )
|
||||
// phaseString = "Oil";
|
||||
// else if ( m_phase == RiaDefines::GAS_PHASE )
|
||||
// phaseString = "Gas";
|
||||
// else if ( m_phase == RiaDefines::WATER_PHASE )
|
||||
// phaseString = "Water";
|
||||
}
|
||||
|
||||
const QString plotTitleStr = QString( "%1 Vertical Flow Performance Plot" ).arg( m_wellName );
|
||||
m_plotWidget->setTitle( plotTitleStr );
|
||||
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Liquid Flow Rate [sm3/d]" );
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Bottom Hole Pressure [Bar]" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
cvf::Trace::show( "RimVfpPlot::populatePlotWidgetWithCurves()" );
|
||||
|
||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
|
||||
size_t numTables = 4;
|
||||
|
||||
for ( size_t i = 0; i < numTables; i++ )
|
||||
{
|
||||
// Just create some dummy values for now
|
||||
int numDummyValues = 100;
|
||||
std::vector<double> xVals( numDummyValues, 10 * i );
|
||||
std::vector<double> yVals( numDummyValues, 100 * i );
|
||||
|
||||
cvf::Color3f cvfClr = cvf::Color3::BLUE;
|
||||
QColor qtClr = RiaColorTools::toQColor( cvfClr );
|
||||
|
||||
QwtPlotCurve* curve = new QwtPlotCurve;
|
||||
curve->setTitle( QString( "Table: %1" ).arg( i ) );
|
||||
curve->setBrush( qtClr );
|
||||
|
||||
curve->setSamples( xVals.data(), yVals.data(), numDummyValues );
|
||||
curve->attach( plotWidget );
|
||||
curve->show();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_case );
|
||||
uiOrdering.add( &m_wellName );
|
||||
|
||||
RimPlot::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimVfpPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::QIconProvider simWellIcon( ":/Well.png" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, true, simWellIcon ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_case )
|
||||
{
|
||||
fixupDependentFieldsAfterCaseChange();
|
||||
}
|
||||
|
||||
loadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::fixupDependentFieldsAfterCaseChange()
|
||||
{
|
||||
QString newWellName;
|
||||
|
||||
if ( m_case )
|
||||
{
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
}
|
||||
|
||||
m_wellName = newWellName;
|
||||
}
|
95
ApplicationCode/ProjectDataModel/RimVfpPlot.h
Normal file
95
ApplicationCode/ProjectDataModel/RimVfpPlot.h
Normal file
@ -0,0 +1,95 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor 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 "RimPlot.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class RigTofWellDistributionCalculator;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Vertical Flow Performance Plot
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimVfpPlot : public RimPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimVfpPlot();
|
||||
~RimVfpPlot() override;
|
||||
|
||||
void setDataSourceParameters( RimEclipseResultCase* eclipseResultCase, QString targetWellName );
|
||||
// void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold, double maximumTof );
|
||||
|
||||
RiaDefines::PhaseType phase() const;
|
||||
|
||||
// RimPlot implementations
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
void updateAxes() override;
|
||||
void updateLegend() override;
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
void reattachAllCurves() override;
|
||||
void detachAllCurves() override;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
// RimPlotWindow implementations
|
||||
QString description() const override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
QWidget* viewWidget() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
|
||||
private:
|
||||
// RimPlot implementations
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override;
|
||||
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
};
|
74
ApplicationCode/ProjectDataModel/RimVfpPlotCollection.cpp
Normal file
74
ApplicationCode/ProjectDataModel/RimVfpPlotCollection.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor 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 "RimVfpPlotCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimVfpPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimVfpPlotCollection, "RimVfpPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlotCollection::RimVfpPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "VFP Plots", ":/SummaryXPlotsLight16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpPlots, "VfpPlots", "Vertical Flow Performance Plots", "", "", "" );
|
||||
m_vfpPlots.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpPlotCollection::~RimVfpPlotCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::addPlot( RimVfpPlot* newPlot )
|
||||
{
|
||||
m_vfpPlots.push_back( newPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimVfpPlot*> RimVfpPlotCollection::plots()
|
||||
{
|
||||
return m_vfpPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlotCollection::deleteAllChildObjects()
|
||||
{
|
||||
m_vfpPlots.deleteAllChildObjects();
|
||||
}
|
43
ApplicationCode/ProjectDataModel/RimVfpPlotCollection.h
Normal file
43
ApplicationCode/ProjectDataModel/RimVfpPlotCollection.h
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- Equinor 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimVfpPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimVfpPlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimVfpPlotCollection();
|
||||
~RimVfpPlotCollection() override;
|
||||
|
||||
void addPlot( RimVfpPlot* newPlot );
|
||||
std::vector<RimVfpPlot*> plots();
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimVfpPlot*> m_vfpPlots;
|
||||
};
|
Loading…
Reference in New Issue
Block a user