#7026 Handle backward compatibility for ellipsis templates

This commit is contained in:
Kristian Bendiksen authored and Magne Sjaastad committed 2021-02-01 11:07:12 +01:00
1 parent 58f6619b2c
commit 94dfec1c9d
3 files changed
+35

No files matched your search

@@ -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;
}
@@ -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;
@@ -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();
}
}
}
}