Added double slider to well path fracture

This commit is contained in:
Magne Sjaastad 2017-01-19 13:50:07 +01:00
parent 66e2bcd6d8
commit 7e78d8f1ae
2 changed files with 38 additions and 0 deletions

View File

@ -22,6 +22,8 @@
#include "RimProject.h"
#include "RimWellPath.h"
#include "cafPdmUiDoubleSliderEditor.h"
CAF_PDM_SOURCE_INIT(RimWellPathFracture, "WellPathFracture");
@ -34,6 +36,7 @@ RimWellPathFracture::RimWellPathFracture(void)
CAF_PDM_InitObject("Fracture", ":/FractureSymbol16x16.png", "", "");
CAF_PDM_InitField( &measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location", "", "", "");
measuredDepth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
}
//--------------------------------------------------------------------------------------------------
@ -90,3 +93,31 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
fractureCenterGroup->add(&m_displayIJK);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{
if (field == &measuredDepth)
{
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
if (myAttr)
{
RimWellPath* rimWellPath = nullptr;
this->firstAncestorOrThisOfType(rimWellPath);
CVF_ASSERT(rimWellPath);
RigWellPath* wellPathGeo = rimWellPath->wellPathGeometry();
CVF_ASSERT(wellPathGeo);
{
if (wellPathGeo->m_measuredDepths.size() > 2)
{
myAttr->m_minimum = wellPathGeo->m_measuredDepths.front();
myAttr->m_maximum = wellPathGeo->m_measuredDepths.back();
}
}
}
}
}

View File

@ -20,6 +20,11 @@
#include "RimFracture.h"
namespace caf {
class PdmFieldHandle;
class PdmUiEditorAttribute;
}
//==================================================================================================
///
///
@ -38,4 +43,6 @@ public:
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
};