pre-proto - For WellPathFractures, position along well path is updated when setting a new value for measured depth

This commit is contained in:
astridkbjorke 2017-01-04 13:29:25 +01:00
parent 8c5ee201c0
commit 996aebc7ac
4 changed files with 65 additions and 1 deletions

View File

@ -49,7 +49,7 @@ RimWellPathFracture::RimWellPathFracture(void)
CAF_PDM_InitField(&name, "UserDescription", QString("Fracture Name"), "Name", "", "", "");
CAF_PDM_InitField( &measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location (if along well path)", "", "", "");
CAF_PDM_InitField( &positionAtWellpath, "PositionAtWellpath", cvf::Vec3d::ZERO, "Fracture Position at Well Path", "", "", "");
CAF_PDM_InitField( &positionAtWellpath, "PositionAtWellpath", cvf::Vec3d::ZERO, "Fracture Position along Well Path", "", "", "");
CAF_PDM_InitFieldNoDefault(&ui_positionAtWellpath, "ui_positionAtWellpath", "Fracture Position at Well Path", "", "", "");
ui_positionAtWellpath.registerGetMethod(this, &RimWellPathFracture::wellPositionForUi);
@ -120,6 +120,29 @@ RimFractureDefinition* RimWellPathFracture::attachedFractureDefinition()
return fractureDefinition();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &measuredDepth)
{
positionAtWellpath = cvf::Vec3d::ZERO;
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(this);
if (!objHandle) return;
RimWellPath* wellPath = nullptr;
objHandle->firstAncestorOrThisOfType(wellPath);
if (!wellPath) return;
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
positionAtWellpath = wellPathGeometry->interpolatedPointAlongWellPath(measuredDepth);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -59,6 +59,7 @@ public:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
// Overrides from RimFracture
virtual cvf::Vec3d centerPointForFracture() override;

View File

@ -52,3 +52,42 @@ double RigWellPath::datumElevation() const
return m_datumElevation;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigWellPath::interpolatedPointAlongWellPath(double measuredDepth)
{
cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO;
if (measuredDepth < 0) return wellPathPoint;
int i = 0;
while (i < m_measuredDepths.size() && m_measuredDepths.at(i) < measuredDepth )
{
i++;
}
if (m_measuredDepths.size() > i)
{
if (i == 0)
{
//For measuredDepth=0 use startpoint
wellPathPoint = m_wellPathPoints.at(0);
}
else
{
//Do interpolation
double stepsize = (measuredDepth - m_measuredDepths.at(i-1)) /
(m_measuredDepths.at(i) - m_measuredDepths.at(i - 1));
wellPathPoint = m_wellPathPoints.at(i - 1) + stepsize * (m_wellPathPoints.at(i) - m_wellPathPoints.at(i-1));
}
}
else
{
//Use endpoint if measuredDepth same or higher than last point
wellPathPoint = m_wellPathPoints.at(i-1);
}
return wellPathPoint;
}

View File

@ -40,6 +40,7 @@ public:
void setDatumElevation(double value);
bool hasDatumElevation() const;
double datumElevation() const;
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth);
private:
bool m_hasDatumElevation;