#1144 - pre-proto - Update perforation length of fracture when value is updated for fracture template

This commit is contained in:
astridkbjorke 2017-02-02 09:20:58 +01:00
parent 30304a5f8a
commit d7e980887a

View File

@ -85,9 +85,10 @@ caf::PdmFieldHandle* RimEllipseFractureTemplate::userDescriptionField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{ {
if (changedField == &halfLength || changedField == &height)
{
if (changedField == &halfLength || changedField == &height || changedField == &azimuthAngle || changedField == &perforationLength)
{
//Changes to one of these parameters should change all fractures with this fracture template attached.
RimProject* proj; RimProject* proj;
this->firstAncestorOrThisOfType(proj); this->firstAncestorOrThisOfType(proj);
if (proj) if (proj)
@ -99,42 +100,34 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
for (RimFracture* fracture : fractures) for (RimFracture* fracture : fractures)
{ {
if (fracture->attachedFractureDefinition() == this) if (fracture->attachedFractureDefinition() == this)
{
if (changedField == &halfLength || changedField == &height)
{ {
fracture->setRecomputeGeometryFlag(); fracture->setRecomputeGeometryFlag();
} }
}
proj->createDisplayModelAndRedrawAllViews(); if (changedField == &azimuthAngle && (abs(oldValue.toDouble() - fracture->azimuth()) < 1e-5))
}
}
if (changedField == &azimuthAngle)
{
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj)
{
std::vector<RimFracture*> fractures;
proj->descendantsIncludingThisOfType(fractures);
for (RimFracture* fracture : fractures)
{
if (fracture->attachedFractureDefinition() == this)
{
if (abs(oldValue.toDouble() - fracture->azimuth()) < 1e-5 )
{ {
fracture->azimuth = azimuthAngle; fracture->azimuth = azimuthAngle;
fracture->setRecomputeGeometryFlag(); fracture->setRecomputeGeometryFlag();
} }
if (changedField == &perforationLength && (abs(oldValue.toDouble() - fracture->perforationLength()) < 1e-5))
{
fracture->perforationLength = perforationLength;
}
} }
} }
proj->createDisplayModelAndRedrawAllViews(); proj->createDisplayModelAndRedrawAllViews();
} }
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------