Rename and moved azimuth updates to RimFracture

This commit is contained in:
Magne Sjaastad
2017-02-23 09:47:30 +01:00
parent 855960287d
commit 7717bf925f
9 changed files with 65 additions and 44 deletions

View File

@@ -97,7 +97,39 @@ caf::PdmFieldHandle* RimFractureTemplate::userDescriptionField()
//--------------------------------------------------------------------------------------------------
void RimFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &azimuthAngle || changedField == &orientation)
{
//Changes to one of these parameters should change all fractures with this fracture template attached.
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj)
{
//Regenerate geometry
std::vector<RimFracture*> fractures;
proj->descendantsIncludingThisOfType(fractures);
for (RimFracture* fracture : fractures)
{
if (fracture->attachedFractureDefinition() == this)
{
if (changedField == &azimuthAngle && (abs(oldValue.toDouble() - fracture->azimuth()) < 1e-5))
{
fracture->updateAzimuthFromFractureDefinition();
fracture->setRecomputeGeometryFlag();
}
if (changedField == &orientation)
{
fracture->updateAzimuthFromFractureDefinition();
fracture->setRecomputeGeometryFlag();
}
}
}
proj->createDisplayModelAndRedrawAllViews();
}
}
}