#3459 Set initial start and end depth from well path

This commit is contained in:
Gaute Lindkvist 2018-10-05 10:26:26 +02:00
parent fbc49e2b02
commit 461e3b87b8
3 changed files with 32 additions and 7 deletions

View File

@ -62,7 +62,14 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
{
RimWellPathAttributeCollection* attributeCollection = nullptr;
attributes[0]->firstAncestorOrThisOfTypeAsserted(attributeCollection);
attributeCollection->insertAttribute(attributes[0], new RimWellPathAttribute);
RimWellPathAttribute* attribute = new RimWellPathAttribute;
RimWellPath* wellPath = nullptr;
attributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
attribute->setDepthsFromWellPath(wellPath);
attributeCollection->insertAttribute(attributes[0], attribute);
attributeCollection->updateAllRequiredEditors();
return;
}
@ -74,7 +81,10 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
wellPath->descendantsIncludingThisOfType(attributeCollections);
if (!attributeCollections.empty())
{
attributeCollections[0]->insertAttribute(nullptr, new RimWellPathAttribute);
RimWellPathAttribute* attribute = new RimWellPathAttribute;
attribute->setDepthsFromWellPath(wellPath);
attributeCollections[0]->insertAttribute(nullptr, attribute);
attributeCollections[0]->updateAllRequiredEditors();
}
}

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathAttribute.h"
#include "RigWellPath.h"
#include "RimWellPathAttributeCollection.h"
#include "RimWellPath.h"
@ -48,8 +49,8 @@ RimWellPathAttribute::RimWellPathAttribute()
{
CAF_PDM_InitObject("RimWellPathAttribute", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_type, "AttributeType", "Type ", "", "", "");
CAF_PDM_InitField(&m_depthStart, "DepthStart", 0.0, "Start MD", "", "", "");
CAF_PDM_InitField(&m_depthEnd, "DepthEnd", 0.0, "End MD", "", "", "");
CAF_PDM_InitField(&m_depthStart, "DepthStart", -1.0, "Start MD", "", "", "");
CAF_PDM_InitField(&m_depthEnd, "DepthEnd", -1.0, "End MD", "", "", "");
CAF_PDM_InitField(&m_diameterInInches, "DiameterInInches", MAX_DIAMETER_IN_INCHES, "Diameter", "", "", "");
m_diameterInInches.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
}
@ -133,6 +134,15 @@ bool RimWellPathAttribute::operator<(const RimWellPathAttribute& rhs) const
return depthEnd() > rhs.depthEnd();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathAttribute::setDepthsFromWellPath(const RimWellPath* wellPath)
{
m_depthStart = wellPath->wellPathGeometry()->measureDepths().front();
m_depthEnd = wellPath->wellPathGeometry()->measureDepths().back();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -186,7 +196,9 @@ void RimWellPathAttribute::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
{
if (m_type() == AttributeCasing)
{
m_depthStart = 0;
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted(wellPath);
m_depthStart = wellPath->wellPathGeometry()->measureDepths().front();
}
}

View File

@ -25,6 +25,8 @@
#include <QString>
class RimWellPath;
class RimWellPathAttribute : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
@ -45,7 +47,7 @@ public:
AttributeFishbonesInterval,
AttributeAICD,
AttributeICD,
AttributeICV,
AttributeICV
};
typedef caf::AppEnum<AttributeType> AttributeTypeEnum;
@ -59,6 +61,7 @@ public:
QString label() const;
QString diameterLabel() const;
bool operator<(const RimWellPathAttribute& rhs) const;
void setDepthsFromWellPath(const RimWellPath* wellPath);
private:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;