Add optional measured depth labels to well path

This commit is contained in:
Magne Sjaastad 2023-09-12 12:54:43 +02:00
parent 3e340361e8
commit f18eb29552
3 changed files with 46 additions and 2 deletions

View File

@ -55,6 +55,7 @@
#include "RimWellPathValve.h"
#include "Riv3dWellLogPlanePartMgr.h"
#include "RivAnnotationSourceInfo.h"
#include "RivBoxGeometryGenerator.h"
#include "RivDrawableSpheres.h"
#include "RivFishbonesSubsPartMgr.h"
@ -696,6 +697,31 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
cvf::ref<cvf::Effect> eff = gen.generateCachedEffect();
m_centerLinePart->setEffect( eff.p() );
if ( m_rimWellPath->measuredDepthLabelInterval().has_value() && clippedWellPathCenterLine.size() > 2 )
{
const double distanceBetweenLabels = m_rimWellPath->measuredDepthLabelInterval().value();
// Create a round number as start for measured depth label
const double startMeasuredDepth = ( int( measuredDepthAtFirstClipPoint / distanceBetweenLabels ) + 1 ) * distanceBetweenLabels;
std::vector<std::string> labelTexts;
std::vector<cvf::Vec3d> labelDisplayCoords;
double measuredDepth = startMeasuredDepth;
while ( measuredDepth < wellPathGeometry->measuredDepths().back() )
{
labelTexts.push_back( std::to_string( static_cast<int>( measuredDepth ) ) );
auto domainCoord = wellPathGeometry->interpolatedPointAlongWellPath( measuredDepth );
auto displayCoord = displayCoordTransform->transformToDisplayCoord( domainCoord );
labelDisplayCoords.push_back( displayCoord );
measuredDepth += distanceBetweenLabels;
}
m_centerLinePart->setSourceInfo( new RivAnnotationSourceInfo( labelTexts, labelDisplayCoords ) );
}
}
// Generate label with well-path name at a position that is slightly offset towards the end of the well path

View File

@ -114,6 +114,10 @@ RimWellPath::RimWellPath()
CAF_PDM_InitField( &m_branchIndex, "SimBranchIndex", 0, "Branch" );
CAF_PDM_InitField( &m_showWellPathLabel, "ShowWellPathLabel", true, "Show Well Path Label" );
CAF_PDM_InitField( &m_measuredDepthLabelInterval,
"MeasuredDepthLabelInterval",
std::make_pair( false, 50.0 ),
"Enable Labels at Measured Depth Intervals" );
CAF_PDM_InitField( &m_showWellPath, "ShowWellPath", true, "Show Well Path" );
m_showWellPath.uiCapability()->setUiHidden( true );
@ -647,6 +651,16 @@ void RimWellPath::setShowWellPath( bool showWellPath )
m_showWellPath = showWellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::optional<double> RimWellPath::measuredDepthLabelInterval() const
{
if ( m_measuredDepthLabelInterval().first ) return m_measuredDepthLabelInterval().second;
return std::nullopt;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -699,6 +713,7 @@ void RimWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& ui
appGroup->add( &m_showWellPathLabel );
appGroup->add( &m_wellPathColor );
appGroup->add( &m_wellPathRadiusScaleFactor );
appGroup->add( &m_measuredDepthLabelInterval );
caf::PdmUiGroup* simWellGroup = uiOrdering.addNewGroup( "Simulation Well" );
simWellGroup->add( &m_simWellName );

View File

@ -141,6 +141,8 @@ public:
bool showWellPath() const;
void setShowWellPath( bool showWellPath );
std::optional<double> measuredDepthLabelInterval() const;
cvf::Color3f wellPathColor() const;
void setWellPathColor( const cvf::Color3f& color );
@ -199,8 +201,9 @@ private:
caf::PdmField<caf::FilePath> m_wellPathFormationFilePath;
caf::PdmField<QString> m_formationKeyInFile;
caf::PdmField<bool> m_showWellPath;
caf::PdmField<bool> m_showWellPathLabel;
caf::PdmField<bool> m_showWellPath;
caf::PdmField<bool> m_showWellPathLabel;
caf::PdmField<std::pair<bool, double>> m_measuredDepthLabelInterval;
caf::PdmField<double> m_wellPathRadiusScaleFactor;
caf::PdmField<cvf::Color3f> m_wellPathColor;