2015-11-18 02:15:13 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-09-21 03:48:25 -05:00
|
|
|
#include "RimIntersection.h"
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2015-11-18 05:16:04 -06:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2017-12-08 05:22:35 -06:00
|
|
|
#include "RigEclipseCaseData.h"
|
2017-02-24 07:31:06 -06:00
|
|
|
#include "RigWellPath.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
#include "RimCase.h"
|
2017-12-08 05:22:35 -06:00
|
|
|
#include "RimEclipseCase.h"
|
2015-11-18 05:16:04 -06:00
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimProject.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimSimWellInView.h"
|
2017-10-13 07:20:47 -05:00
|
|
|
#include "RimSimWellInViewCollection.h"
|
2017-01-05 00:53:14 -06:00
|
|
|
#include "RimTools.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
#include "RimView.h"
|
2015-11-18 05:16:04 -06:00
|
|
|
#include "RimWellPath.h"
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2015-11-27 10:18:30 -06:00
|
|
|
#include "RiuViewer.h"
|
2016-09-21 03:32:29 -05:00
|
|
|
#include "RivIntersectionPartMgr.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
#include "cafCmdFeature.h"
|
|
|
|
#include "cafCmdFeatureManager.h"
|
2017-11-21 06:43:22 -06:00
|
|
|
#include "cafPdmUiDoubleSliderEditor.h"
|
2015-11-30 08:12:00 -06:00
|
|
|
#include "cafPdmUiListEditor.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
#include "cafPdmUiPushButtonEditor.h"
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2017-01-17 08:11:02 -06:00
|
|
|
#include "cvfBoundingBox.h"
|
2017-11-21 06:43:22 -06:00
|
|
|
#include "cvfGeometryTools.h"
|
2017-02-24 04:07:15 -06:00
|
|
|
#include "cvfPlane.h"
|
2017-01-17 08:11:02 -06:00
|
|
|
|
2015-11-18 02:15:13 -06:00
|
|
|
|
|
|
|
namespace caf {
|
|
|
|
|
2015-11-18 03:06:42 -06:00
|
|
|
template<>
|
2016-09-21 03:48:25 -05:00
|
|
|
void caf::AppEnum< RimIntersection::CrossSectionEnum >::setUp()
|
2015-11-18 03:06:42 -06:00
|
|
|
{
|
2016-09-21 03:48:25 -05:00
|
|
|
addItem(RimIntersection::CS_WELL_PATH, "CS_WELL_PATH", "Well Path");
|
|
|
|
addItem(RimIntersection::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well");
|
|
|
|
addItem(RimIntersection::CS_POLYLINE, "CS_POLYLINE", "Polyline");
|
2017-11-21 11:57:33 -06:00
|
|
|
addItem(RimIntersection::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip");
|
2016-09-21 03:48:25 -05:00
|
|
|
setDefault(RimIntersection::CS_WELL_PATH);
|
2015-11-18 03:06:42 -06:00
|
|
|
}
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2015-11-18 08:55:05 -06:00
|
|
|
template<>
|
2016-09-21 03:48:25 -05:00
|
|
|
void caf::AppEnum< RimIntersection::CrossSectionDirEnum >::setUp()
|
2015-11-18 08:55:05 -06:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
addItem(RimIntersection::CS_VERTICAL, "CS_VERTICAL", "Vertical");
|
|
|
|
addItem(RimIntersection::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal");
|
2017-11-14 05:49:05 -06:00
|
|
|
addItem(RimIntersection::CS_TWO_POINTS, "CS_TWO_POINTS", "Defined by Two Points");
|
2016-09-21 03:48:25 -05:00
|
|
|
setDefault(RimIntersection::CS_VERTICAL);
|
2015-11-18 08:55:05 -06:00
|
|
|
}
|
|
|
|
|
2015-11-18 02:15:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-21 03:48:25 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimIntersection, "CrossSection");
|
2015-11-18 02:15:13 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
RimIntersection::RimIntersection()
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
2015-11-24 06:26:45 -06:00
|
|
|
CAF_PDM_InitObject("Intersection", ":/CrossSection16x16.png", "", "");
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2015-11-23 02:07:35 -06:00
|
|
|
CAF_PDM_InitField(&name, "UserDescription", QString("Intersection Name"), "Name", "", "", "");
|
2015-11-18 02:15:13 -06:00
|
|
|
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
|
|
|
isActive.uiCapability()->setUiHidden(true);
|
|
|
|
|
2015-11-26 08:59:02 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&type, "Type", "Type", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&direction, "Direction", "Direction", "", "", "");
|
2015-11-27 06:50:31 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&wellPath, "WellPath", "Well Path ", "", "", "");
|
2015-11-26 08:59:02 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
2015-12-01 08:25:06 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_userPolyline, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "");
|
2016-10-18 03:22:20 -05:00
|
|
|
|
2017-11-21 11:57:33 -06:00
|
|
|
CAF_PDM_InitField(&m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth", "", "", "");
|
2017-11-21 06:43:22 -06:00
|
|
|
m_azimuthAngle.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
|
|
|
|
2017-11-21 11:57:33 -06:00
|
|
|
CAF_PDM_InitField(&m_dipAngle, "DipAngle", 90.0, "Dip", "", "", "");
|
2017-11-21 06:43:22 -06:00
|
|
|
m_dipAngle.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
2017-11-14 05:49:05 -06:00
|
|
|
|
2016-10-18 04:57:05 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_customExtrusionPoints, "CustomExtrusionPoints", "", "", "", "");
|
2017-11-21 06:43:22 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_twoAzimuthPoints, "TwoAzimuthPoints", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "");
|
2016-10-18 03:22:20 -05:00
|
|
|
|
2017-11-23 08:19:10 -06:00
|
|
|
CAF_PDM_InitField (&m_branchIndex, "Branch", -1, "Branch", "", "", "");
|
|
|
|
CAF_PDM_InitField (&m_extentLength, "ExtentLength", 200.0, "Extent Length", "", "", "");
|
2017-11-24 06:57:35 -06:00
|
|
|
CAF_PDM_InitField (&m_lengthUp, "lengthUp", 1000.0, "Length Up", "", "", "");
|
|
|
|
CAF_PDM_InitField (&m_lengthDown, "lengthDown", 1000.0, "Length Down", "", "", "");
|
2017-11-23 08:19:10 -06:00
|
|
|
|
2016-10-04 03:10:06 -05:00
|
|
|
CAF_PDM_InitField (&showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "");
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2016-10-18 04:57:05 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&inputPolyLineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", "");
|
2017-11-16 05:43:05 -06:00
|
|
|
caf::PdmUiPushButtonEditor::configureEditorForField(&inputPolyLineFromViewerEnabled);
|
2016-10-18 04:57:05 -05:00
|
|
|
inputPolyLineFromViewerEnabled = false;
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&inputExtrusionPointsFromViewerEnabled, "inputExtrusionPointsFromViewerEnabled", "", "", "", "");
|
2017-11-16 05:43:05 -06:00
|
|
|
caf::PdmUiPushButtonEditor::configureEditorForField(&inputExtrusionPointsFromViewerEnabled);
|
2016-10-18 04:57:05 -05:00
|
|
|
inputExtrusionPointsFromViewerEnabled = false;
|
2015-11-26 08:59:02 -06:00
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&inputTwoAzimuthPointsFromViewerEnabled, "inputTwoAzimuthPointsFromViewerEnabled", "", "", "", "");
|
|
|
|
caf::PdmUiPushButtonEditor::configureEditorForField(&inputTwoAzimuthPointsFromViewerEnabled);
|
|
|
|
inputTwoAzimuthPointsFromViewerEnabled = false;
|
|
|
|
|
2016-10-10 08:38:31 -05:00
|
|
|
uiCapability()->setUiTreeChildrenHidden(true);
|
2015-11-18 02:15:13 -06:00
|
|
|
}
|
|
|
|
|
2015-12-03 01:26:38 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
RimIntersection::~RimIntersection()
|
2015-12-03 01:26:38 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-18 02:15:13 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
2015-11-19 11:56:23 -06:00
|
|
|
if (changedField == &isActive ||
|
|
|
|
changedField == &type ||
|
|
|
|
changedField == &direction ||
|
|
|
|
changedField == &wellPath ||
|
2015-11-26 06:39:31 -06:00
|
|
|
changedField == &simulationWell ||
|
2015-11-26 08:59:02 -06:00
|
|
|
changedField == &m_branchIndex ||
|
2015-11-27 06:35:17 -06:00
|
|
|
changedField == &m_extentLength ||
|
2017-11-24 06:57:35 -06:00
|
|
|
changedField == &m_lengthUp ||
|
|
|
|
changedField == &m_lengthDown ||
|
2015-11-27 06:35:17 -06:00
|
|
|
changedField == &showInactiveCells)
|
2015-11-19 04:41:16 -06:00
|
|
|
{
|
2015-11-27 10:18:30 -06:00
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
2015-11-19 04:41:16 -06:00
|
|
|
}
|
2015-11-26 06:39:31 -06:00
|
|
|
|
|
|
|
if (changedField == &simulationWell
|
|
|
|
|| changedField == &isActive
|
|
|
|
|| changedField == &type)
|
|
|
|
{
|
|
|
|
m_wellBranchCenterlines.clear();
|
|
|
|
updateWellCenterline();
|
2015-11-26 08:59:02 -06:00
|
|
|
m_branchIndex = -1;
|
2015-11-26 06:39:31 -06:00
|
|
|
}
|
2015-11-27 03:13:29 -06:00
|
|
|
|
|
|
|
if (changedField == &simulationWell
|
|
|
|
|| changedField == &wellPath
|
|
|
|
|| changedField == &m_branchIndex)
|
|
|
|
{
|
|
|
|
updateName();
|
|
|
|
}
|
|
|
|
|
2016-10-18 04:57:05 -05:00
|
|
|
if (changedField == &inputPolyLineFromViewerEnabled
|
2015-11-30 06:54:56 -06:00
|
|
|
|| changedField == &m_userPolyline)
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2016-10-18 05:04:08 -05:00
|
|
|
if (inputPolyLineFromViewerEnabled)
|
|
|
|
{
|
|
|
|
inputExtrusionPointsFromViewerEnabled = false;
|
2017-11-21 06:43:22 -06:00
|
|
|
inputTwoAzimuthPointsFromViewerEnabled = false;
|
2016-10-18 05:04:08 -05:00
|
|
|
}
|
|
|
|
|
2015-11-27 10:18:30 -06:00
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
2016-10-18 04:57:05 -05:00
|
|
|
|
|
|
|
if (changedField == &inputExtrusionPointsFromViewerEnabled
|
|
|
|
|| changedField == &m_customExtrusionPoints)
|
|
|
|
{
|
2016-10-18 05:04:08 -05:00
|
|
|
if (inputExtrusionPointsFromViewerEnabled)
|
|
|
|
{
|
|
|
|
inputPolyLineFromViewerEnabled = false;
|
2017-11-21 06:43:22 -06:00
|
|
|
inputTwoAzimuthPointsFromViewerEnabled = false;
|
2016-10-18 05:04:08 -05:00
|
|
|
}
|
|
|
|
|
2016-10-18 04:57:05 -05:00
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
2017-11-14 05:49:05 -06:00
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
if (changedField == &inputTwoAzimuthPointsFromViewerEnabled
|
|
|
|
|| changedField == &m_twoAzimuthPoints)
|
|
|
|
{
|
|
|
|
if (inputTwoAzimuthPointsFromViewerEnabled)
|
|
|
|
{
|
|
|
|
inputPolyLineFromViewerEnabled = false;
|
|
|
|
inputExtrusionPointsFromViewerEnabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (changedField == &m_azimuthAngle)
|
|
|
|
{
|
|
|
|
updateAzimuthLine();
|
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(changedField == &m_dipAngle)
|
2017-11-14 05:49:05 -06:00
|
|
|
{
|
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
2015-11-18 02:15:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
2015-11-18 05:16:04 -06:00
|
|
|
uiOrdering.add(&name);
|
2015-11-27 06:50:31 -06:00
|
|
|
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Intersecting Geometry");
|
|
|
|
geometryGroup->add(&type);
|
2015-11-18 05:16:04 -06:00
|
|
|
|
2015-11-18 08:55:05 -06:00
|
|
|
if (type == CS_WELL_PATH)
|
2015-11-18 05:16:04 -06:00
|
|
|
{
|
2015-11-27 06:50:31 -06:00
|
|
|
geometryGroup->add(&wellPath);
|
2015-11-18 05:16:04 -06:00
|
|
|
}
|
2015-11-18 08:55:05 -06:00
|
|
|
else if (type == CS_SIMULATION_WELL)
|
2015-11-18 05:16:04 -06:00
|
|
|
{
|
2015-11-27 06:50:31 -06:00
|
|
|
geometryGroup->add(&simulationWell);
|
2015-11-26 06:39:31 -06:00
|
|
|
updateWellCenterline();
|
|
|
|
if (simulationWell() && m_wellBranchCenterlines.size() > 1)
|
|
|
|
{
|
2015-11-27 06:50:31 -06:00
|
|
|
geometryGroup->add(&m_branchIndex);
|
2015-11-26 06:39:31 -06:00
|
|
|
}
|
2015-11-18 05:16:04 -06:00
|
|
|
}
|
2015-11-27 10:18:30 -06:00
|
|
|
else if (type == CS_POLYLINE)
|
2015-11-18 05:16:04 -06:00
|
|
|
{
|
2015-11-30 03:00:06 -06:00
|
|
|
geometryGroup->add(&m_userPolyline);
|
2016-10-18 04:57:05 -05:00
|
|
|
geometryGroup->add(&inputPolyLineFromViewerEnabled);
|
2015-11-18 05:16:04 -06:00
|
|
|
}
|
2017-11-21 06:43:22 -06:00
|
|
|
else if (type == CS_AZIMUTHLINE)
|
|
|
|
{
|
|
|
|
geometryGroup->add(&m_twoAzimuthPoints);
|
|
|
|
geometryGroup->add(&inputTwoAzimuthPointsFromViewerEnabled);
|
|
|
|
geometryGroup->add(&m_azimuthAngle);
|
|
|
|
geometryGroup->add(&m_dipAngle);
|
|
|
|
}
|
2015-11-18 05:16:04 -06:00
|
|
|
|
2015-11-27 06:50:31 -06:00
|
|
|
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup("Options");
|
|
|
|
|
2017-11-23 08:19:10 -06:00
|
|
|
if (type == CS_AZIMUTHLINE)
|
|
|
|
{
|
2017-11-24 06:57:35 -06:00
|
|
|
optionsGroup->add(&m_lengthUp);
|
|
|
|
optionsGroup->add(&m_lengthDown);
|
2017-11-23 08:19:10 -06:00
|
|
|
}
|
|
|
|
else
|
2017-11-21 06:43:22 -06:00
|
|
|
{
|
|
|
|
optionsGroup->add(&direction);
|
|
|
|
optionsGroup->add(&m_extentLength);
|
|
|
|
}
|
2016-10-18 04:57:05 -05:00
|
|
|
|
|
|
|
if (direction == CS_TWO_POINTS)
|
|
|
|
{
|
|
|
|
optionsGroup->add(&m_customExtrusionPoints);
|
|
|
|
optionsGroup->add(&inputExtrusionPointsFromViewerEnabled);
|
|
|
|
}
|
|
|
|
|
2015-11-27 06:50:31 -06:00
|
|
|
optionsGroup->add(&showInactiveCells);
|
2015-11-27 06:35:17 -06:00
|
|
|
|
2015-11-30 07:01:13 -06:00
|
|
|
if (type == CS_POLYLINE)
|
|
|
|
{
|
|
|
|
m_extentLength.uiCapability()->setUiReadOnly(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_extentLength.uiCapability()->setUiReadOnly(false);
|
|
|
|
}
|
|
|
|
|
2015-11-26 09:47:45 -06:00
|
|
|
updateWellExtentDefaultValue();
|
2015-11-26 08:59:02 -06:00
|
|
|
|
2017-03-21 07:47:53 -05:00
|
|
|
uiOrdering.skipRemainingFields(true);
|
2015-11-18 02:15:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
|
2015-11-18 05:16:04 -06:00
|
|
|
if (fieldNeedingOptions == &wellPath)
|
|
|
|
{
|
2017-01-05 00:53:14 -06:00
|
|
|
RimTools::wellPathOptionItems(&options);
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2017-01-05 00:53:14 -06:00
|
|
|
if (options.size() > 0)
|
2015-11-18 05:16:04 -06:00
|
|
|
{
|
2017-01-05 00:53:14 -06:00
|
|
|
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
2015-11-18 05:16:04 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (fieldNeedingOptions == &simulationWell)
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
2017-10-13 07:20:47 -05:00
|
|
|
RimSimWellInViewCollection* coll = simulationWellCollection();
|
2015-11-18 05:16:04 -06:00
|
|
|
if (coll)
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
2017-10-13 03:16:01 -05:00
|
|
|
caf::PdmChildArrayField<RimSimWellInView*>& simWells = coll->wells;
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2015-11-18 05:16:04 -06:00
|
|
|
QIcon simWellIcon(":/Well.png");
|
2017-10-13 03:16:01 -05:00
|
|
|
for (RimSimWellInView* eclWell : simWells)
|
2015-11-18 02:15:13 -06:00
|
|
|
{
|
2017-01-05 00:53:14 -06:00
|
|
|
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
|
2015-11-18 02:15:13 -06:00
|
|
|
}
|
2015-11-18 05:16:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options.size() == 0)
|
|
|
|
{
|
2017-01-05 00:53:14 -06:00
|
|
|
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
2015-11-18 02:15:13 -06:00
|
|
|
}
|
|
|
|
}
|
2015-11-26 08:59:02 -06:00
|
|
|
else if (fieldNeedingOptions == &m_branchIndex)
|
2015-11-26 06:39:31 -06:00
|
|
|
{
|
|
|
|
updateWellCenterline();
|
|
|
|
|
|
|
|
size_t branchCount = m_wellBranchCenterlines.size();
|
|
|
|
|
|
|
|
options.push_back(caf::PdmOptionItemInfo("All", -1));
|
2015-11-18 05:16:04 -06:00
|
|
|
|
2015-12-01 07:19:49 -06:00
|
|
|
for (size_t bIdx = 0; bIdx < branchCount; ++bIdx)
|
2015-11-26 06:39:31 -06:00
|
|
|
{
|
|
|
|
options.push_back(caf::PdmOptionItemInfo(QString::number(bIdx + 1), QVariant::fromValue(bIdx)));
|
|
|
|
}
|
|
|
|
}
|
2015-11-18 02:15:13 -06:00
|
|
|
return options;
|
|
|
|
}
|
2015-11-18 03:06:42 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
caf::PdmFieldHandle* RimIntersection::userDescriptionField()
|
2015-11-18 03:06:42 -06:00
|
|
|
{
|
|
|
|
return &name;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
caf::PdmFieldHandle* RimIntersection::objectToggleField()
|
2015-11-18 03:06:42 -06:00
|
|
|
{
|
|
|
|
return &isActive;
|
|
|
|
}
|
2015-11-18 05:16:04 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-10-13 07:20:47 -05:00
|
|
|
RimSimWellInViewCollection* RimIntersection::simulationWellCollection()
|
2015-11-18 05:16:04 -06:00
|
|
|
{
|
2017-11-14 05:49:05 -06:00
|
|
|
RimEclipseView* eclipseView = nullptr;
|
2016-09-21 06:59:41 -05:00
|
|
|
firstAncestorOrThisOfType(eclipseView);
|
2015-11-18 05:16:04 -06:00
|
|
|
|
|
|
|
if (eclipseView)
|
|
|
|
{
|
|
|
|
return eclipseView->wellCollection;
|
|
|
|
}
|
|
|
|
|
2017-11-14 05:49:05 -06:00
|
|
|
return nullptr;
|
2015-11-18 05:16:04 -06:00
|
|
|
}
|
2015-11-18 08:55:05 -06:00
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIntersection::updateAzimuthLine()
|
|
|
|
{
|
|
|
|
if (m_twoAzimuthPoints().size() == 2)
|
|
|
|
{
|
|
|
|
double currentAzimuth = azimuthInRadians(m_twoAzimuthPoints()[1] - m_twoAzimuthPoints()[0]);
|
|
|
|
double newAzimuth = cvf::Math::toRadians(m_azimuthAngle);
|
|
|
|
double rotAngle = newAzimuth - currentAzimuth;
|
|
|
|
|
|
|
|
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]);
|
|
|
|
|
|
|
|
m_twoAzimuthPoints.v()[1] = m_twoAzimuthPoints()[1].getTransformedPoint(transFromOriginMat*rotMat*transToOriginMat);
|
|
|
|
|
|
|
|
m_twoAzimuthPoints.uiCapability()->updateConnectedEditors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-18 08:55:05 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLines() const
|
2015-11-18 08:55:05 -06:00
|
|
|
{
|
2015-11-23 07:26:45 -06:00
|
|
|
std::vector< std::vector <cvf::Vec3d> > lines;
|
2015-11-18 08:55:05 -06:00
|
|
|
if (type == CS_WELL_PATH)
|
|
|
|
{
|
2017-12-05 07:03:40 -06:00
|
|
|
if (wellPath() && wellPath->wellPathGeometry() )
|
2015-11-18 08:55:05 -06:00
|
|
|
{
|
2015-11-23 07:26:45 -06:00
|
|
|
lines.push_back(wellPath->wellPathGeometry()->m_wellPathPoints);
|
2015-11-27 04:27:06 -06:00
|
|
|
clipToReservoir(lines[0]);
|
2015-11-18 08:55:05 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (type == CS_SIMULATION_WELL)
|
|
|
|
{
|
2015-11-26 04:08:38 -06:00
|
|
|
if (simulationWell())
|
|
|
|
{
|
2015-11-26 06:39:31 -06:00
|
|
|
updateWellCenterline();
|
|
|
|
|
2015-12-01 07:19:49 -06:00
|
|
|
if (0 <= m_branchIndex && m_branchIndex < static_cast<int>(m_wellBranchCenterlines.size()))
|
2015-11-26 06:39:31 -06:00
|
|
|
{
|
2015-11-26 08:59:02 -06:00
|
|
|
lines.push_back(m_wellBranchCenterlines[m_branchIndex]);
|
2015-11-26 06:39:31 -06:00
|
|
|
}
|
|
|
|
|
2015-11-26 08:59:02 -06:00
|
|
|
if (m_branchIndex == -1)
|
2015-11-26 06:39:31 -06:00
|
|
|
{
|
|
|
|
lines = m_wellBranchCenterlines;
|
|
|
|
}
|
2015-11-26 04:08:38 -06:00
|
|
|
}
|
2015-11-18 08:55:05 -06:00
|
|
|
}
|
2015-11-27 10:18:30 -06:00
|
|
|
else if (type == CS_POLYLINE)
|
2015-11-18 08:55:05 -06:00
|
|
|
{
|
2015-11-30 03:00:06 -06:00
|
|
|
lines.push_back(m_userPolyline);
|
2015-11-18 08:55:05 -06:00
|
|
|
}
|
2017-11-21 06:43:22 -06:00
|
|
|
else if (type == CS_AZIMUTHLINE)
|
|
|
|
{
|
|
|
|
lines.push_back(m_twoAzimuthPoints);
|
|
|
|
}
|
2015-11-18 08:55:05 -06:00
|
|
|
|
2015-11-23 07:26:45 -06:00
|
|
|
if (type == CS_WELL_PATH || type == CS_SIMULATION_WELL)
|
|
|
|
{
|
2015-12-01 07:19:49 -06:00
|
|
|
for (size_t lIdx = 0; lIdx < lines.size(); ++lIdx)
|
2015-11-23 07:26:45 -06:00
|
|
|
{
|
2015-11-26 08:59:02 -06:00
|
|
|
std::vector<cvf::Vec3d>& polyLine = lines[lIdx];
|
|
|
|
addExtents(polyLine);
|
2015-11-23 07:26:45 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return lines;
|
2015-11-18 08:55:05 -06:00
|
|
|
}
|
|
|
|
|
2015-11-19 04:41:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-25 03:03:55 -05:00
|
|
|
RivIntersectionPartMgr* RimIntersection::intersectionPartMgr()
|
2015-11-19 04:41:16 -06:00
|
|
|
{
|
2016-09-21 03:32:29 -05:00
|
|
|
if (m_crossSectionPartMgr.isNull()) m_crossSectionPartMgr = new RivIntersectionPartMgr(this);
|
2015-11-19 04:41:16 -06:00
|
|
|
|
|
|
|
return m_crossSectionPartMgr.p();
|
|
|
|
}
|
|
|
|
|
2016-10-18 07:25:31 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLinesForExtrusionDirection() const
|
|
|
|
{
|
|
|
|
std::vector< std::vector <cvf::Vec3d> > lines;
|
|
|
|
|
|
|
|
lines.push_back(m_customExtrusionPoints);
|
|
|
|
|
|
|
|
return lines;
|
|
|
|
}
|
|
|
|
|
2015-11-26 06:39:31 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::updateWellCenterline() const
|
2015-11-26 06:39:31 -06:00
|
|
|
{
|
|
|
|
if (isActive() && type == CS_SIMULATION_WELL && simulationWell())
|
|
|
|
{
|
|
|
|
if (m_wellBranchCenterlines.size() == 0)
|
|
|
|
{
|
2017-12-08 05:22:35 -06:00
|
|
|
RimEclipseCase* rimEclCase = nullptr;
|
|
|
|
simulationWell->firstAncestorOrThisOfType(rimEclCase);
|
|
|
|
if (rimEclCase)
|
|
|
|
{
|
|
|
|
bool includeCellCenters = false;
|
|
|
|
bool detectBrances = true;
|
|
|
|
|
|
|
|
RigEclipseCaseData* caseData = rimEclCase->eclipseCaseData();
|
|
|
|
auto branches = caseData->simulationWellBranches(simulationWell->name, includeCellCenters, detectBrances);
|
2015-11-26 06:39:31 -06:00
|
|
|
|
2017-12-08 05:22:35 -06:00
|
|
|
for (auto b : branches)
|
|
|
|
{
|
|
|
|
m_wellBranchCenterlines.push_back(b->m_wellPathPoints);
|
|
|
|
}
|
|
|
|
}
|
2015-11-26 06:39:31 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_wellBranchCenterlines.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-26 08:59:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::addExtents(std::vector<cvf::Vec3d> &polyLine) const
|
2015-11-26 08:59:02 -06:00
|
|
|
{
|
|
|
|
size_t lineVxCount = polyLine.size();
|
|
|
|
|
|
|
|
if (lineVxCount == 0) return;
|
|
|
|
|
|
|
|
// Add extent at end of well
|
|
|
|
{
|
|
|
|
size_t endIdxOffset = lineVxCount > 3 ? 3: lineVxCount;
|
|
|
|
cvf::Vec3d endDirection = (polyLine[lineVxCount-1] - polyLine[lineVxCount-endIdxOffset]);
|
2017-11-21 06:43:22 -06:00
|
|
|
endDirection[2] = 0; // Remove z. make extent length be horizontally
|
2015-11-26 08:59:02 -06:00
|
|
|
if (endDirection.length() < 1e-2)
|
|
|
|
{
|
|
|
|
endDirection = polyLine.back() - polyLine.front();
|
|
|
|
endDirection[2] = 0;
|
|
|
|
|
|
|
|
if (endDirection.length() < 1e-2)
|
|
|
|
{
|
|
|
|
endDirection = cvf::Vec3d::X_AXIS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
endDirection.normalize();
|
|
|
|
|
|
|
|
cvf::Vec3d newEnd = polyLine.back() + endDirection * m_extentLength();
|
|
|
|
|
|
|
|
polyLine.push_back(newEnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add extent at start
|
|
|
|
{
|
|
|
|
size_t endIdxOffset = lineVxCount > 3 ? 3: lineVxCount-1;
|
|
|
|
cvf::Vec3d startDirection = (polyLine[0] - polyLine[endIdxOffset]);
|
2017-11-14 05:49:05 -06:00
|
|
|
startDirection[2] = 0; // Remove z. make extent length be horizontally
|
2015-11-26 08:59:02 -06:00
|
|
|
if (startDirection.length() < 1e-2)
|
|
|
|
{
|
|
|
|
startDirection = polyLine.front() - polyLine.back();
|
|
|
|
startDirection[2] = 0;
|
|
|
|
|
|
|
|
if (startDirection.length() < 1e-2)
|
|
|
|
{
|
|
|
|
startDirection = -cvf::Vec3d::X_AXIS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
startDirection.normalize();
|
|
|
|
|
|
|
|
cvf::Vec3d newStart = polyLine.front() + startDirection * m_extentLength();
|
|
|
|
|
|
|
|
polyLine.insert(polyLine.begin(), newStart);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-26 09:47:45 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::updateWellExtentDefaultValue()
|
2015-11-26 09:47:45 -06:00
|
|
|
{
|
2017-11-14 05:49:05 -06:00
|
|
|
RimCase* ownerCase = nullptr;
|
2016-09-21 06:59:41 -05:00
|
|
|
firstAncestorOrThisOfType(ownerCase);
|
2015-11-26 09:47:45 -06:00
|
|
|
|
|
|
|
if (ownerCase)
|
|
|
|
{
|
|
|
|
cvf::BoundingBox caseBB = ownerCase->activeCellsBoundingBox();
|
|
|
|
if (m_extentLength == m_extentLength.defaultValue() && caseBB.radius() < 1000)
|
|
|
|
{
|
|
|
|
m_extentLength = caseBB.radius() * 0.1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-27 03:13:29 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::updateName()
|
2015-11-27 03:13:29 -06:00
|
|
|
{
|
|
|
|
if (type == CS_SIMULATION_WELL && simulationWell())
|
|
|
|
{
|
|
|
|
name = simulationWell()->name();
|
|
|
|
if (m_branchIndex() != -1)
|
|
|
|
{
|
|
|
|
name = name() + " Branch " + QString::number(m_branchIndex() + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (type() == CS_WELL_PATH && wellPath())
|
|
|
|
{
|
|
|
|
name = wellPath()->name();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-27 04:27:06 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::clipToReservoir(std::vector<cvf::Vec3d> &polyLine) const
|
2015-11-27 04:27:06 -06:00
|
|
|
{
|
2017-11-14 05:49:05 -06:00
|
|
|
RimCase* ownerCase = nullptr;
|
2016-09-21 06:59:41 -05:00
|
|
|
firstAncestorOrThisOfType(ownerCase);
|
2015-11-27 04:27:06 -06:00
|
|
|
|
|
|
|
std::vector<cvf::Vec3d> clippedPolyLine;
|
|
|
|
|
|
|
|
if (ownerCase)
|
|
|
|
{
|
|
|
|
cvf::BoundingBox caseBB = ownerCase->activeCellsBoundingBox();
|
|
|
|
bool hasEnteredReservoirBB = false;
|
|
|
|
for (size_t vxIdx = 0 ; vxIdx < polyLine.size(); ++vxIdx)
|
|
|
|
{
|
|
|
|
if (!caseBB.contains(polyLine[vxIdx]))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!hasEnteredReservoirBB)
|
|
|
|
{
|
|
|
|
if (vxIdx > 0)
|
|
|
|
{
|
|
|
|
// clip line, and add vx to start
|
|
|
|
cvf::Plane topPlane;
|
|
|
|
topPlane.setFromPointAndNormal(caseBB.max(), cvf::Vec3d::Z_AXIS);
|
|
|
|
cvf::Vec3d intersection;
|
|
|
|
|
|
|
|
if (topPlane.intersect(polyLine[vxIdx-1], polyLine[vxIdx], &intersection))
|
|
|
|
{
|
|
|
|
clippedPolyLine.push_back(intersection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hasEnteredReservoirBB = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
clippedPolyLine.push_back(polyLine[vxIdx]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
polyLine.swap(clippedPolyLine);
|
|
|
|
}
|
|
|
|
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-21 06:43:22 -06:00
|
|
|
void RimIntersection::setPushButtonText(bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute)
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
if (attribute)
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
if (buttonEnable)
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
attribute->m_buttonText = "Stop picking points";
|
2015-11-27 10:18:30 -06:00
|
|
|
}
|
2017-11-21 06:43:22 -06:00
|
|
|
else
|
2016-10-18 04:57:05 -05:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
attribute->m_buttonText = "Start picking points";
|
2016-10-18 04:57:05 -05:00
|
|
|
}
|
|
|
|
}
|
2017-11-21 06:43:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIntersection::setBaseColor(bool enable, caf::PdmUiListEditorAttribute* attribute)
|
|
|
|
{
|
|
|
|
if (attribute && enable)
|
2016-10-18 04:57:05 -05:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
attribute->m_baseColor.setRgb(255, 220, 255);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
|
|
|
{
|
2016-10-18 04:57:05 -05:00
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
caf::PdmUiDoubleSliderEditorAttribute* doubleSliderAttrib = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
|
|
|
if (doubleSliderAttrib)
|
|
|
|
{
|
2017-11-23 03:59:52 -06:00
|
|
|
if (field == &m_azimuthAngle)
|
2016-10-18 04:57:05 -05:00
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
doubleSliderAttrib->m_minimum = 0;
|
|
|
|
doubleSliderAttrib->m_maximum = 360;
|
|
|
|
doubleSliderAttrib->m_sliderTickCount = 360;
|
2016-10-18 04:57:05 -05:00
|
|
|
}
|
2017-11-23 03:59:52 -06:00
|
|
|
else if (field == &m_dipAngle)
|
|
|
|
{
|
|
|
|
doubleSliderAttrib->m_minimum = 0;
|
|
|
|
doubleSliderAttrib->m_maximum = 180;
|
|
|
|
doubleSliderAttrib->m_sliderTickCount = 180;
|
|
|
|
}
|
2016-10-18 04:57:05 -05:00
|
|
|
}
|
2017-11-21 06:43:22 -06:00
|
|
|
else if (field == &inputPolyLineFromViewerEnabled)
|
|
|
|
{
|
|
|
|
setPushButtonText(inputPolyLineFromViewerEnabled, dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute));
|
|
|
|
}
|
|
|
|
else if (field == &m_userPolyline)
|
|
|
|
{
|
|
|
|
setBaseColor(inputPolyLineFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute));
|
|
|
|
}
|
|
|
|
else if (field == &inputTwoAzimuthPointsFromViewerEnabled)
|
|
|
|
{
|
|
|
|
setPushButtonText(inputTwoAzimuthPointsFromViewerEnabled, dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute));
|
|
|
|
}
|
|
|
|
else if (field == &m_twoAzimuthPoints)
|
|
|
|
{
|
|
|
|
setBaseColor(inputTwoAzimuthPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute));
|
|
|
|
}
|
|
|
|
else if (field == &inputExtrusionPointsFromViewerEnabled)
|
|
|
|
{
|
|
|
|
setPushButtonText(inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute));
|
|
|
|
}
|
2016-10-18 04:57:05 -05:00
|
|
|
else if (field == &m_customExtrusionPoints)
|
|
|
|
{
|
2017-11-21 06:43:22 -06:00
|
|
|
setBaseColor(inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute));
|
2015-11-30 08:12:00 -06:00
|
|
|
}
|
2015-11-27 10:18:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::appendPointToPolyLine(const cvf::Vec3d& point)
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2015-11-30 03:00:06 -06:00
|
|
|
m_userPolyline.v().push_back(point);
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2015-11-30 03:00:06 -06:00
|
|
|
m_userPolyline.uiCapability()->updateConnectedEditors();
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
|
|
|
|
2016-10-18 04:57:05 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-18 07:25:31 -05:00
|
|
|
void RimIntersection::appendPointToExtrusionDirection(const cvf::Vec3d& point)
|
2016-10-18 04:57:05 -05:00
|
|
|
{
|
|
|
|
if (m_customExtrusionPoints().size() > 1) m_customExtrusionPoints.v().clear();
|
|
|
|
|
|
|
|
m_customExtrusionPoints.v().push_back(point);
|
|
|
|
|
|
|
|
m_customExtrusionPoints.uiCapability()->updateConnectedEditors();
|
|
|
|
|
2016-11-04 03:25:01 -05:00
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
2016-10-18 04:57:05 -05:00
|
|
|
}
|
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIntersection::appendPointToAzimuthLine(const cvf::Vec3d& point)
|
|
|
|
{
|
|
|
|
if (m_twoAzimuthPoints().empty())
|
|
|
|
{
|
|
|
|
m_twoAzimuthPoints.v().push_back(point);
|
|
|
|
}
|
|
|
|
else if (m_twoAzimuthPoints().size() == 1)
|
|
|
|
{
|
|
|
|
cvf::Vec3d projectedPoint = cvf::Vec3d(point[0], point[1], m_twoAzimuthPoints.v()[0][2]);
|
|
|
|
m_twoAzimuthPoints.v().push_back(projectedPoint);
|
|
|
|
|
|
|
|
m_azimuthAngle = cvf::Math::toDegrees(azimuthInRadians(m_twoAzimuthPoints()[1] - m_twoAzimuthPoints()[0]));
|
2017-11-23 04:08:02 -06:00
|
|
|
m_azimuthAngle.uiCapability()->updateConnectedEditors();
|
2017-11-21 06:43:22 -06:00
|
|
|
}
|
|
|
|
else if (m_twoAzimuthPoints().size() > 1)
|
|
|
|
{
|
|
|
|
m_twoAzimuthPoints.v().clear();
|
|
|
|
m_twoAzimuthPoints.v().push_back(point);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_twoAzimuthPoints.uiCapability()->updateConnectedEditors();
|
|
|
|
|
|
|
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
|
|
|
|
2016-10-18 03:22:20 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::Vec3d RimIntersection::extrusionDirection() const
|
|
|
|
{
|
|
|
|
cvf::Vec3d dir = cvf::Vec3d::Z_AXIS;
|
|
|
|
|
2016-10-20 04:27:07 -05:00
|
|
|
if (direction() == RimIntersection::CS_HORIZONTAL)
|
2016-10-18 03:22:20 -05:00
|
|
|
{
|
2016-10-20 04:27:07 -05:00
|
|
|
std::vector< std::vector <cvf::Vec3d> > lines = this->polyLines();
|
|
|
|
if (lines.size() > 0 && lines[0].size() > 1)
|
|
|
|
{
|
|
|
|
std::vector <cvf::Vec3d> firstLine = lines[0];
|
|
|
|
|
|
|
|
// Use first and last point of polyline to approximate orientation of polyline
|
|
|
|
// Then cross with Z axis to find extrusion direction
|
2016-10-18 03:22:20 -05:00
|
|
|
|
2016-10-20 04:27:07 -05:00
|
|
|
cvf::Vec3d polyLineDir = firstLine[firstLine.size() - 1] - firstLine[0];
|
|
|
|
cvf::Vec3d up = cvf::Vec3d::Z_AXIS;
|
|
|
|
dir = polyLineDir ^ up;
|
|
|
|
}
|
2016-10-18 03:22:20 -05:00
|
|
|
}
|
2016-10-18 04:57:05 -05:00
|
|
|
else if (direction() == RimIntersection::CS_TWO_POINTS && m_customExtrusionPoints().size() > 1)
|
|
|
|
{
|
|
|
|
dir = m_customExtrusionPoints()[m_customExtrusionPoints().size() - 1] - m_customExtrusionPoints()[0];
|
|
|
|
}
|
2017-11-21 06:43:22 -06:00
|
|
|
else if (m_twoAzimuthPoints().size() == 2)
|
2017-11-14 05:49:05 -06:00
|
|
|
{
|
|
|
|
double dipInRad = cvf::Math::toRadians(m_dipAngle);
|
2017-11-21 06:43:22 -06:00
|
|
|
|
|
|
|
cvf::Vec3d azimutDirection = m_twoAzimuthPoints()[1] - m_twoAzimuthPoints()[0];
|
|
|
|
|
|
|
|
cvf::Mat3d rotMat = cvf::Mat3d::fromRotation(azimutDirection, dipInRad);
|
|
|
|
cvf::Vec3d vecPerpToRotVecInHorizontalPlane = azimutDirection ^ cvf::Vec3d::Z_AXIS;
|
2017-11-14 05:49:05 -06:00
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
dir = vecPerpToRotVecInHorizontalPlane.getTransformedVector(rotMat);
|
2017-11-14 05:49:05 -06:00
|
|
|
}
|
2016-10-18 03:22:20 -05:00
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
2017-11-23 08:19:10 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-24 06:57:35 -06:00
|
|
|
double RimIntersection::lengthUp() const
|
2017-11-23 08:19:10 -06:00
|
|
|
{
|
2017-11-24 06:57:35 -06:00
|
|
|
return m_lengthUp;
|
2017-11-23 08:19:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-24 06:57:35 -06:00
|
|
|
double RimIntersection::lengthDown() const
|
2017-11-23 08:19:10 -06:00
|
|
|
{
|
2017-11-24 06:57:35 -06:00
|
|
|
return m_lengthDown;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIntersection::setLengthDown(double lengthDown)
|
|
|
|
{
|
|
|
|
m_lengthDown = lengthDown;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIntersection::setLengthUp(double lengthUp)
|
|
|
|
{
|
|
|
|
m_lengthUp = lengthUp;
|
2017-11-23 08:19:10 -06:00
|
|
|
}
|
|
|
|
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimIntersection::rebuildGeometryAndScheduleCreateDisplayModel()
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2017-11-14 05:49:05 -06:00
|
|
|
m_crossSectionPartMgr = nullptr;
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2017-11-14 05:49:05 -06:00
|
|
|
RimView* rimView = nullptr;
|
2016-09-21 06:59:41 -05:00
|
|
|
this->firstAncestorOrThisOfType(rimView);
|
2015-11-27 10:18:30 -06:00
|
|
|
if (rimView)
|
|
|
|
{
|
|
|
|
rimView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-21 06:43:22 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RimIntersection::azimuthInRadians(cvf::Vec3d vec)
|
|
|
|
{
|
|
|
|
return cvf::GeometryTools::getAngle(-cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS, vec);
|
|
|
|
}
|
|
|
|
|