mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-05 21:56:46 -06:00
Custom vfp plot (#11450)
* AppFwk: When clearing a tree selection, make sure all values are cleared * Fix deprecated implicit lambda * Add support for using the closest value in addition to exact match * Add table data source object and add plot with multiple data sources Delete the temporary RimVfpDeck class Add RimVfpTable to represent a table in a data source Add plot able to show data from multiple tables * AppFwk: Make it possible to call resolveReferences multiple times Use case: Vfp tables are stored in files. Multiple tables can be present in one file. Pdm table objects are created after resolve references is done as part of parsing file. When the Pdm object are created, resolveReferences can be called once more. * Call resolveReferencesRecursively() after RimVfpTable objects are created
This commit is contained in:
1 parent
2fb54ac1ec
commit
1d57b9032b
38 files changed
+2206
-375
No files matched your search
@@ -30,6 +30,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimVfpDataCollection.h"
|
||||
#include "RimVfpDefines.h"
|
||||
#include "RimVfpTable.h"
|
||||
#include "RimVfpTableData.h"
|
||||
#include "Tools/RimPlotAxisTools.h"
|
||||
|
||||
@@ -72,7 +73,7 @@ RimVfpPlot::RimVfpPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath_OBSOLETE, "FilePath", "File Path" );
|
||||
m_filePath_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpTableData, "VfpTableData", "VFP Data Source" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_vfpTable, "VfpTableData", "VFP Data Source" );
|
||||
|
||||
caf::AppEnum<RimVfpDefines::TableType> defaultTableType = RimVfpDefines::TableType::INJECTION;
|
||||
CAF_PDM_InitField( &m_tableType, "TableType", defaultTableType, "Table Type" );
|
||||
@@ -140,8 +141,6 @@ RimVfpPlot::RimVfpPlot()
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
setDeletable( true );
|
||||
|
||||
m_vfpTables = std::make_unique<RigVfpTables>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -156,9 +155,9 @@ RimVfpPlot::~RimVfpPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::setDataSource( RimVfpTableData* vfpTableData )
|
||||
void RimVfpPlot::setDataSource( RimVfpTable* vfpTableData )
|
||||
{
|
||||
m_vfpTableData = vfpTableData;
|
||||
m_vfpTable = vfpTableData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -176,7 +175,7 @@ void RimVfpPlot::initializeObject()
|
||||
{
|
||||
if ( !vfpTables() ) return;
|
||||
|
||||
auto tableNumber = m_tableNumber();
|
||||
auto tableNumber = m_vfpTable->tableNumber();
|
||||
|
||||
// Always use the available table number if only one table is available
|
||||
auto prodTableNumbers = vfpTables()->productionTableNumbers();
|
||||
@@ -284,9 +283,9 @@ QString RimVfpPlot::asciiDataForPlotExport() const
|
||||
|
||||
QString wellName;
|
||||
|
||||
if ( m_vfpTableData )
|
||||
if ( m_vfpTable )
|
||||
{
|
||||
wellName = m_vfpTableData->name();
|
||||
wellName = m_vfpTable->name();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -423,10 +422,10 @@ RiuPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
auto wheelZoomer = new RiuQwtPlotWheelZoomer( qwtPlot );
|
||||
|
||||
// Use lambda functions to connect signals to functions instead of slots
|
||||
connect( wheelZoomer, &RiuQwtPlotWheelZoomer::zoomUpdated, [=]() { onPlotZoomed(); } );
|
||||
connect( plotZoomer, &RiuQwtPlotZoomer::zoomed, [=]() { onPlotZoomed(); } );
|
||||
connect( panner, &QwtPlotPanner::panned, [=]() { onPlotZoomed(); } );
|
||||
connect( qwtPlotWidget, &RiuQwtPlotWidget::plotZoomed, [=]() { onPlotZoomed(); } );
|
||||
connect( wheelZoomer, &RiuQwtPlotWheelZoomer::zoomUpdated, [=, this]() { onPlotZoomed(); } );
|
||||
connect( plotZoomer, &RiuQwtPlotZoomer::zoomed, [=, this]() { onPlotZoomed(); } );
|
||||
connect( panner, &QwtPlotPanner::panned, [=, this]() { onPlotZoomed(); } );
|
||||
connect( qwtPlotWidget, &RiuQwtPlotWidget::plotZoomed, [=, this]() { onPlotZoomed(); } );
|
||||
|
||||
// Remove event filter to disable unwanted highlighting on left click in plot.
|
||||
qwtPlotWidget->removeEventFilter();
|
||||
@@ -479,7 +478,7 @@ void RimVfpPlot::onLoadDataAndUpdate()
|
||||
|
||||
if ( vfpTables() )
|
||||
{
|
||||
wellName = m_vfpTableData->baseFileName();
|
||||
wellName = vfpTableData()->baseFileName();
|
||||
|
||||
auto vfpPlotData = vfpTables()->populatePlotData( m_tableNumber(),
|
||||
m_primaryVariable(),
|
||||
@@ -663,20 +662,25 @@ void RimVfpPlot::initializeFromInitData( const VfpTableInitialData& table )
|
||||
m_flowingWaterFraction = table.waterFraction;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimVfpTableData* RimVfpPlot::vfpTableData() const
|
||||
{
|
||||
if ( m_vfpTable ) return m_vfpTable->dataSource();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigVfpTables* RimVfpPlot::vfpTables() const
|
||||
{
|
||||
if ( m_vfpTableData )
|
||||
if ( vfpTableData() )
|
||||
{
|
||||
m_vfpTableData->ensureDataIsImported();
|
||||
return m_vfpTableData->vfpTables();
|
||||
}
|
||||
|
||||
if ( m_vfpTables )
|
||||
{
|
||||
return m_vfpTables.get();
|
||||
vfpTableData()->ensureDataIsImported();
|
||||
return vfpTableData()->vfpTables();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -739,7 +743,7 @@ QString RimVfpPlot::getDisplayUnit( RimVfpDefines::ProductionVariableType variab
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimVfpPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_vfpTableData );
|
||||
uiOrdering.add( &m_vfpTable );
|
||||
|
||||
uiOrdering.add( &m_tableType );
|
||||
uiOrdering.add( &m_tableNumber );
|
||||
@@ -813,7 +817,7 @@ QList<caf::PdmOptionItemInfo> RimVfpPlot::calculateValueOptions( const caf::PdmF
|
||||
calculateTableValueOptions( RimVfpDefines::ProductionVariableType::GAS_LIQUID_RATIO, options );
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_vfpTableData )
|
||||
else if ( fieldNeedingOptions == &m_vfpTable )
|
||||
{
|
||||
RimVfpDataCollection* vfpDataCollection = RimVfpDataCollection::instance();
|
||||
for ( auto table : vfpDataCollection->vfpTableData() )
|
||||
@@ -850,6 +854,11 @@ void RimVfpPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
|
||||
{
|
||||
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_vfpTable )
|
||||
{
|
||||
initializeObject();
|
||||
}
|
||||
|
||||
loadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user