#7453 StimPlanModel: Add pressure date to pressure table.

Also start using it in header and plot.
This commit is contained in:
Kristian Bendiksen 2021-03-04 15:30:55 +01:00 committed by Magne Sjaastad
parent f051f009bc
commit c1ff038642
7 changed files with 67 additions and 0 deletions

View File

@ -38,6 +38,8 @@ RimPressureTable::RimPressureTable()
m_pressureTableItems.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_pressureTableItems.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
m_pressureTableItems.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_pressureTableItems.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_pressureTableItems.uiCapability()->setCustomContextMenuEnabled( true ); 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 ) void RimPressureTable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
uiOrdering.add( &m_pressureTableItems ); uiOrdering.add( &m_pressureTableItems );
uiOrdering.add( &m_pressureDate );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -154,6 +157,8 @@ void RimPressureTable::fieldChangedByUi( const caf::PdmFieldHandle* changedField
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue ) const QVariant& newValue )
{ {
if ( changedField == &m_pressureDate ) updatePressureDate();
onTableChanged(); onTableChanged();
} }
@ -170,8 +175,27 @@ void RimPressureTable::onTableChanged( const caf::SignalEmitter* emitter )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimPressureTable::initAfterRead() void RimPressureTable::initAfterRead()
{ {
updatePressureDate();
for ( auto item : items() ) for ( auto item : items() )
{ {
item->changed.connect( this, &RimPressureTable::onTableChanged ); 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();
}

View File

@ -44,6 +44,8 @@ public:
void deleteItem( RimPressureTableItem* itemToDelete ); void deleteItem( RimPressureTableItem* itemToDelete );
void deleteAllItems(); void deleteAllItems();
const QString& pressureDate() const;
protected: protected:
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override; void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, void defineEditorAttribute( const caf::PdmFieldHandle* field,
@ -55,8 +57,11 @@ protected:
void onTableChanged( const caf::SignalEmitter* emitter = nullptr ); void onTableChanged( const caf::SignalEmitter* emitter = nullptr );
void updatePressureDate();
void initAfterRead() override; void initAfterRead() override;
private: private:
caf::PdmChildArrayField<RimPressureTableItem*> m_pressureTableItems; caf::PdmChildArrayField<RimPressureTableItem*> m_pressureTableItems;
caf::PdmField<QString> m_pressureDate;
}; };

View File

@ -84,3 +84,14 @@ void RimPressureTableItem::fieldChangedByUi( const caf::PdmFieldHandle* changedF
{ {
changed.send(); 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 ) );
}

View File

@ -40,6 +40,8 @@ public:
double initialPressure() const; double initialPressure() const;
double pressure() const; double pressure() const;
void setPressureDate( const QString& pressureDate );
private: private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;

View File

@ -47,6 +47,7 @@
#include "RimNonNetLayers.h" #include "RimNonNetLayers.h"
#include "RimOilField.h" #include "RimOilField.h"
#include "RimPolylineTarget.h" #include "RimPolylineTarget.h"
#include "RimPressureTable.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimStimPlanModelCalculator.h" #include "RimStimPlanModelCalculator.h"
#include "RimStimPlanModelPlot.h" #include "RimStimPlanModelPlot.h"
@ -1699,3 +1700,18 @@ bool RimStimPlanModel::isScaledByNetToGross( RiaDefines::CurveProperty curveProp
return std::find( matching.begin(), matching.end(), curveProperty ) != matching.end(); 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();
}

View File

@ -180,6 +180,8 @@ public:
bool isScaledByNetToGross( RiaDefines::CurveProperty curveProperty ) const; bool isScaledByNetToGross( RiaDefines::CurveProperty curveProperty ) const;
QString pressureDate() const;
protected: protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,

View File

@ -176,6 +176,13 @@ void RimStimPlanModelCurve::performDataExtraction( bool* isUsingPseudoLength )
QString RimStimPlanModelCurve::createCurveAutoName() QString RimStimPlanModelCurve::createCurveAutoName()
{ {
QString textWithLineFeed = caf::AppEnum<RiaDefines::CurveProperty>::uiText( m_curveProperty() ).trimmed(); 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" ); textWithLineFeed.replace( " ", "\n" );
return textWithLineFeed; return textWithLineFeed;