| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | /////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //  Copyright (C) 2015-     Statoil ASA
 | 
					
						
							|  |  |  | //  Copyright (C) 2015-     Ceetron Solutions AS
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | //
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //  ResInsight is free software: you can redistribute it and/or modify
 | 
					
						
							|  |  |  | //  it under the terms of the GNU General Public License as published by
 | 
					
						
							|  |  |  | //  the Free Software Foundation, either version 3 of the License, or
 | 
					
						
							|  |  |  | //  (at your option) any later version.
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | //
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //  ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
					
						
							|  |  |  | //  WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
					
						
							|  |  |  | //  FITNESS FOR A PARTICULAR PURPOSE.
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | //
 | 
					
						
							|  |  |  | //  See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //  for more details.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | /////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | #include "RimExtrudedCurveIntersection.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-08 12:22:35 +01:00
										 |  |  | #include "RigEclipseCaseData.h"
 | 
					
						
							| 
									
										
										
										
											2017-02-24 14:31:06 +01:00
										 |  |  | #include "RigWellPath.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | #include "Rim3dView.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | #include "RimCase.h"
 | 
					
						
							| 
									
										
										
										
											2017-12-08 12:22:35 +01:00
										 |  |  | #include "RimEclipseCase.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | #include "RimEclipseView.h"
 | 
					
						
							|  |  |  | #include "RimOilField.h"
 | 
					
						
							|  |  |  | #include "RimProject.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-13 09:29:42 +02:00
										 |  |  | #include "RimSimWellInView.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-13 14:20:47 +02:00
										 |  |  | #include "RimSimWellInViewCollection.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-05 07:53:14 +01:00
										 |  |  | #include "RimTools.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | #include "RimWellPath.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | #include "RiuViewer.h"
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:51:54 +01:00
										 |  |  | #include "RivExtrudedCurveIntersectionPartMgr.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "cafCmdFeature.h"
 | 
					
						
							|  |  |  | #include "cafCmdFeatureManager.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | #include "cafPdmUiDoubleSliderEditor.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-30 15:12:00 +01:00
										 |  |  | #include "cafPdmUiListEditor.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | #include "cafPdmUiPushButtonEditor.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | #include "Rim2dIntersectionView.h"
 | 
					
						
							| 
									
										
										
										
											2019-11-12 14:00:30 +01:00
										 |  |  | #include "RimGridView.h"
 | 
					
						
							|  |  |  | #include "RimIntersectionResultDefinition.h"
 | 
					
						
							|  |  |  | #include "RimIntersectionResultsDefinitionCollection.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-17 15:11:02 +01:00
										 |  |  | #include "cvfBoundingBox.h"
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | #include "cvfGeometryTools.h"
 | 
					
						
							| 
									
										
										
										
											2017-02-24 11:07:15 +01:00
										 |  |  | #include "cvfPlane.h"
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | namespace caf | 
					
						
							| 
									
										
										
										
											2015-11-18 10:06:42 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | template <> | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionEnum>::setUp() | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  |     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 ); | 
					
						
							| 
									
										
										
										
											2015-11-18 10:06:42 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | template <> | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionDirEnum>::setUp() | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  |     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 ); | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | } // namespace caf
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CrossSection" ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png", "", "" ); | 
					
						
							| 
									
										
										
										
											2020-01-14 14:57:23 +01:00
										 |  |  |     CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" ); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     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_userPolyline, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth", "", "", "" ); | 
					
						
							|  |  |  |     m_azimuthAngle.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitField( &m_dipAngle, "DipAngle", 90.0, "Dip", "", "", "" ); | 
					
						
							|  |  |  |     m_dipAngle.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitFieldNoDefault( &m_customExtrusionPoints, "CustomExtrusionPoints", "", "", "", "" ); | 
					
						
							|  |  |  |     CAF_PDM_InitFieldNoDefault( &m_twoAzimuthPoints, | 
					
						
							|  |  |  |                                 "TwoAzimuthPoints", | 
					
						
							|  |  |  |                                 "Points", | 
					
						
							|  |  |  |                                 "", | 
					
						
							|  |  |  |                                 "Pick two points to define a line.\nUse Ctrl-C for copy and Ctrl-V for paste", | 
					
						
							|  |  |  |                                 "" ); | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitField( &m_branchIndex, "Branch", -1, "Branch", "", "", "" ); | 
					
						
							|  |  |  |     CAF_PDM_InitField( &m_extentLength, "ExtentLength", 200.0, "Extent Length", "", "", "" ); | 
					
						
							|  |  |  |     CAF_PDM_InitField( &m_lengthUp, "lengthUp", 1000.0, "Length Up", "", "", "" ); | 
					
						
							|  |  |  |     CAF_PDM_InitField( &m_lengthDown, "lengthDown", 1000.0, "Length Down", "", "", "" ); | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitFieldNoDefault( &inputPolyLineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", "" ); | 
					
						
							|  |  |  |     caf::PdmUiPushButtonEditor::configureEditorForField( &inputPolyLineFromViewerEnabled ); | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     inputPolyLineFromViewerEnabled = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-12 11:43:15 +01:00
										 |  |  |     CAF_PDM_InitFieldNoDefault( &inputExtrusionPointsFromViewerEnabled, "inputExtrusionPointsFromViewerEnabled", "", "", "", "" ); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     caf::PdmUiPushButtonEditor::configureEditorForField( &inputExtrusionPointsFromViewerEnabled ); | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     inputExtrusionPointsFromViewerEnabled = false; | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     CAF_PDM_InitFieldNoDefault( &inputTwoAzimuthPointsFromViewerEnabled, | 
					
						
							|  |  |  |                                 "inputTwoAzimuthPointsFromViewerEnabled", | 
					
						
							|  |  |  |                                 "", | 
					
						
							|  |  |  |                                 "", | 
					
						
							|  |  |  |                                 "", | 
					
						
							|  |  |  |                                 "" ); | 
					
						
							|  |  |  |     caf::PdmUiPushButtonEditor::configureEditorForField( &inputTwoAzimuthPointsFromViewerEnabled ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     inputTwoAzimuthPointsFromViewerEnabled = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     uiCapability()->setUiTreeChildrenHidden( true ); | 
					
						
							| 
									
										
										
										
											2020-05-18 16:02:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     setDeletable( true ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 08:26:38 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-12-03 08:26:38 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2020-02-12 11:13:38 +01:00
										 |  |  | RimExtrudedCurveIntersection::~RimExtrudedCurveIntersection() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-12-03 08:26:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2020-01-14 14:57:23 +01:00
										 |  |  | caf::PdmFieldHandle* RimExtrudedCurveIntersection::userDescriptionField() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return &m_name; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  | ///
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  | QString RimExtrudedCurveIntersection::name() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return m_name(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  | ///
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  | void RimExtrudedCurveIntersection::setName( const QString& newName ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     m_name = newName; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							|  |  |  | ///
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, | 
					
						
							| 
									
										
										
										
											2019-11-26 13:56:02 +01:00
										 |  |  |                                                      const QVariant&            oldValue, | 
					
						
							|  |  |  |                                                      const QVariant&            newValue ) | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-11-25 13:31:21 +01:00
										 |  |  |     // 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 ||  | 
					
						
							|  |  |  |          changedField == &m_separateDataSource ) | 
					
						
							| 
									
										
										
										
											2015-11-19 11:41:16 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |         rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							| 
									
										
										
										
											2015-11-19 11:41:16 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-11-25 13:31:21 +01:00
										 |  |  |     // clang-format on
 | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     if ( changedField == &simulationWell || changedField == &m_isActive || changedField == &type ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |         recomputeSimulationWellBranchData(); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( changedField == &simulationWell || changedField == &wellPath || changedField == &m_branchIndex ) | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         updateName(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     if ( changedField == &m_name ) | 
					
						
							| 
									
										
										
										
											2018-05-03 09:55:08 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         Rim2dIntersectionView* iView = correspondingIntersectionView(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( iView ) | 
					
						
							| 
									
										
										
										
											2018-05-03 09:55:08 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |             iView->updateName(); | 
					
						
							|  |  |  |             iView->updateConnectedEditors(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( changedField == &inputPolyLineFromViewerEnabled || changedField == &m_userPolyline ) | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( inputPolyLineFromViewerEnabled ) | 
					
						
							| 
									
										
										
										
											2016-10-18 12:04:08 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             inputExtrusionPointsFromViewerEnabled  = false; | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |             inputTwoAzimuthPointsFromViewerEnabled = false; | 
					
						
							| 
									
										
										
										
											2016-10-18 12:04:08 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |         rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( changedField == &inputExtrusionPointsFromViewerEnabled || changedField == &m_customExtrusionPoints ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( inputExtrusionPointsFromViewerEnabled ) | 
					
						
							| 
									
										
										
										
											2016-10-18 12:04:08 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             inputPolyLineFromViewerEnabled         = false; | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |             inputTwoAzimuthPointsFromViewerEnabled = false; | 
					
						
							| 
									
										
										
										
											2016-10-18 12:04:08 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |         rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( changedField == &inputTwoAzimuthPointsFromViewerEnabled || changedField == &m_twoAzimuthPoints ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( inputTwoAzimuthPointsFromViewerEnabled ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             inputPolyLineFromViewerEnabled        = false; | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |             inputExtrusionPointsFromViewerEnabled = false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( changedField == &m_azimuthAngle ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         updateAzimuthLine(); | 
					
						
							|  |  |  |         rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( changedField == &m_dipAngle ) | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     uiOrdering.add( &m_name ); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup( "Intersecting Geometry" ); | 
					
						
							|  |  |  |     geometryGroup->add( &type ); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type == CS_WELL_PATH ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         geometryGroup->add( &wellPath ); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type == CS_SIMULATION_WELL ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         geometryGroup->add( &simulationWell ); | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |         updateSimulationWellCenterline(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( simulationWell() && m_simulationWellBranchCenterlines.size() > 1 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             geometryGroup->add( &m_branchIndex ); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type == CS_POLYLINE ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         geometryGroup->add( &m_userPolyline ); | 
					
						
							|  |  |  |         geometryGroup->add( &inputPolyLineFromViewerEnabled ); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type == CS_AZIMUTHLINE ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         geometryGroup->add( &m_twoAzimuthPoints ); | 
					
						
							|  |  |  |         geometryGroup->add( &inputTwoAzimuthPointsFromViewerEnabled ); | 
					
						
							|  |  |  |         geometryGroup->add( &m_azimuthAngle ); | 
					
						
							|  |  |  |         geometryGroup->add( &m_dipAngle ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Options" ); | 
					
						
							| 
									
										
										
										
											2015-11-27 13:50:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type == CS_AZIMUTHLINE ) | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         optionsGroup->add( &m_lengthUp ); | 
					
						
							|  |  |  |         optionsGroup->add( &m_lengthDown ); | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         optionsGroup->add( &direction ); | 
					
						
							|  |  |  |         optionsGroup->add( &m_extentLength ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( direction == CS_TWO_POINTS ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         optionsGroup->add( &m_customExtrusionPoints ); | 
					
						
							|  |  |  |         optionsGroup->add( &inputExtrusionPointsFromViewerEnabled ); | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     optionsGroup->add( &m_showInactiveCells ); | 
					
						
							| 
									
										
										
										
											2015-11-27 13:35:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type == CS_POLYLINE ) | 
					
						
							| 
									
										
										
										
											2015-11-30 14:01:13 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         m_extentLength.uiCapability()->setUiReadOnly( true ); | 
					
						
							| 
									
										
										
										
											2015-11-30 14:01:13 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         m_extentLength.uiCapability()->setUiReadOnly( false ); | 
					
						
							| 
									
										
										
										
											2015-11-30 14:01:13 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     this->defineSeparateDataSourceUi( uiConfigName, uiOrdering ); | 
					
						
							| 
									
										
										
										
											2019-11-12 14:00:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  |     updateWellExtentDefaultValue(); | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     uiOrdering.skipRemainingFields( true ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 13:56:02 +01:00
										 |  |  | QList<caf::PdmOptionItemInfo> | 
					
						
							|  |  |  |     RimExtrudedCurveIntersection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, | 
					
						
							|  |  |  |                                                          bool*                      useOptionsOnly ) | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QList<caf::PdmOptionItemInfo> options; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( fieldNeedingOptions == &wellPath ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         RimTools::wellPathOptionItems( &options ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( options.size() > 0 ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( fieldNeedingOptions == &simulationWell ) | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-10-13 14:20:47 +02:00
										 |  |  |         RimSimWellInViewCollection* coll = simulationWellCollection(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( coll ) | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-10-13 10:16:01 +02:00
										 |  |  |             caf::PdmChildArrayField<RimSimWellInView*>& simWells = coll->wells; | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 13:01:46 +02:00
										 |  |  |             caf::IconProvider simWellIcon( ":/Well.svg" ); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             for ( RimSimWellInView* eclWell : simWells ) | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |                 options.push_back( caf::PdmOptionItemInfo( eclWell->name(), eclWell, false, simWellIcon ) ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( options.size() == 0 ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( fieldNeedingOptions == &m_branchIndex ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |         updateSimulationWellCenterline(); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |         size_t branchCount = m_simulationWellBranchCenterlines.size(); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         options.push_back( caf::PdmOptionItemInfo( "All", -1 ) ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for ( size_t bIdx = 0; bIdx < branchCount; ++bIdx ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             options.push_back( caf::PdmOptionItemInfo( QString::number( bIdx + 1 ), QVariant::fromValue( bIdx ) ) ); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2019-11-12 14:00:30 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-11-26 13:26:37 +01:00
										 |  |  |         options = RimIntersection::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); | 
					
						
							| 
									
										
										
										
											2019-11-12 14:00:30 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 09:15:13 +01:00
										 |  |  |     return options; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-11-18 10:06:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | RimSimWellInViewCollection* RimExtrudedCurveIntersection::simulationWellCollection() const | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     RimEclipseView* eclipseView = nullptr; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     firstAncestorOrThisOfType( eclipseView ); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( eclipseView ) | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-03-01 07:51:30 +01:00
										 |  |  |         return eclipseView->wellCollection(); | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     return nullptr; | 
					
						
							| 
									
										
										
										
											2015-11-18 12:16:04 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::updateAzimuthLine() | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( m_twoAzimuthPoints().size() == 2 ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         double currentAzimuth = azimuthInRadians( m_twoAzimuthPoints()[1] - m_twoAzimuthPoints()[0] ); | 
					
						
							|  |  |  |         double newAzimuth     = cvf::Math::toRadians( m_azimuthAngle ); | 
					
						
							|  |  |  |         double rotAngle       = newAzimuth - currentAzimuth; | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         cvf::Mat4d rotMat             = cvf::Mat4d::fromRotation( -cvf::Vec3d::Z_AXIS, rotAngle ); | 
					
						
							|  |  |  |         cvf::Mat4d transFromOriginMat = cvf::Mat4d::fromTranslation( m_twoAzimuthPoints()[0] ); | 
					
						
							|  |  |  |         cvf::Mat4d transToOriginMat   = cvf::Mat4d::fromTranslation( -m_twoAzimuthPoints()[0] ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-12 11:43:15 +01:00
										 |  |  |         m_twoAzimuthPoints.v()[1] = | 
					
						
							|  |  |  |             m_twoAzimuthPoints()[1].getTransformedPoint( transFromOriginMat * rotMat * transToOriginMat ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         m_twoAzimuthPoints.uiCapability()->updateConnectedEditors(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cvf::Vec3d* flattenedPolylineStartPoint ) const | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( flattenedPolylineStartPoint ) *flattenedPolylineStartPoint = cvf::Vec3d::ZERO; | 
					
						
							| 
									
										
										
										
											2018-02-13 16:56:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     std::vector<std::vector<cvf::Vec3d>> lines; | 
					
						
							| 
									
										
										
										
											2018-03-06 15:14:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-13 16:56:48 +01:00
										 |  |  |     double horizontalProjectedLengthAlongWellPathToClipPoint = 0.0; | 
					
						
							| 
									
										
										
										
											2018-03-06 15:14:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type == CS_WELL_PATH ) | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( wellPath() && wellPath->wellPathGeometry() ) | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2020-10-06 12:37:16 +02:00
										 |  |  |             lines.push_back( wellPath->wellPathGeometry()->wellPathPoints() ); | 
					
						
							| 
									
										
										
										
											2018-03-20 13:12:20 +01:00
										 |  |  |             RimCase* ownerCase = nullptr; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             this->firstAncestorOrThisOfType( ownerCase ); | 
					
						
							|  |  |  |             if ( ownerCase ) | 
					
						
							| 
									
										
										
										
											2018-03-20 13:12:20 +01:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2018-03-21 13:56:24 +01:00
										 |  |  |                 size_t dummy; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |                 lines[0] = RigWellPath::clipPolylineStartAboveZ( lines[0], | 
					
						
							|  |  |  |                                                                  ownerCase->activeCellsBoundingBox().max().z(), | 
					
						
							|  |  |  |                                                                  &horizontalProjectedLengthAlongWellPathToClipPoint, | 
					
						
							|  |  |  |                                                                  &dummy ); | 
					
						
							| 
									
										
										
										
											2018-03-20 13:12:20 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type == CS_SIMULATION_WELL ) | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( simulationWell() ) | 
					
						
							| 
									
										
										
										
											2015-11-26 11:08:38 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |             updateSimulationWellCenterline(); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-02 15:16:43 +01:00
										 |  |  |             int branchIndexToUse = branchIndex(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast<int>( m_simulationWellBranchCenterlines.size() ) ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |                 lines.push_back( m_simulationWellBranchCenterlines[branchIndexToUse] ); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             if ( branchIndexToUse == -1 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |                 lines = m_simulationWellBranchCenterlines; | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-11-26 11:08:38 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type == CS_POLYLINE ) | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         lines.push_back( m_userPolyline ); | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type == CS_AZIMUTHLINE ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         lines.push_back( m_twoAzimuthPoints ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type == CS_WELL_PATH || type == CS_SIMULATION_WELL ) | 
					
						
							| 
									
										
										
										
											2015-11-23 14:26:45 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( type == CS_SIMULATION_WELL && simulationWell() ) | 
					
						
							| 
									
										
										
										
											2018-02-28 17:18:48 +01:00
										 |  |  |         { | 
					
						
							|  |  |  |             cvf::Vec3d top, bottom; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             simulationWell->wellHeadTopBottomPosition( -1, &top, &bottom ); | 
					
						
							| 
									
										
										
										
											2018-02-28 17:18:48 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |             for ( size_t lIdx = 0; lIdx < lines.size(); ++lIdx ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 std::vector<cvf::Vec3d>& polyLine = lines[lIdx]; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |                 polyLine.insert( polyLine.begin(), top ); | 
					
						
							| 
									
										
										
										
											2018-02-28 17:18:48 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         for ( size_t lIdx = 0; lIdx < lines.size(); ++lIdx ) | 
					
						
							| 
									
										
										
										
											2015-11-23 14:26:45 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |             std::vector<cvf::Vec3d>& polyLine = lines[lIdx]; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             addExtents( polyLine ); | 
					
						
							| 
									
										
										
										
											2015-11-23 14:26:45 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-02-13 16:56:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( flattenedPolylineStartPoint && lines.size() && lines[0].size() > 1 ) | 
					
						
							| 
									
										
										
										
											2018-02-13 16:56:48 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             ( *flattenedPolylineStartPoint )[0] = horizontalProjectedLengthAlongWellPathToClipPoint - m_extentLength; | 
					
						
							|  |  |  |             ( *flattenedPolylineStartPoint )[2] = lines[0][1].z(); // Depth of first point in first polyline
 | 
					
						
							| 
									
										
										
										
											2018-03-13 16:16:41 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if ( flattenedPolylineStartPoint && lines.size() && lines[0].size() ) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             ( *flattenedPolylineStartPoint )[2] = lines[0][0].z(); // Depth of first point in first polyline
 | 
					
						
							| 
									
										
										
										
											2018-02-13 16:56:48 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-11-23 14:26:45 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |     return lines; | 
					
						
							| 
									
										
										
										
											2015-11-18 15:55:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-19 11:41:16 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-19 11:41:16 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:51:54 +01:00
										 |  |  | RivExtrudedCurveIntersectionPartMgr* RimExtrudedCurveIntersection::intersectionPartMgr() | 
					
						
							| 
									
										
										
										
											2015-11-19 11:41:16 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-11-26 11:51:54 +01:00
										 |  |  |     if ( m_crossSectionPartMgr.isNull() ) m_crossSectionPartMgr = new RivExtrudedCurveIntersectionPartMgr( this ); | 
					
						
							| 
									
										
										
										
											2015-11-19 11:41:16 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return m_crossSectionPartMgr.p(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-06 10:09:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2018-11-06 10:09:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::rebuildGeometry() | 
					
						
							| 
									
										
										
										
											2018-11-06 10:09:30 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_crossSectionPartMgr = nullptr; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-18 14:25:31 +02:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2016-10-18 14:25:31 +02:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | std::vector<cvf::Vec3d> RimExtrudedCurveIntersection::polyLinesForExtrusionDirection() const | 
					
						
							| 
									
										
										
										
											2016-10-18 14:25:31 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-12 15:14:22 +01:00
										 |  |  |     return m_customExtrusionPoints; | 
					
						
							| 
									
										
										
										
											2016-10-18 14:25:31 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::updateSimulationWellCenterline() const | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |     if ( m_isActive() && type == CS_SIMULATION_WELL && simulationWell() ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( m_simulationWellBranchCenterlines.empty() ) | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2018-03-02 13:54:42 +01:00
										 |  |  |             auto branches = simulationWell->wellPipeBranches(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             for ( const auto& branch : branches ) | 
					
						
							| 
									
										
										
										
											2017-12-08 12:22:35 +01:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2020-10-06 12:37:16 +02:00
										 |  |  |                 m_simulationWellBranchCenterlines.push_back( branch->wellPathPoints() ); | 
					
						
							| 
									
										
										
										
											2017-12-08 12:22:35 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |         m_simulationWellBranchCenterlines.clear(); | 
					
						
							| 
									
										
										
										
											2015-11-26 13:39:31 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::addExtents( std::vector<cvf::Vec3d>& polyLine ) const | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     size_t lineVxCount = polyLine.size(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if ( lineVxCount == 0 ) return; | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Add extent at end of well
 | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         size_t     endIdxOffset = lineVxCount > 3 ? 3 : lineVxCount; | 
					
						
							|  |  |  |         cvf::Vec3d endDirection = ( polyLine[lineVxCount - 1] - polyLine[lineVxCount - endIdxOffset] ); | 
					
						
							|  |  |  |         endDirection[2]         = 0; // Remove z. make extent length be horizontally
 | 
					
						
							|  |  |  |         if ( endDirection.length() < 1e-2 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             endDirection    = polyLine.back() - polyLine.front(); | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |             endDirection[2] = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             if ( endDirection.length() < 1e-2 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |             { | 
					
						
							|  |  |  |                 endDirection = cvf::Vec3d::X_AXIS; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         endDirection.normalize(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         cvf::Vec3d newEnd = polyLine.back() + endDirection * m_extentLength(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         polyLine.push_back( newEnd ); | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Add extent at start
 | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         size_t     endIdxOffset   = lineVxCount > 3 ? 3 : lineVxCount - 1; | 
					
						
							|  |  |  |         cvf::Vec3d startDirection = ( polyLine[0] - polyLine[endIdxOffset] ); | 
					
						
							|  |  |  |         startDirection[2]         = 0; // Remove z. make extent length be horizontally
 | 
					
						
							|  |  |  |         if ( startDirection.length() < 1e-2 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             startDirection    = polyLine.front() - polyLine.back(); | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |             startDirection[2] = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             if ( startDirection.length() < 1e-2 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |             { | 
					
						
							|  |  |  |                 startDirection = -cvf::Vec3d::X_AXIS; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         startDirection.normalize(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         cvf::Vec3d newStart = polyLine.front() + startDirection * m_extentLength(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         polyLine.insert( polyLine.begin(), newStart ); | 
					
						
							| 
									
										
										
										
											2015-11-26 15:59:02 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::updateWellExtentDefaultValue() | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     RimCase* ownerCase = nullptr; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     firstAncestorOrThisOfType( ownerCase ); | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( ownerCase ) | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         cvf::BoundingBox caseBB = ownerCase->activeCellsBoundingBox(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( m_extentLength == m_extentLength.defaultValue() && caseBB.radius() < 1000 ) | 
					
						
							| 
									
										
										
										
											2015-11-26 16:47:45 +01:00
										 |  |  |         { | 
					
						
							|  |  |  |             m_extentLength = caseBB.radius() * 0.1; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::updateName() | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type == CS_SIMULATION_WELL && simulationWell() ) | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |         m_name = simulationWell()->name(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( branchIndex() != -1 ) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |             m_name = m_name() + " Branch " + QString::number( branchIndex() + 1 ); | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( type() == CS_WELL_PATH && wellPath() ) | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-11-12 15:10:41 +01:00
										 |  |  |         m_name = wellPath()->name(); | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-03 09:55:08 +02:00
										 |  |  |     Rim2dIntersectionView* iView = correspondingIntersectionView(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( iView ) | 
					
						
							| 
									
										
										
										
											2018-05-03 09:55:08 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         iView->updateName(); | 
					
						
							|  |  |  |         iView->updateConnectedEditors(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-27 10:13:29 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-02 15:16:43 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2018-03-02 15:16:43 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | int RimExtrudedCurveIntersection::branchIndex() const | 
					
						
							| 
									
										
										
										
											2018-03-02 15:16:43 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     RimSimWellInViewCollection* coll = simulationWellCollection(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( coll && !coll->isAutoDetectingBranches() ) | 
					
						
							| 
									
										
										
										
											2018-03-02 15:16:43 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         return -1; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( m_branchIndex >= static_cast<int>( m_simulationWellBranchCenterlines.size() ) ) | 
					
						
							| 
									
										
										
										
											2018-03-02 15:16:43 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         return -1; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return m_branchIndex; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute ) | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( attribute ) | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( buttonEnable ) | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |             attribute->m_buttonText = "Stop picking points"; | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |             attribute->m_buttonText = "Start picking points"; | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-09-18 10:38:20 +02:00
										 |  |  |     // if ( attribute && enable )
 | 
					
						
							|  |  |  |     if ( attribute ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-09-18 10:38:20 +02:00
										 |  |  |         attribute->m_qssState = enable ? "ExternalInput" : QString(); | 
					
						
							|  |  |  |         // attribute->m_baseColor.setRgb( 255, 220, 255 );
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHandle* field, | 
					
						
							| 
									
										
										
										
											2019-11-26 13:56:02 +01:00
										 |  |  |                                                           QString                    uiConfigName, | 
					
						
							|  |  |  |                                                           caf::PdmUiEditorAttribute* attribute ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-12 11:43:15 +01:00
										 |  |  |     caf::PdmUiDoubleSliderEditorAttribute* doubleSliderAttrib = | 
					
						
							|  |  |  |         dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute ); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( doubleSliderAttrib ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( field == &m_azimuthAngle ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             doubleSliderAttrib->m_minimum         = 0; | 
					
						
							|  |  |  |             doubleSliderAttrib->m_maximum         = 360; | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |             doubleSliderAttrib->m_sliderTickCount = 360; | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         else if ( field == &m_dipAngle ) | 
					
						
							| 
									
										
										
										
											2017-11-23 10:59:52 +01:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             doubleSliderAttrib->m_minimum         = 0; | 
					
						
							|  |  |  |             doubleSliderAttrib->m_maximum         = 180; | 
					
						
							| 
									
										
										
										
											2017-11-23 10:59:52 +01:00
										 |  |  |             doubleSliderAttrib->m_sliderTickCount = 180; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( field == &inputPolyLineFromViewerEnabled ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-02-12 11:43:15 +01:00
										 |  |  |         setPushButtonText( inputPolyLineFromViewerEnabled, dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( field == &m_userPolyline ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         setBaseColor( inputPolyLineFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( field == &inputTwoAzimuthPointsFromViewerEnabled ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         setPushButtonText( inputTwoAzimuthPointsFromViewerEnabled, | 
					
						
							|  |  |  |                            dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( field == &m_twoAzimuthPoints ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         setBaseColor( inputTwoAzimuthPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( field == &inputExtrusionPointsFromViewerEnabled ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         setPushButtonText( inputExtrusionPointsFromViewerEnabled, | 
					
						
							|  |  |  |                            dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( field == &m_customExtrusionPoints ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         setBaseColor( inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) ); | 
					
						
							| 
									
										
										
										
											2015-11-30 15:12:00 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::appendPointToPolyLine( const cvf::Vec3d& point ) | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     m_userPolyline.v().push_back( point ); | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-30 10:00:06 +01:00
										 |  |  |     m_userPolyline.uiCapability()->updateConnectedEditors(); | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | Rim2dIntersectionView* RimExtrudedCurveIntersection::correspondingIntersectionView() | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-15 12:55:45 +02:00
										 |  |  |     std::vector<Rim2dIntersectionView*> objects; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     this->objectsWithReferringPtrFieldsOfType( objects ); | 
					
						
							|  |  |  |     for ( auto isectView : objects ) | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         if ( isectView ) | 
					
						
							| 
									
										
										
										
											2018-08-15 12:55:45 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |             return isectView; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-08-15 12:55:45 +02:00
										 |  |  |     return nullptr; | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::appendPointToExtrusionDirection( const cvf::Vec3d& point ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( m_customExtrusionPoints().size() > 1 ) m_customExtrusionPoints.v().clear(); | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     m_customExtrusionPoints.v().push_back( point ); | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_customExtrusionPoints.uiCapability()->updateConnectedEditors(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-04 09:25:01 +01:00
										 |  |  |     rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::appendPointToAzimuthLine( const cvf::Vec3d& point ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( m_twoAzimuthPoints().empty() ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         m_twoAzimuthPoints.v().push_back( point ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( m_twoAzimuthPoints().size() == 1 ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         cvf::Vec3d projectedPoint = cvf::Vec3d( point[0], point[1], m_twoAzimuthPoints.v()[0][2] ); | 
					
						
							|  |  |  |         m_twoAzimuthPoints.v().push_back( projectedPoint ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         m_azimuthAngle = cvf::Math::toDegrees( azimuthInRadians( m_twoAzimuthPoints()[1] - m_twoAzimuthPoints()[0] ) ); | 
					
						
							| 
									
										
										
										
											2017-11-23 11:08:02 +01:00
										 |  |  |         m_azimuthAngle.uiCapability()->updateConnectedEditors(); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( m_twoAzimuthPoints().size() > 1 ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         m_twoAzimuthPoints.v().clear(); | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         m_twoAzimuthPoints.v().push_back( point ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     m_twoAzimuthPoints.uiCapability()->updateConnectedEditors(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     rebuildGeometryAndScheduleCreateDisplayModel(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | cvf::Vec3d RimExtrudedCurveIntersection::extrusionDirection() const | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     cvf::Vec3d dir = cvf::Vec3d::Z_AXIS; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  |     if ( direction() == RimExtrudedCurveIntersection::CS_HORIZONTAL ) | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         std::vector<std::vector<cvf::Vec3d>> lines = this->polyLines(); | 
					
						
							|  |  |  |         if ( lines.size() > 0 && lines[0].size() > 1 ) | 
					
						
							| 
									
										
										
										
											2016-10-20 11:27:07 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             std::vector<cvf::Vec3d> firstLine = lines[0]; | 
					
						
							| 
									
										
										
										
											2016-10-20 11:27:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             // Use first and last point of polyline to approximate orientation of polyline
 | 
					
						
							|  |  |  |             // Then cross with Z axis to find extrusion direction
 | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-20 11:27:07 +02:00
										 |  |  |             cvf::Vec3d polyLineDir = firstLine[firstLine.size() - 1] - firstLine[0]; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |             cvf::Vec3d up          = cvf::Vec3d::Z_AXIS; | 
					
						
							|  |  |  |             dir                    = polyLineDir ^ up; | 
					
						
							| 
									
										
										
										
											2016-10-20 11:27:07 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  |     else if ( direction() == RimExtrudedCurveIntersection::CS_TWO_POINTS && m_customExtrusionPoints().size() > 1 ) | 
					
						
							| 
									
										
										
										
											2016-10-18 11:57:05 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         dir = m_customExtrusionPoints()[m_customExtrusionPoints().size() - 1] - m_customExtrusionPoints()[0]; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     else if ( m_twoAzimuthPoints().size() == 2 ) | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         double dipInRad = cvf::Math::toRadians( m_dipAngle ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |         cvf::Vec3d azimutDirection = m_twoAzimuthPoints()[1] - m_twoAzimuthPoints()[0]; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         cvf::Mat3d rotMat                           = cvf::Mat3d::fromRotation( azimutDirection, dipInRad ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  |         cvf::Vec3d vecPerpToRotVecInHorizontalPlane = azimutDirection ^ cvf::Vec3d::Z_AXIS; | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         dir = vecPerpToRotVecInHorizontalPlane.getTransformedVector( rotMat ); | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-10-18 10:22:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return dir; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | double RimExtrudedCurveIntersection::lengthUp() const | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  |     return m_lengthUp; | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | double RimExtrudedCurveIntersection::lengthDown() const | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  |     return m_lengthDown; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::setLengthDown( double lengthDown ) | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_lengthDown = lengthDown; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2018-03-13 16:16:41 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | double RimExtrudedCurveIntersection::extentLength() | 
					
						
							| 
									
										
										
										
											2018-03-13 16:16:41 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return m_extentLength(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::recomputeSimulationWellBranchData() | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     if ( type() == CS_SIMULATION_WELL ) | 
					
						
							| 
									
										
										
										
											2018-03-02 11:25:47 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         m_simulationWellBranchCenterlines.clear(); | 
					
						
							|  |  |  |         updateSimulationWellCenterline(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         m_crossSectionPartMgr = nullptr; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-12 09:21:27 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2018-03-12 09:21:27 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | bool RimExtrudedCurveIntersection::hasDefiningPoints() const | 
					
						
							| 
									
										
										
										
											2018-03-12 09:21:27 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return type == CS_POLYLINE || type == CS_AZIMUTHLINE; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::setLengthUp( double lengthUp ) | 
					
						
							| 
									
										
										
										
											2017-11-24 13:57:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     m_lengthUp = lengthUp; | 
					
						
							| 
									
										
										
										
											2017-11-23 15:19:10 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | void RimExtrudedCurveIntersection::rebuildGeometryAndScheduleCreateDisplayModel() | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-14 12:49:05 +01:00
										 |  |  |     m_crossSectionPartMgr = nullptr; | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 10:11:28 +01:00
										 |  |  |     Rim3dView* rimView = nullptr; | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     this->firstAncestorOrThisOfType( rimView ); | 
					
						
							|  |  |  |     if ( rimView ) | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         rimView->scheduleCreateDisplayModelAndRedraw(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     Rim2dIntersectionView* iview = correspondingIntersectionView(); | 
					
						
							|  |  |  |     if ( iview ) | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |         iview->scheduleGeometryRegen( RivCellSetEnum::ALL_CELLS ); | 
					
						
							| 
									
										
										
										
											2018-01-25 17:37:22 +01:00
										 |  |  |         iview->scheduleCreateDisplayModelAndRedraw(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-11-27 17:18:30 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  | ///
 | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | //--------------------------------------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2019-11-26 11:35:21 +01:00
										 |  |  | double RimExtrudedCurveIntersection::azimuthInRadians( cvf::Vec3d vec ) | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-06 10:40:57 +02:00
										 |  |  |     return cvf::GeometryTools::getAngle( -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS, vec ); | 
					
						
							| 
									
										
										
										
											2017-11-21 13:43:22 +01:00
										 |  |  | } |