mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
#7453 StimPlanModel: Add pressure date to pressure table.
Also start using it in header and plot.
This commit is contained in:
parent
f051f009bc
commit
c1ff038642
@ -38,6 +38,8 @@ RimPressureTable::RimPressureTable()
|
||||
m_pressureTableItems.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_pressureTableItems.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
m_pressureTableItems.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_pressureDate, "PressureDate", "Pressure Date", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -137,6 +139,7 @@ void RimPressureTable::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
void RimPressureTable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_pressureTableItems );
|
||||
uiOrdering.add( &m_pressureDate );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -154,6 +157,8 @@ void RimPressureTable::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_pressureDate ) updatePressureDate();
|
||||
|
||||
onTableChanged();
|
||||
}
|
||||
|
||||
@ -170,8 +175,27 @@ void RimPressureTable::onTableChanged( const caf::SignalEmitter* emitter )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPressureTable::initAfterRead()
|
||||
{
|
||||
updatePressureDate();
|
||||
|
||||
for ( auto item : items() )
|
||||
{
|
||||
item->changed.connect( this, &RimPressureTable::onTableChanged );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPressureTable::updatePressureDate()
|
||||
{
|
||||
for ( auto item : items() )
|
||||
item->setPressureDate( m_pressureDate() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RimPressureTable::pressureDate() const
|
||||
{
|
||||
return m_pressureDate();
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ public:
|
||||
void deleteItem( RimPressureTableItem* itemToDelete );
|
||||
void deleteAllItems();
|
||||
|
||||
const QString& pressureDate() const;
|
||||
|
||||
protected:
|
||||
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
@ -55,8 +57,11 @@ protected:
|
||||
|
||||
void onTableChanged( const caf::SignalEmitter* emitter = nullptr );
|
||||
|
||||
void updatePressureDate();
|
||||
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimPressureTableItem*> m_pressureTableItems;
|
||||
caf::PdmField<QString> m_pressureDate;
|
||||
};
|
||||
|
@ -84,3 +84,14 @@ void RimPressureTableItem::fieldChangedByUi( const caf::PdmFieldHandle* changedF
|
||||
{
|
||||
changed.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPressureTableItem::setPressureDate( const QString& pressureDate )
|
||||
{
|
||||
if ( pressureDate.isEmpty() )
|
||||
m_pressure.uiCapability()->setUiName( "Pressure [Bar]" );
|
||||
else
|
||||
m_pressure.uiCapability()->setUiName( QString( "Pressure %1 [Bar]" ).arg( pressureDate ) );
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
double initialPressure() const;
|
||||
double pressure() const;
|
||||
|
||||
void setPressureDate( const QString& pressureDate );
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "RimNonNetLayers.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimPressureTable.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimStimPlanModelCalculator.h"
|
||||
#include "RimStimPlanModelPlot.h"
|
||||
@ -1699,3 +1700,18 @@ bool RimStimPlanModel::isScaledByNetToGross( RiaDefines::CurveProperty curveProp
|
||||
|
||||
return std::find( matching.begin(), matching.end(), curveProperty ) != matching.end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimStimPlanModel::pressureDate() const
|
||||
{
|
||||
if ( !m_stimPlanModelTemplate ) return QString();
|
||||
|
||||
if ( m_stimPlanModelTemplate->usePressureTableForProperty( RiaDefines::CurveProperty::PRESSURE ) )
|
||||
return m_stimPlanModelTemplate->pressureTable()->pressureDate();
|
||||
else if ( m_eclipseCase && m_timeStep >= 0 && m_timeStep < m_eclipseCase->timeStepStrings().size() )
|
||||
return m_eclipseCase->timeStepStrings()[m_timeStep];
|
||||
else
|
||||
return QString();
|
||||
}
|
||||
|
@ -180,6 +180,8 @@ public:
|
||||
|
||||
bool isScaledByNetToGross( RiaDefines::CurveProperty curveProperty ) const;
|
||||
|
||||
QString pressureDate() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
|
@ -176,6 +176,13 @@ void RimStimPlanModelCurve::performDataExtraction( bool* isUsingPseudoLength )
|
||||
QString RimStimPlanModelCurve::createCurveAutoName()
|
||||
{
|
||||
QString textWithLineFeed = caf::AppEnum<RiaDefines::CurveProperty>::uiText( m_curveProperty() ).trimmed();
|
||||
if ( m_curveProperty == RiaDefines::CurveProperty::PRESSURE )
|
||||
{
|
||||
// Append date for pressure
|
||||
QString pressureDate = m_stimPlanModel->pressureDate();
|
||||
if ( !pressureDate.isEmpty() ) return QString( "%1 (%2)" ).arg( textWithLineFeed ).arg( pressureDate );
|
||||
}
|
||||
|
||||
textWithLineFeed.replace( " ", "\n" );
|
||||
|
||||
return textWithLineFeed;
|
||||
|
Loading…
Reference in New Issue
Block a user