#7026 Handle backward compatibility for ellipsis templates

This commit is contained in:
Kristian Bendiksen 2021-01-28 13:45:14 +01:00 committed by Magne Sjaastad
parent 58f6619b2c
commit 94dfec1c9d
3 changed files with 35 additions and 0 deletions

View File

@ -516,3 +516,23 @@ double RimEllipseFractureTemplate::computeHeightOffset( double wellPathDepthAtFr
{
return ( height() * m_heightScaleFactor / 2 ) - wellPathDepthAtFractureRange;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::initAfterRead()
{
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2020.10.2" ) )
{
m_wellPathDepthAtFracture = computeLegacyWellDepthAtFracture();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimEllipseFractureTemplate::computeLegacyWellDepthAtFracture() const
{
// Set intersection depth to half of height to place ellipsis centered on the well path
return height() * m_heightScaleFactor / 2;
}

View File

@ -60,6 +60,8 @@ public:
double height() const;
double width() const;
double computeLegacyWellDepthAtFracture() const;
void appendDataToResultStatistics( const QString& uiResultName,
const QString& unit,
MinMaxAccumulator& minMaxAccumulator,
@ -76,6 +78,8 @@ private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void initAfterRead() override;
void onLoadDataAndUpdateGeometryHasChanged() override;
std::vector<cvf::Vec3f> fractureBorderPolygon( double wellPathDepthAtFracture ) const;

View File

@ -929,10 +929,21 @@ void RimFracture::initAfterRead()
{
RimStimPlanFractureTemplate* stimPlanFracTemplate =
dynamic_cast<RimStimPlanFractureTemplate*>( m_fractureTemplate() );
RimEllipseFractureTemplate* ellipseFracTemplate =
dynamic_cast<RimEllipseFractureTemplate*>( m_fractureTemplate() );
if ( stimPlanFracTemplate )
{
m_wellPathDepthAtFracture = stimPlanFracTemplate->wellPathDepthAtFracture();
}
else if ( ellipseFracTemplate )
{
// This is a bit awkward, but initAfterRead for the templates
// happens after initAfterRead for the fracture. The value
// has not been corrected in the template at this point, so we
// have to calculate it explicitly.
m_wellPathDepthAtFracture = ellipseFracTemplate->computeLegacyWellDepthAtFracture();
}
}
}
}