mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-10 08:03:05 -06:00
#3208 Improve read only settings in well path target list
This commit is contained in:
parent
a6d91873e6
commit
1d4fef5a8b
@ -148,6 +148,38 @@ void RimWellPathGeometryDef::appendTarget()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimWellPathTarget* RimWellPathGeometryDef::firstActiveTarget() const
|
||||
{
|
||||
for (const RimWellPathTarget* target: m_wellTargets)
|
||||
{
|
||||
if (target->isEnabled())
|
||||
{
|
||||
return target;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimWellPathTarget* RimWellPathGeometryDef::lastActiveTarget() const
|
||||
{
|
||||
if (!m_wellTargets.size()) return nullptr;
|
||||
|
||||
for (int tIdx = static_cast<int>(m_wellTargets.size() - 1); tIdx >= 0 ; --tIdx)
|
||||
{
|
||||
if (m_wellTargets[tIdx]->isEnabled())
|
||||
{
|
||||
return m_wellTargets[tIdx];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
void deleteTarget(RimWellPathTarget* targetTodelete);
|
||||
void appendTarget();
|
||||
|
||||
const RimWellPathTarget* firstActiveTarget() const;
|
||||
const RimWellPathTarget* lastActiveTarget() const;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellPathTarget, "WellPathTarget");
|
||||
|
||||
@ -201,16 +202,46 @@ void RimWellPathTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathTarget::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
if (m_targetType == POINT)
|
||||
if (m_isEnabled())
|
||||
{
|
||||
m_azimuth.uiCapability()->setUiReadOnly(true);
|
||||
m_inclination.uiCapability()->setUiReadOnly(true);
|
||||
m_dogleg1.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
m_targetType.uiCapability()->setUiReadOnly(false);
|
||||
m_targetPoint.uiCapability()->setUiReadOnly(false);
|
||||
m_dogleg2.uiCapability()->setUiReadOnly(false);
|
||||
|
||||
if ( m_targetType == POINT )
|
||||
{
|
||||
m_azimuth.uiCapability()->setUiReadOnly(true);
|
||||
m_inclination.uiCapability()->setUiReadOnly(true);
|
||||
m_dogleg1.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_azimuth.uiCapability()->setUiReadOnly(false);
|
||||
m_inclination.uiCapability()->setUiReadOnly(false);
|
||||
m_dogleg1.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
|
||||
RimWellPathGeometryDef* geomDef = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted(geomDef);
|
||||
|
||||
if ( this == geomDef->firstActiveTarget() )
|
||||
{
|
||||
m_dogleg1.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
|
||||
if ( this == geomDef->lastActiveTarget() )
|
||||
{
|
||||
m_dogleg2.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_azimuth.uiCapability()->setUiReadOnly(false);
|
||||
m_inclination.uiCapability()->setUiReadOnly(false);
|
||||
m_dogleg1.uiCapability()->setUiReadOnly(false);
|
||||
m_dogleg1.uiCapability()->setUiReadOnly(true);
|
||||
m_targetType.uiCapability()->setUiReadOnly(true);
|
||||
m_targetPoint.uiCapability()->setUiReadOnly(true);
|
||||
m_azimuth.uiCapability()->setUiReadOnly(true);
|
||||
m_inclination.uiCapability()->setUiReadOnly(true);
|
||||
m_dogleg2.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user