#7892 Basic support for display of surface lines and bands on intersections

Guard divide by zero issues
2D Intersection View: Do not add parts with wrong coordinates
Add bounding box search tree
Add support display of intersection lines for selected surfaces
Show band between two first intersection lines
This commit is contained in:
Magne Sjaastad
2021-08-26 08:13:03 +02:00
committed by GitHub
parent 61ea190920
commit 2fc65a3b62
32 changed files with 826 additions and 358 deletions

View File

@@ -562,7 +562,8 @@ void Rim2dIntersectionView::onCreateDisplayModel()
m_flatSimWellPipePartMgr = nullptr;
m_flatWellHeadPartMgr = nullptr;
if ( m_intersection->type() == RimExtrudedCurveIntersection::CS_SIMULATION_WELL && m_intersection->simulationWell() )
if ( m_intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL &&
m_intersection->simulationWell() )
{
RimEclipseView* eclipseView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclipseView );
@@ -575,7 +576,8 @@ void Rim2dIntersectionView::onCreateDisplayModel()
}
m_flatWellpathPartMgr = nullptr;
if ( m_intersection->type() == RimExtrudedCurveIntersection::CS_WELL_PATH && m_intersection->wellPath() )
if ( m_intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH &&
m_intersection->wellPath() )
{
Rim3dView* settingsView = nullptr;
m_intersection->firstAncestorOrThisOfType( settingsView );

View File

@@ -22,14 +22,21 @@
#include "RigEclipseCaseData.h"
#include "RigWellPath.h"
#include "Rim2dIntersectionView.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimEnsembleSurface.h"
#include "RimGridView.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimSurface.h"
#include "RimSurfaceCollection.h"
#include "RimTools.h"
#include "RimWellPath.h"
@@ -42,10 +49,7 @@
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "Rim2dIntersectionView.h"
#include "RimGridView.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include "cvfBoundingBox.h"
#include "cvfGeometryTools.h"
#include "cvfPlane.h"
@@ -55,20 +59,20 @@ namespace caf
template <>
void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionEnum>::setUp()
{
addItem( RimExtrudedCurveIntersection::CS_WELL_PATH, "CS_WELL_PATH", "Well Path" );
addItem( RimExtrudedCurveIntersection::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
addItem( RimExtrudedCurveIntersection::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
addItem( RimExtrudedCurveIntersection::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
setDefault( RimExtrudedCurveIntersection::CS_WELL_PATH );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH, "CS_WELL_PATH", "Well Path" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH );
}
template <>
void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionDirEnum>::setUp()
{
addItem( RimExtrudedCurveIntersection::CS_VERTICAL, "CS_VERTICAL", "Vertical" );
addItem( RimExtrudedCurveIntersection::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal" );
addItem( RimExtrudedCurveIntersection::CS_TWO_POINTS, "CS_TWO_POINTS", "Defined by Two Points" );
setDefault( RimExtrudedCurveIntersection::CS_VERTICAL );
addItem( RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_VERTICAL, "CS_VERTICAL", "Vertical" );
addItem( RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal" );
addItem( RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_TWO_POINTS, "CS_TWO_POINTS", "Defined by Two Points" );
setDefault( RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_VERTICAL );
}
} // namespace caf
@@ -85,6 +89,98 @@ const RivIntersectionGeometryGeneratorIF* RimExtrudedCurveIntersection::intersec
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimExtrudedCurveIntersection::CrossSectionEnum RimExtrudedCurveIntersection::type() const
{
return m_type();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimExtrudedCurveIntersection::CrossSectionDirEnum RimExtrudedCurveIntersection::direction() const
{
return m_direction();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimExtrudedCurveIntersection::wellPath() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSimWellInView* RimExtrudedCurveIntersection::simulationWell() const
{
return m_simulationWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimExtrudedCurveIntersection::inputPolyLineFromViewerEnabled() const
{
return m_inputPolylineFromViewerEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimExtrudedCurveIntersection::inputExtrusionPointsFromViewerEnabled() const
{
return m_inputExtrusionPointsFromViewerEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimExtrudedCurveIntersection::inputTwoAzimuthPointsFromViewerEnabled() const
{
return m_inputTwoAzimuthPointsFromViewerEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::configureForSimulationWell( RimSimWellInView* simWell )
{
m_type = CrossSectionEnum::CS_SIMULATION_WELL;
m_simulationWell = simWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::configureForWellPath( RimWellPath* wellPath )
{
m_type = CrossSectionEnum::CS_WELL_PATH;
m_wellPath = wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::configureForPolyLine()
{
m_type = CrossSectionEnum::CS_POLYLINE;
m_inputPolylineFromViewerEnabled = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::configureForAzimuthLine()
{
m_type = CrossSectionEnum::CS_AZIMUTHLINE;
m_inputTwoAzimuthPointsFromViewerEnabled = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -93,10 +189,10 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png", "", "" );
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
CAF_PDM_InitFieldNoDefault( &type, "Type", "Type", "", "", "" );
CAF_PDM_InitFieldNoDefault( &direction, "Direction", "Direction", "", "", "" );
CAF_PDM_InitFieldNoDefault( &wellPath, "WellPath", "Well Path ", "", "", "" );
CAF_PDM_InitFieldNoDefault( &simulationWell, "SimulationWell", "Simulation Well", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_type, "Type", "Type", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path ", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_userPolyline, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
CAF_PDM_InitField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth", "", "", "" );
@@ -118,22 +214,30 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
CAF_PDM_InitField( &m_lengthUp, "lengthUp", 1000.0, "Length Up", "", "", "" );
CAF_PDM_InitField( &m_lengthDown, "lengthDown", 1000.0, "Length Down", "", "", "" );
CAF_PDM_InitFieldNoDefault( &inputPolyLineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &inputPolyLineFromViewerEnabled );
inputPolyLineFromViewerEnabled = false;
CAF_PDM_InitFieldNoDefault( &m_inputPolylineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_inputPolylineFromViewerEnabled );
m_inputPolylineFromViewerEnabled = false;
CAF_PDM_InitFieldNoDefault( &inputExtrusionPointsFromViewerEnabled, "inputExtrusionPointsFromViewerEnabled", "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &inputExtrusionPointsFromViewerEnabled );
inputExtrusionPointsFromViewerEnabled = false;
CAF_PDM_InitFieldNoDefault( &m_inputExtrusionPointsFromViewerEnabled,
"inputExtrusionPointsFromViewerEnabled",
"",
"",
"",
"" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_inputExtrusionPointsFromViewerEnabled );
m_inputExtrusionPointsFromViewerEnabled = false;
CAF_PDM_InitFieldNoDefault( &inputTwoAzimuthPointsFromViewerEnabled,
CAF_PDM_InitFieldNoDefault( &m_inputTwoAzimuthPointsFromViewerEnabled,
"inputTwoAzimuthPointsFromViewerEnabled",
"",
"",
"",
"" );
caf::PdmUiPushButtonEditor::configureEditorForField( &inputTwoAzimuthPointsFromViewerEnabled );
inputTwoAzimuthPointsFromViewerEnabled = false;
caf::PdmUiPushButtonEditor::configureEditorForField( &m_inputTwoAzimuthPointsFromViewerEnabled );
m_inputTwoAzimuthPointsFromViewerEnabled = false;
CAF_PDM_InitFieldNoDefault( &m_annotationSurfaces, "annotationSurfaces", "", "", "", "" );
m_annotationSurfaces.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
uiCapability()->setUiTreeChildrenHidden( true );
@@ -178,30 +282,21 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
const QVariant& oldValue,
const QVariant& newValue )
{
// clang-format off
if ( changedField == &m_isActive ||
changedField == &type ||
changedField == &direction ||
changedField == &wellPath ||
changedField == &simulationWell ||
changedField == &m_branchIndex ||
changedField == &m_extentLength ||
changedField == &m_lengthUp ||
changedField == &m_lengthDown ||
changedField == &m_showInactiveCells ||
changedField == &m_useSeparateDataSource ||
if ( changedField == &m_isActive || changedField == &m_type || changedField == &m_direction ||
changedField == &m_wellPath || changedField == &m_simulationWell || changedField == &m_branchIndex ||
changedField == &m_extentLength || changedField == &m_lengthUp || changedField == &m_lengthDown ||
changedField == &m_showInactiveCells || changedField == &m_useSeparateDataSource ||
changedField == &m_separateDataSource )
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
// clang-format on
if ( changedField == &simulationWell || changedField == &m_isActive || changedField == &type )
if ( changedField == &m_simulationWell || changedField == &m_isActive || changedField == &m_type )
{
recomputeSimulationWellBranchData();
}
if ( changedField == &simulationWell || changedField == &wellPath || changedField == &m_branchIndex )
if ( changedField == &m_simulationWell || changedField == &m_wellPath || changedField == &m_branchIndex )
{
updateName();
}
@@ -216,34 +311,34 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
}
}
if ( changedField == &inputPolyLineFromViewerEnabled || changedField == &m_userPolyline )
if ( changedField == &m_inputPolylineFromViewerEnabled || changedField == &m_userPolyline )
{
if ( inputPolyLineFromViewerEnabled )
if ( m_inputPolylineFromViewerEnabled )
{
inputExtrusionPointsFromViewerEnabled = false;
inputTwoAzimuthPointsFromViewerEnabled = false;
m_inputExtrusionPointsFromViewerEnabled = false;
m_inputTwoAzimuthPointsFromViewerEnabled = false;
}
rebuildGeometryAndScheduleCreateDisplayModel();
}
if ( changedField == &inputExtrusionPointsFromViewerEnabled || changedField == &m_customExtrusionPoints )
if ( changedField == &m_inputExtrusionPointsFromViewerEnabled || changedField == &m_customExtrusionPoints )
{
if ( inputExtrusionPointsFromViewerEnabled )
if ( m_inputExtrusionPointsFromViewerEnabled )
{
inputPolyLineFromViewerEnabled = false;
inputTwoAzimuthPointsFromViewerEnabled = false;
m_inputPolylineFromViewerEnabled = false;
m_inputTwoAzimuthPointsFromViewerEnabled = false;
}
rebuildGeometryAndScheduleCreateDisplayModel();
}
if ( changedField == &inputTwoAzimuthPointsFromViewerEnabled || changedField == &m_twoAzimuthPoints )
if ( changedField == &m_inputTwoAzimuthPointsFromViewerEnabled || changedField == &m_twoAzimuthPoints )
{
if ( inputTwoAzimuthPointsFromViewerEnabled )
if ( m_inputTwoAzimuthPointsFromViewerEnabled )
{
inputPolyLineFromViewerEnabled = false;
inputExtrusionPointsFromViewerEnabled = false;
m_inputPolylineFromViewerEnabled = false;
m_inputExtrusionPointsFromViewerEnabled = false;
}
rebuildGeometryAndScheduleCreateDisplayModel();
@@ -259,6 +354,12 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
if ( changedField == &m_annotationSurfaces )
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
}
//--------------------------------------------------------------------------------------------------
@@ -268,56 +369,56 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf::
{
uiOrdering.add( &m_name );
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup( "Intersecting Geometry" );
geometryGroup->add( &type );
geometryGroup->add( &m_type );
if ( type == CS_WELL_PATH )
if ( m_type() == CrossSectionEnum::CS_WELL_PATH )
{
geometryGroup->add( &wellPath );
geometryGroup->add( &m_wellPath );
}
else if ( type == CS_SIMULATION_WELL )
else if ( type() == CrossSectionEnum::CS_SIMULATION_WELL )
{
geometryGroup->add( &simulationWell );
geometryGroup->add( &m_simulationWell );
updateSimulationWellCenterline();
if ( simulationWell() && m_simulationWellBranchCenterlines.size() > 1 )
if ( m_simulationWell() && m_simulationWellBranchCenterlines.size() > 1 )
{
geometryGroup->add( &m_branchIndex );
}
}
else if ( type == CS_POLYLINE )
else if ( type() == CrossSectionEnum::CS_POLYLINE )
{
geometryGroup->add( &m_userPolyline );
geometryGroup->add( &inputPolyLineFromViewerEnabled );
geometryGroup->add( &m_inputPolylineFromViewerEnabled );
}
else if ( type == CS_AZIMUTHLINE )
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
{
geometryGroup->add( &m_twoAzimuthPoints );
geometryGroup->add( &inputTwoAzimuthPointsFromViewerEnabled );
geometryGroup->add( &m_inputTwoAzimuthPointsFromViewerEnabled );
geometryGroup->add( &m_azimuthAngle );
geometryGroup->add( &m_dipAngle );
}
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Options" );
if ( type == CS_AZIMUTHLINE )
if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
{
optionsGroup->add( &m_lengthUp );
optionsGroup->add( &m_lengthDown );
}
else
{
optionsGroup->add( &direction );
optionsGroup->add( &m_direction );
optionsGroup->add( &m_extentLength );
}
if ( direction == CS_TWO_POINTS )
if ( direction() == CrossSectionDirEnum::CS_TWO_POINTS )
{
optionsGroup->add( &m_customExtrusionPoints );
optionsGroup->add( &inputExtrusionPointsFromViewerEnabled );
optionsGroup->add( &m_inputExtrusionPointsFromViewerEnabled );
}
optionsGroup->add( &m_showInactiveCells );
if ( type == CS_POLYLINE )
if ( type() == CrossSectionEnum::CS_POLYLINE )
{
m_extentLength.uiCapability()->setUiReadOnly( true );
}
@@ -326,6 +427,9 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf::
m_extentLength.uiCapability()->setUiReadOnly( false );
}
caf::PdmUiGroup* surfaceGroup = uiOrdering.addNewGroup( "Surfaces" );
surfaceGroup->add( &m_annotationSurfaces );
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );
uiOrdering.skipRemainingFields( true );
@@ -340,16 +444,16 @@ QList<caf::PdmOptionItemInfo>
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &wellPath )
if ( fieldNeedingOptions == &m_wellPath )
{
RimTools::wellPathOptionItems( &options );
if ( options.size() > 0 )
if ( !options.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
}
else if ( fieldNeedingOptions == &simulationWell )
else if ( fieldNeedingOptions == &m_simulationWell )
{
RimSimWellInViewCollection* coll = simulationWellCollection();
if ( coll )
@@ -363,7 +467,7 @@ QList<caf::PdmOptionItemInfo>
}
}
if ( options.size() == 0 )
if ( options.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
@@ -381,6 +485,23 @@ QList<caf::PdmOptionItemInfo>
options.push_back( caf::PdmOptionItemInfo( QString::number( bIdx + 1 ), QVariant::fromValue( bIdx ) ) );
}
}
else if ( fieldNeedingOptions == &m_annotationSurfaces )
{
RimSurfaceCollection* surfColl = RimProject::current()->activeOilField()->surfaceCollection();
caf::IconProvider surfaceIcon( ":/ReservoirSurface16x16.png" );
for ( auto surf : surfColl->surfaces() )
{
options.push_back( caf::PdmOptionItemInfo( surf->userDescription(), surf, false, surfaceIcon ) );
}
for ( auto ensambleSurf : surfColl->ensembleSurfaces() )
{
for ( auto surf : ensambleSurf->surfaces() )
{
options.push_back( caf::PdmOptionItemInfo( surf->userDescription(), surf, false, surfaceIcon ) );
}
}
}
else
{
options = RimIntersection::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
@@ -438,11 +559,11 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
double horizontalProjectedLengthAlongWellPathToClipPoint = 0.0;
if ( type == CS_WELL_PATH )
if ( type() == CrossSectionEnum::CS_WELL_PATH )
{
if ( wellPath() && wellPath->wellPathGeometry() )
if ( m_wellPath() && wellPath()->wellPathGeometry() )
{
lines.push_back( wellPath->wellPathGeometry()->wellPathPoints() );
lines.push_back( wellPath()->wellPathGeometry()->wellPathPoints() );
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
if ( ownerCase )
@@ -455,9 +576,9 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
}
}
}
else if ( type == CS_SIMULATION_WELL )
else if ( type() == CrossSectionEnum::CS_SIMULATION_WELL )
{
if ( simulationWell() )
if ( m_simulationWell() )
{
updateSimulationWellCenterline();
@@ -474,37 +595,35 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
}
}
}
else if ( type == CS_POLYLINE )
else if ( type() == CrossSectionEnum::CS_POLYLINE )
{
lines.push_back( m_userPolyline );
}
else if ( type == CS_AZIMUTHLINE )
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
{
lines.push_back( m_twoAzimuthPoints );
}
if ( type == CS_WELL_PATH || type == CS_SIMULATION_WELL )
if ( type() == CrossSectionEnum::CS_WELL_PATH || type() == CrossSectionEnum::CS_SIMULATION_WELL )
{
if ( type == CS_SIMULATION_WELL && simulationWell() )
if ( type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
{
cvf::Vec3d top, bottom;
simulationWell->wellHeadTopBottomPosition( -1, &top, &bottom );
m_simulationWell->wellHeadTopBottomPosition( -1, &top, &bottom );
for ( size_t lIdx = 0; lIdx < lines.size(); ++lIdx )
for ( std::vector<cvf::Vec3d>& polyLine : lines )
{
std::vector<cvf::Vec3d>& polyLine = lines[lIdx];
polyLine.insert( polyLine.begin(), top );
}
}
for ( size_t lIdx = 0; lIdx < lines.size(); ++lIdx )
for ( std::vector<cvf::Vec3d>& polyLine : lines )
{
std::vector<cvf::Vec3d>& polyLine = lines[lIdx];
addExtents( polyLine );
}
if ( flattenedPolylineStartPoint && lines.size() && lines[0].size() > 1 )
if ( flattenedPolylineStartPoint && !lines.empty() && lines[0].size() > 1 )
{
( *flattenedPolylineStartPoint )[0] = horizontalProjectedLengthAlongWellPathToClipPoint - m_extentLength;
( *flattenedPolylineStartPoint )[2] = lines[0][1].z(); // Depth of first point in first polyline
@@ -512,7 +631,7 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
}
else
{
if ( flattenedPolylineStartPoint && lines.size() && lines[0].size() )
if ( flattenedPolylineStartPoint && !lines.empty() && !( lines[0] ).empty() )
{
( *flattenedPolylineStartPoint )[2] = lines[0][0].z(); // Depth of first point in first polyline
}
@@ -551,11 +670,11 @@ std::vector<cvf::Vec3d> RimExtrudedCurveIntersection::polyLinesForExtrusionDirec
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::updateSimulationWellCenterline() const
{
if ( m_isActive() && type == CS_SIMULATION_WELL && simulationWell() )
if ( m_isActive() && type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
{
if ( m_simulationWellBranchCenterlines.empty() )
{
auto branches = simulationWell->wellPipeBranches();
auto branches = m_simulationWell->wellPipeBranches();
for ( const auto& branch : branches )
{
m_simulationWellBranchCenterlines.push_back( branch->wellPathPoints() );
@@ -629,17 +748,17 @@ void RimExtrudedCurveIntersection::addExtents( std::vector<cvf::Vec3d>& polyLine
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::updateName()
{
if ( type == CS_SIMULATION_WELL && simulationWell() )
if ( type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
{
m_name = simulationWell()->name();
m_name = m_simulationWell()->name();
if ( branchIndex() != -1 )
{
m_name = m_name() + " Branch " + QString::number( branchIndex() + 1 );
}
}
else if ( type() == CS_WELL_PATH && wellPath() )
else if ( m_type() == CrossSectionEnum::CS_WELL_PATH && m_wellPath() )
{
m_name = wellPath()->name();
m_name = m_wellPath()->name();
}
Rim2dIntersectionView* iView = correspondingIntersectionView();
@@ -708,8 +827,7 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiDoubleSliderEditorAttribute* doubleSliderAttrib =
dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
auto* doubleSliderAttrib = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
if ( doubleSliderAttrib )
{
if ( field == &m_azimuthAngle )
@@ -725,31 +843,32 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan
doubleSliderAttrib->m_sliderTickCount = 180;
}
}
else if ( field == &inputPolyLineFromViewerEnabled )
else if ( field == &m_inputPolylineFromViewerEnabled )
{
setPushButtonText( inputPolyLineFromViewerEnabled, dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) );
setPushButtonText( m_inputPolylineFromViewerEnabled,
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) );
}
else if ( field == &m_userPolyline )
{
setBaseColor( inputPolyLineFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
setBaseColor( m_inputPolylineFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
}
else if ( field == &inputTwoAzimuthPointsFromViewerEnabled )
else if ( field == &m_inputTwoAzimuthPointsFromViewerEnabled )
{
setPushButtonText( inputTwoAzimuthPointsFromViewerEnabled,
setPushButtonText( m_inputTwoAzimuthPointsFromViewerEnabled,
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) );
}
else if ( field == &m_twoAzimuthPoints )
{
setBaseColor( inputTwoAzimuthPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
setBaseColor( m_inputTwoAzimuthPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
}
else if ( field == &inputExtrusionPointsFromViewerEnabled )
else if ( field == &m_inputExtrusionPointsFromViewerEnabled )
{
setPushButtonText( inputExtrusionPointsFromViewerEnabled,
setPushButtonText( m_inputExtrusionPointsFromViewerEnabled,
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) );
}
else if ( field == &m_customExtrusionPoints )
{
setBaseColor( inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
setBaseColor( m_inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
}
}
@@ -768,7 +887,7 @@ void RimExtrudedCurveIntersection::appendPointToPolyLine( const cvf::Vec3d& poin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim2dIntersectionView* RimExtrudedCurveIntersection::correspondingIntersectionView()
Rim2dIntersectionView* RimExtrudedCurveIntersection::correspondingIntersectionView() const
{
std::vector<Rim2dIntersectionView*> objects;
this->objectsWithReferringPtrFieldsOfType( objects );
@@ -831,10 +950,10 @@ cvf::Vec3d RimExtrudedCurveIntersection::extrusionDirection() const
{
cvf::Vec3d dir = cvf::Vec3d::Z_AXIS;
if ( direction() == RimExtrudedCurveIntersection::CS_HORIZONTAL )
if ( m_direction() == RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_HORIZONTAL )
{
std::vector<std::vector<cvf::Vec3d>> lines = this->polyLines();
if ( lines.size() > 0 && lines[0].size() > 1 )
if ( !lines.empty() && lines[0].size() > 1 )
{
std::vector<cvf::Vec3d> firstLine = lines[0];
@@ -846,7 +965,8 @@ cvf::Vec3d RimExtrudedCurveIntersection::extrusionDirection() const
dir = polyLineDir ^ up;
}
}
else if ( direction() == RimExtrudedCurveIntersection::CS_TWO_POINTS && m_customExtrusionPoints().size() > 1 )
else if ( m_direction() == RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_TWO_POINTS &&
m_customExtrusionPoints().size() > 1 )
{
dir = m_customExtrusionPoints()[m_customExtrusionPoints().size() - 1] - m_customExtrusionPoints()[0];
}
@@ -902,7 +1022,7 @@ double RimExtrudedCurveIntersection::extentLength()
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::recomputeSimulationWellBranchData()
{
if ( type() == CS_SIMULATION_WELL )
if ( m_type() == CrossSectionEnum::CS_SIMULATION_WELL )
{
m_simulationWellBranchCenterlines.clear();
updateSimulationWellCenterline();
@@ -916,7 +1036,15 @@ void RimExtrudedCurveIntersection::recomputeSimulationWellBranchData()
//--------------------------------------------------------------------------------------------------
bool RimExtrudedCurveIntersection::hasDefiningPoints() const
{
return type == CS_POLYLINE || type == CS_AZIMUTHLINE;
return m_type() == CrossSectionEnum::CS_POLYLINE || m_type() == CrossSectionEnum::CS_AZIMUTHLINE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSurface*> RimExtrudedCurveIntersection::annotatedSurfaces() const
{
return m_annotationSurfaces.ptrReferencedObjects();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -19,15 +19,9 @@
#pragma once
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "RimIntersection.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cafPdmPtrArrayField.h"
class RimWellPath;
class RivExtrudedCurveIntersectionPartMgr;
@@ -35,6 +29,7 @@ class RimIntersectionResultDefinition;
class RimSimWellInView;
class RimSimWellInViewCollection;
class Rim2dIntersectionView;
class RimSurface;
namespace caf
{
@@ -52,7 +47,7 @@ class RimExtrudedCurveIntersection : public RimIntersection
CAF_PDM_HEADER_INIT;
public:
enum CrossSectionEnum
enum class CrossSectionEnum
{
CS_WELL_PATH,
CS_SIMULATION_WELL,
@@ -60,7 +55,7 @@ public:
CS_AZIMUTHLINE
};
enum CrossSectionDirEnum
enum class CrossSectionDirEnum
{
CS_VERTICAL,
CS_HORIZONTAL,
@@ -71,23 +66,27 @@ public:
RimExtrudedCurveIntersection();
~RimExtrudedCurveIntersection() override;
caf::PdmField<caf::AppEnum<CrossSectionEnum>> type;
caf::PdmField<caf::AppEnum<CrossSectionDirEnum>> direction;
caf::PdmPtrField<RimWellPath*> wellPath;
caf::PdmPtrField<RimSimWellInView*> simulationWell;
caf::PdmField<bool> inputPolyLineFromViewerEnabled;
caf::PdmField<bool> inputExtrusionPointsFromViewerEnabled;
caf::PdmField<bool> inputTwoAzimuthPointsFromViewerEnabled;
QString name() const override;
void setName( const QString& newName );
RimExtrudedCurveIntersection::CrossSectionEnum type() const;
RimExtrudedCurveIntersection::CrossSectionDirEnum direction() const;
RimWellPath* wellPath() const;
RimSimWellInView* simulationWell() const;
bool inputPolyLineFromViewerEnabled() const;
bool inputExtrusionPointsFromViewerEnabled() const;
bool inputTwoAzimuthPointsFromViewerEnabled() const;
void configureForSimulationWell( RimSimWellInView* simWell );
void configureForWellPath( RimWellPath* wellPath );
void configureForPolyLine();
void configureForAzimuthLine();
std::vector<std::vector<cvf::Vec3d>> polyLines( cvf::Vec3d* flattenedPolylineStartPoint = nullptr ) const;
void appendPointToPolyLine( const cvf::Vec3d& point );
Rim2dIntersectionView* correspondingIntersectionView();
Rim2dIntersectionView* correspondingIntersectionView() const;
RivExtrudedCurveIntersectionPartMgr* intersectionPartMgr();
void rebuildGeometry();
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const override;
@@ -106,6 +105,8 @@ public:
void recomputeSimulationWellBranchData();
bool hasDefiningPoints() const;
std::vector<RimSurface*> annotatedSurfaces() const;
int branchIndex() const;
void rebuildGeometryAndScheduleCreateDisplayModel();
@@ -119,9 +120,30 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
private:
static void setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute );
static void setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute );
RimSimWellInViewCollection* simulationWellCollection() const;
void updateAzimuthLine();
void updateSimulationWellCenterline() const;
void addExtents( std::vector<cvf::Vec3d>& polyLine ) const;
void updateName();
static double azimuthInRadians( cvf::Vec3d vec );
private:
caf::PdmField<QString> m_name;
caf::PdmField<caf::AppEnum<CrossSectionEnum>> m_type;
caf::PdmField<caf::AppEnum<CrossSectionDirEnum>> m_direction;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmPtrField<RimSimWellInView*> m_simulationWell;
caf::PdmField<bool> m_inputPolylineFromViewerEnabled;
caf::PdmField<bool> m_inputExtrusionPointsFromViewerEnabled;
caf::PdmField<bool> m_inputTwoAzimuthPointsFromViewerEnabled;
caf::PdmField<int> m_branchIndex;
caf::PdmField<double> m_extentLength;
caf::PdmField<double> m_azimuthAngle;
@@ -133,17 +155,9 @@ private:
caf::PdmField<std::vector<cvf::Vec3d>> m_customExtrusionPoints;
caf::PdmField<std::vector<cvf::Vec3d>> m_twoAzimuthPoints;
static void setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute );
static void setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute );
// Surface intersection annotations
caf::PdmPtrArrayField<RimSurface*> m_annotationSurfaces;
RimSimWellInViewCollection* simulationWellCollection() const;
void updateAzimuthLine();
void updateSimulationWellCenterline() const;
void addExtents( std::vector<cvf::Vec3d>& polyLine ) const;
void updateName();
static double azimuthInRadians( cvf::Vec3d vec );
private:
cvf::ref<RivExtrudedCurveIntersectionPartMgr> m_crossSectionPartMgr;
mutable std::vector<std::vector<cvf::Vec3d>> m_simulationWellBranchCenterlines;

View File

@@ -170,7 +170,7 @@ void RimIntersection::updateDefaultSeparateDataSource()
{
std::vector<RimIntersectionResultDefinition*> iResDefs = defcoll->intersectionResultsDefinitions();
if ( iResDefs.size() )
if ( !iResDefs.empty() )
{
m_separateDataSource = iResDefs[0];
}
@@ -188,7 +188,7 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
{
// Eclipse case
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( resDef->activeCase() );
auto* eclipseCase = dynamic_cast<RimEclipseCase*>( resDef->activeCase() );
if ( eclipseCase && eclipseCase->eclipseCaseData() )
{
return new RivEclipseIntersectionGrid( eclipseCase->eclipseCaseData()->mainGrid(),
@@ -199,7 +199,7 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
// Geomech case
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( resDef->activeCase() );
auto* geomCase = dynamic_cast<RimGeoMechCase*>( resDef->activeCase() );
if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() )
{

View File

@@ -364,7 +364,7 @@ bool RimIntersectionCollection::hasActiveIntersectionForSimulationWell( const Ri
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
if ( cs->isActive() && cs->type() == RimExtrudedCurveIntersection::CS_SIMULATION_WELL &&
if ( cs->isActive() && cs->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL &&
cs->simulationWell() == simWell )
{
return true;