#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)
{
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;
this->firstAncestorOrThisOfType(proj);
if (proj)
@ -100,41 +101,33 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
{
if (fracture->attachedFractureDefinition() == this)
{
fracture->setRecomputeGeometryFlag();
}
}
if (changedField == &halfLength || changedField == &height)
{
fracture->setRecomputeGeometryFlag();
}
proj->createDisplayModelAndRedrawAllViews();
}
}
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 )
if (changedField == &azimuthAngle && (abs(oldValue.toDouble() - fracture->azimuth()) < 1e-5))
{
fracture->azimuth = azimuthAngle;
fracture->setRecomputeGeometryFlag();
}
if (changedField == &perforationLength && (abs(oldValue.toDouble() - fracture->perforationLength()) < 1e-5))
{
fracture->perforationLength = perforationLength;
}
}
}
proj->createDisplayModelAndRedrawAllViews();
}
}
}
//--------------------------------------------------------------------------------------------------