ResInsight/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTableItem.cpp
Magne Sjaastad 273e416b40 Python adjustments (#7809)
* #7797 Well Targets: Add scripting capability
* #7794 Python : Do not update childField or childFieldArray
* #7797: Python - Add scripting to well path collection
- Extend the pdmobject.py with method add_object()
- allow objects to be created from Python in well path collections
- add well targets to modelled well path

* #7795 Python : Make sure referenced generated classes are defined
* #7810 StimPlanModel: clean-up python generation
* Python : Always use empty string as default value for ptrFieldValue
It can happen that a ptrField is assigned to a pointer on object construction. (FaciesProperties) Make sure that constructor always assigns an empty string.

Co-authored-by: magnesj <magnesj@users.noreply.github.com>
Co-authored-by: Kristian Bendiksen <kristian.bendiksen@gmail.com>
2021-06-25 14:28:41 +02:00

102 lines
4.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - 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 "RimPressureTableItem.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiLineEditor.h"
CAF_PDM_SOURCE_INIT( RimPressureTableItem, "PressureTableItem" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTableItem::RimPressureTableItem()
: changed( this )
{
CAF_PDM_InitScriptableObject( "Pressure Table Item", "", "", "" );
CAF_PDM_InitScriptableField( &m_depth, "Depth", 0.0, "Depth TVDMSL [m]", "", "", "" );
CAF_PDM_InitScriptableField( &m_initialPressure, "InitialPressure", 0.0, "Initial Pressure [Bar]", "", "", "" );
CAF_PDM_InitScriptableField( &m_pressure, "Pressure", 0.0, "Pressure [Bar]", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTableItem::~RimPressureTableItem()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTableItem::setValues( double depth, double initialPressure, double pressure )
{
m_depth = depth;
m_initialPressure = initialPressure;
m_pressure = pressure;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPressureTableItem::depth() const
{
return m_depth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPressureTableItem::initialPressure() const
{
return m_initialPressure;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPressureTableItem::pressure() const
{
return m_pressure;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTableItem::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
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 ) );
}