diff --git a/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp index 6fd59f7bb8..9047b896c1 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -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 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 labelTexts; + std::vector labelDisplayCoords; + + double measuredDepth = startMeasuredDepth; + while ( measuredDepth < wellPathGeometry->measuredDepths().back() ) + { + labelTexts.push_back( std::to_string( static_cast( 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 diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index 0edd1e4b06..47db2984e5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -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 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 ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h index 44483db095..60d47638dc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h @@ -141,6 +141,8 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface bool showWellPath() const; void setShowWellPath( bool showWellPath ); + std::optional measuredDepthLabelInterval() const; + cvf::Color3f wellPathColor() const; void setWellPathColor( const cvf::Color3f& color ); @@ -199,8 +201,9 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface caf::PdmField m_wellPathFormationFilePath; caf::PdmField m_formationKeyInFile; - caf::PdmField m_showWellPath; - caf::PdmField m_showWellPathLabel; + caf::PdmField m_showWellPath; + caf::PdmField m_showWellPathLabel; + caf::PdmField> m_measuredDepthLabelInterval; caf::PdmField m_wellPathRadiusScaleFactor; caf::PdmField m_wellPathColor;