diff --git a/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake index 4786535608..842d71a480 100644 --- a/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake @@ -11,6 +11,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellPathAttributeFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsImpl.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsUi.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathPickEventHandler.h +${CMAKE_CURRENT_LIST_DIR}/RicCreateWellTargetsPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicIntersectionPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathFormationsImportFileFeature.h ${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h @@ -28,6 +29,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellPathAttributeFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsImpl.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathsUnitSystemSettingsUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathPickEventHandler.cpp +${CMAKE_CURRENT_LIST_DIR}/RicCreateWellTargetsPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicIntersectionPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathFormationsImportFileFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.cpp diff --git a/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp b/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp index 9a4e8facba..0fc70a68bf 100644 --- a/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp +++ b/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp @@ -818,7 +818,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi(const QString& uiConfigName) handleSize = 0.7 * view->ownerCase()->characteristicCellSize(); } - m_manipulator->setOrigin(dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePoint())); + m_manipulator->setOrigin(dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePointXyz())); m_manipulator->setTangent(target->tangent()); m_manipulator->setHandleSize(handleSize); m_cvfModel->removeAllParts(); @@ -863,7 +863,7 @@ void RicWellTarget3dEditor::slotUpdated(const cvf::Vec3d& origin, const cvf::Vec RimWellPathGeometryDef* geomDef; target->firstAncestorOrThisOfTypeAsserted(geomDef); - cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin) - geomDef->referencePoint(); + cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin) - geomDef->referencePointXyz(); domainOrigin.z() = -domainOrigin.z(); QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainOrigin); diff --git a/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp new file mode 100644 index 0000000000..09bd52a9c2 --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicCreateWellTargetsPickEventHandler.h" +#include "Rim3dView.h" +#include "RimWellPathGeometryDef.h" +#include "RimWellPathTarget.h" + +#include "cafSelectionManager.h" +#include "cafDisplayCoordTransform.h" + +#include +#include "RiuViewerCommands.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler(RimWellPathGeometryDef* wellGeometryDef) + : m_geometryToAddTargetsTo(wellGeometryDef) +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicCreateWellTargetsPickEventHandler::~RicCreateWellTargetsPickEventHandler() +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent& eventObject) +{ + if (!caf::SelectionManager::instance()->isSelected(m_geometryToAddTargetsTo.p(), 0)) + { + m_geometryToAddTargetsTo->enableTargetPointPicking(false); + + return false; + } + + if ( m_geometryToAddTargetsTo ) + { + Rim3dView* rimView = eventObject.m_view; + + cvf::ref transForm = rimView->displayCoordTransform(); + cvf::Vec3d domainCoord = transForm->transformToDomainCoord(eventObject.m_pickItemInfos.front().globalPickedPoint()); + if (!m_geometryToAddTargetsTo->firstActiveTarget()) + { + m_geometryToAddTargetsTo->setReferencePoint(domainCoord); + } + cvf::Vec3d referencePoint = m_geometryToAddTargetsTo->referencePointXyz(); + cvf::Vec3d relativeTagetPoint = domainCoord - referencePoint; + RimWellPathTarget* newTarget = new RimWellPathTarget; + newTarget->setAsPointTargetXYD(cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), -relativeTagetPoint.z())); + + m_geometryToAddTargetsTo->insertTarget(nullptr, newTarget); + + m_geometryToAddTargetsTo->updateConnectedEditors(); + m_geometryToAddTargetsTo->updateWellPathVisualization(); + + return true; // Todo: See if we really should eat the event instead + } + + return false; +} diff --git a/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h new file mode 100644 index 0000000000..10e2decc07 --- /dev/null +++ b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil ASA +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicPickEventHandler.h" + +#include "cafPdmPointer.h" + +class RimWellPathGeometryDef; + +//================================================================================================== +/// +//================================================================================================== +class RicCreateWellTargetsPickEventHandler : public RicPickEventHandler +{ +public: + RicCreateWellTargetsPickEventHandler(RimWellPathGeometryDef* wellGeometryDef); + ~RicCreateWellTargetsPickEventHandler(); + +protected: + caf::PdmPointer m_geometryToAddTargetsTo; + + virtual bool handlePickEvent(const Ric3DPickEvent& eventObject) override; +}; + diff --git a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp index 35e83b6f2f..8306b7847e 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp @@ -18,8 +18,8 @@ #include "RicDeleteWellPathAttributeFeature.h" #include "RimWellPathAttributeCollection.h" -#include "RimWellPathTarget.h" -#include "RimModeledWellPath.h" +#include "RimWellPath.h" + #include "cafSelectionManager.h" #include @@ -72,5 +72,3 @@ void RicDeleteWellPathAttributeFeature::setupActionLook(QAction* actionToSetup) actionToSetup->setText("Delete Attribute"); actionToSetup->setIcon(QIcon(":/Erase.png")); } - - diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp index 33a930b9cb..feed59ce5e 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.cpp @@ -27,6 +27,8 @@ CAF_CMD_SOURCE_INIT(RicNewEditableWellPathFeature, "RicNewEditableWellPathFeatur #include "RimModeledWellPath.h" #include #include "RimOilField.h" +#include "Riu3DMainWindowTools.h" +#include "RimWellPathGeometryDef.h" //-------------------------------------------------------------------------------------------------- /// @@ -74,7 +76,14 @@ void RicNewEditableWellPathFeature::onActionTriggered(bool isChecked) newWellPaths.back()->setName("UWell-" + QString::number(wellPathCollection->modelledWellPathCount()+1)); wellPathCollection->addWellPaths(newWellPaths); wellPathCollection->uiCapability()->updateConnectedEditors(); - wellPathCollection->scheduleRedrawAffectedViews(); + + newModeledWellPath->geometryDefinition()->enableTargetPointPicking(true); + + RimProject* project; + wellPathCollection->firstAncestorOrThisOfTypeAsserted(project); + project->createDisplayModelAndRedrawAllViews(); + + Riu3DMainWindowTools::selectAsCurrentItem(newModeledWellPath->geometryDefinition()); } } } diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp index d9edec721a..acbeac0129 100644 --- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp @@ -71,6 +71,14 @@ void RimModeledWellPath::updateWellPathVisualization() proj->createDisplayModelAndRedrawAllViews(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellPathGeometryDef* RimModeledWellPath::geometryDefinition() +{ + return m_geometryDefinition; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h index e0c2b77d40..4f0b4f181c 100644 --- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h @@ -19,11 +19,7 @@ #include "RimWellPath.h" -#include "cafPdmFieldCvfVec3d.h" -#include "cafPdmObject.h" -#include "cafPdmField.h" -#include "cafAppEnum.h" -#include "cafPdmPtrField.h" +#include "cafPdmChildField.h" class RimWellPathTarget; class RimWellPath; @@ -37,15 +33,14 @@ public: RimModeledWellPath(); ~RimModeledWellPath(); - void createWellPathGeometry(); - void updateWellPathVisualization(); + void createWellPathGeometry(); + void updateWellPathVisualization(); + RimWellPathGeometryDef* geometryDefinition(); private: - + virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; caf::PdmChildField m_geometryDefinition; - virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; - }; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp b/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp index 671cc869f8..b0a826aa6a 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp @@ -28,6 +28,10 @@ #include "RiaSCurveCalculator.h" #include "RiaLogging.h" #include "RiaJCurveCalculator.h" +#include "cafPdmUiPushButtonEditor.h" + +#include "WellPathCommands/RicCreateWellTargetsPickEventHandler.h" +#include "RiuViewerCommands.h" namespace caf { @@ -49,11 +53,12 @@ CAF_PDM_SOURCE_INIT(RimWellPathGeometryDef, "WellPathGeometryDef"); /// //-------------------------------------------------------------------------------------------------- RimWellPathGeometryDef::RimWellPathGeometryDef() + : m_pickTargetsEventHandler(new RicCreateWellTargetsPickEventHandler(this)) { CAF_PDM_InitObject("Trajectory", ":/Well.png", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellStartType, "WellStartType", "Start Type", "", "", ""); - CAF_PDM_InitField(&m_referencePoint, "ReferencePos", cvf::Vec3d(0,0,0), "UTM Reference Point", "", "", ""); + CAF_PDM_InitField(&m_referencePointXyz, "ReferencePos", cvf::Vec3d(0,0,0), "UTM Reference Point", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_parentWell, "ParentWell", "Parent Well", "", "", ""); CAF_PDM_InitField(&m_kickoffDepthOrMD, "KickoffDepthOrMD", 100.0, "Kickoff Depth", "", "", ""); @@ -65,8 +70,8 @@ RimWellPathGeometryDef::RimWellPathGeometryDef() m_wellTargets.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_wellTargets.uiCapability()->setCustomContextMenuEnabled(true); - - m_wellTargets.push_back(new RimWellPathTarget()); + CAF_PDM_InitField(&m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", ""); + caf::PdmUiPushButtonEditor::configureEditorForField(&m_pickPointsEnabled); } //-------------------------------------------------------------------------------------------------- @@ -74,7 +79,11 @@ RimWellPathGeometryDef::RimWellPathGeometryDef() //-------------------------------------------------------------------------------------------------- RimWellPathGeometryDef::~RimWellPathGeometryDef() { + RiuViewerCommands::removePickEventHandler(m_pickTargetsEventHandler); + delete m_pickTargetsEventHandler; + + m_pickTargetsEventHandler = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -109,7 +118,7 @@ void RimWellPathGeometryDef::updateWellPathVisualization() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathGeometryDef::insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert) +void RimWellPathGeometryDef::insertTarget(const RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert) { size_t index = m_wellTargets.index(targetToInsertBefore); if (index < m_wellTargets.size()) m_wellTargets.insert(index, targetToInsert); @@ -180,6 +189,25 @@ const RimWellPathTarget* RimWellPathGeometryDef::lastActiveTarget() const return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::enableTargetPointPicking(bool isEnabling) +{ + if (isEnabling) + { + m_pickPointsEnabled = true; + RiuViewerCommands::addPickEventHandler(m_pickTargetsEventHandler); + updateConnectedEditors(); + } + else + { + RiuViewerCommands::removePickEventHandler(m_pickTargetsEventHandler); + m_pickPointsEnabled = false; + updateConnectedEditors(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -203,10 +231,14 @@ void RimWellPathGeometryDef::fieldChangedByUi(const caf::PdmFieldHandle* changed const QVariant& oldValue, const QVariant& newValue) { - if (&m_referencePoint == changedField) + if (&m_referencePointXyz == changedField) { std::cout << "fieldChanged" << std::endl; } + else if (changedField == &m_pickPointsEnabled) + { + enableTargetPointPicking(m_pickPointsEnabled); + } updateWellPathVisualization(); } @@ -230,8 +262,9 @@ void RimWellPathGeometryDef::defineUiOrdering(QString uiConfigName, caf::PdmUiOr uiOrdering.add(&m_kickoffDepthOrMD); } - uiOrdering.add(&m_referencePoint); + uiOrdering.add(&m_referencePointXyz); uiOrdering.add(&m_wellTargets); + uiOrdering.add(&m_pickPointsEnabled); uiOrdering.skipRemainingFields(true); } @@ -273,7 +306,7 @@ std::vector RimWellPathGeometryDef::lineArcEndpoints() const CVF_ASSERT(activeWellPathTargets.size() > 1); std::vector endPoints; - endPoints.push_back( activeWellPathTargets[0]->targetPointXYZ() + m_referencePoint() ); + endPoints.push_back( activeWellPathTargets[0]->targetPointXYZ() + m_referencePointXyz() ); for ( size_t tIdx = 0; tIdx < activeWellPathTargets.size() - 1; ++tIdx) { @@ -307,9 +340,9 @@ std::vector RimWellPathGeometryDef::lineArcEndpoints() const RiaLogging::warning("Using fall-back calculation of well path geometry between active target number: " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2)); } - endPoints.push_back( sCurveCalc.firstArcEndpoint() + m_referencePoint() ); - endPoints.push_back( sCurveCalc.secondArcStartpoint() + m_referencePoint() ); - endPoints.push_back( target2->targetPointXYZ() + m_referencePoint() ); + endPoints.push_back( sCurveCalc.firstArcEndpoint() + m_referencePointXyz() ); + endPoints.push_back( sCurveCalc.secondArcStartpoint() + m_referencePointXyz() ); + endPoints.push_back( target2->targetPointXYZ() + m_referencePointXyz() ); } else if ( target1->targetType() == RimWellPathTarget::POINT @@ -339,9 +372,9 @@ std::vector RimWellPathGeometryDef::lineArcEndpoints() const RiaLogging::warning("Using fall-back calculation of well path geometry between active target number: " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2)); } - endPoints.push_back( sCurveCalc.firstArcEndpoint() + m_referencePoint() ); - endPoints.push_back( sCurveCalc.secondArcStartpoint() + m_referencePoint() ); - endPoints.push_back( target2->targetPointXYZ() + m_referencePoint() ); + endPoints.push_back( sCurveCalc.firstArcEndpoint() + m_referencePointXyz() ); + endPoints.push_back( sCurveCalc.secondArcStartpoint() + m_referencePointXyz() ); + endPoints.push_back( target2->targetPointXYZ() + m_referencePointXyz() ); } else if ( target1->targetType() == RimWellPathTarget::POINT_AND_TANGENT && target2->targetType() == RimWellPathTarget::POINT) @@ -353,9 +386,9 @@ std::vector RimWellPathGeometryDef::lineArcEndpoints() const target2->targetPointXYZ()); if ( jCurve.isOk() ) { - endPoints.push_back(jCurve.firstArcEndpoint() + m_referencePoint()); + endPoints.push_back(jCurve.firstArcEndpoint() + m_referencePointXyz()); } - endPoints.push_back( target2->targetPointXYZ() + m_referencePoint() ); + endPoints.push_back( target2->targetPointXYZ() + m_referencePointXyz() ); prevSegmentEndAzi = jCurve.endAzimuth(); prevSegmentEndInc = jCurve.endInclination(); @@ -371,9 +404,9 @@ std::vector RimWellPathGeometryDef::lineArcEndpoints() const target2->targetPointXYZ()); if ( jCurve.isOk() ) { - endPoints.push_back(jCurve.firstArcEndpoint() + m_referencePoint()); + endPoints.push_back(jCurve.firstArcEndpoint() + m_referencePointXyz()); } - endPoints.push_back( target2->targetPointXYZ() + m_referencePoint() ); + endPoints.push_back( target2->targetPointXYZ() + m_referencePointXyz() ); prevSegmentEndAzi = jCurve.endAzimuth(); prevSegmentEndInc = jCurve.endInclination(); } @@ -418,3 +451,34 @@ void RimWellPathGeometryDef::defineCustomContextMenu(const caf::PdmFieldHandle* menuBuilder.appendToMenu(menu); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathGeometryDef::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) +{ + if (field == &m_pickPointsEnabled) + { + caf::PdmUiPushButtonEditorAttribute* pbAttribute = dynamic_cast(attribute); + if ( pbAttribute ) + { + if ( !m_pickPointsEnabled ) + { + pbAttribute->m_buttonText = "Start Picking Targets"; + } + else + { + pbAttribute->m_buttonText = "Stop Picking Targets"; + } + } + } + + if (field == &m_wellTargets) + { + auto tvAttribute = dynamic_cast(attribute); + if (tvAttribute && m_pickPointsEnabled) + { + tvAttribute->baseColor.setRgb(255, 220, 255); + } + } +} diff --git a/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.h b/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.h index 3c85c67250..7808d01c4b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.h @@ -26,8 +26,10 @@ #include "cafPdmPtrField.h" #include "cafPdmChildArrayField.h" + class RimWellPath; class RimWellPathTarget; +class RicCreateWellTargetsPickEventHandler; class RigWellPath; @@ -41,40 +43,56 @@ public: enum WellStartType { START_AT_FIRST_TARGET, START_AT_SURFACE, START_FROM_OTHER_WELL, START_AT_AUTO_SURFACE }; - cvf::Vec3d referencePoint() { return m_referencePoint;} - cvf::ref createWellPathGeometry(); + cvf::Vec3d referencePointXyz() { return m_referencePointXyz;} + void setReferencePoint(const cvf::Vec3d& refPointXyz ) {m_referencePointXyz = refPointXyz;} + + cvf::ref createWellPathGeometry(); - void updateWellPathVisualization(); + void updateWellPathVisualization(); - void insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert); - void deleteTarget(RimWellPathTarget* targetTodelete); - void appendTarget(); + void insertTarget(const RimWellPathTarget* targetToInsertBefore, + RimWellPathTarget* targetToInsert); + void deleteTarget(RimWellPathTarget* targetTodelete); + void appendTarget(); - const RimWellPathTarget* firstActiveTarget() const; - const RimWellPathTarget* lastActiveTarget() const; + const RimWellPathTarget* firstActiveTarget() const; + const RimWellPathTarget* lastActiveTarget() const; - virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; + void enableTargetPointPicking(bool isEnabling); std::vector activeWellTargets() const; protected: - virtual void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, - QMenu* menu, - QWidget* fieldEditorWidget) override; - -private: - virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; + void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, + QMenu* menu, + QWidget* fieldEditorWidget) override; + + + void defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) override; + +private: + void fieldChangedByUi(const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue) override; + void defineUiOrdering(QString uiConfigName, + caf::PdmUiOrdering& uiOrdering) override; + void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, + QString uiConfigName) override; + QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; std::vector lineArcEndpoints() const; cvf::Vec3d startTangent() const; private: caf::PdmField > m_wellStartType; - caf::PdmField m_referencePoint; + caf::PdmField m_referencePointXyz; caf::PdmField m_kickoffDepthOrMD; caf::PdmPtrField m_parentWell; + caf::PdmField< bool > m_pickPointsEnabled; + caf::PdmChildArrayField m_wellTargets; + RicCreateWellTargetsPickEventHandler* m_pickTargetsEventHandler; };