Skip to content

Commit

Permalink
Add optional measured depth labels to well path
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 12, 2023
1 parent dcd3130 commit b75f406
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
26 changes: 26 additions & 0 deletions ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "RimWellPathValve.h"

#include "Riv3dWellLogPlanePartMgr.h"
#include "RivAnnotationSourceInfo.h"
#include "RivBoxGeometryGenerator.h"
#include "RivDrawableSpheres.h"
#include "RivFishbonesSubsPartMgr.h"
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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 );
Expand Down
7 changes: 5 additions & 2 deletions ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface
bool showWellPath() const;
void setShowWellPath( bool showWellPath );

std::optional<double> measuredDepthLabelInterval() const;

cvf::Color3f wellPathColor() const;
void setWellPathColor( const cvf::Color3f& color );

Expand Down Expand Up @@ -199,8 +201,9 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface
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;
Expand Down

0 comments on commit b75f406

Please sign in to comment.