diff --git a/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp index 34aeda8b71..3991a63df3 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.cpp @@ -108,7 +108,7 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent& doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination); } - else + else if (isGridSourceObject(firstPickItem.sourceInfo())) { targetPointInDomain = intersectionPointInDomain; doSetAzimuthAndInclination = false; @@ -118,6 +118,7 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent& cvf::Vec3d domainRayEnd = targetPointInDomain + (targetPointInDomain - domainRayOrigin); cvf::Vec3d hexElementIntersection = findHexElementIntersection(rimView, firstPickItem, domainRayOrigin, domainRayEnd); + CVF_TIGHT_ASSERT(!hexElementIntersection.isUndefined()); if (!hexElementIntersection.isUndefined()) { targetPointInDomain = hexElementIntersection; @@ -221,6 +222,16 @@ bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd(do return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicCreateWellTargetsPickEventHandler::isGridSourceObject(const cvf::Object* object) +{ + auto sourceInfo = dynamic_cast(object); + auto femSourceInfo = dynamic_cast(object); + return sourceInfo || femSourceInfo; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -285,7 +296,7 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection(Rim3 return (lhs.m_intersectionPoint - domainRayOrigin).lengthSquared() < (rhs.m_intersectionPoint - domainRayOrigin).lengthSquared(); } ); - const double eps = 1.0e-3; + const double eps = 1.0e-2; cvf::Vec3d intersectionRay = intersectionInfo.back().m_intersectionPoint - intersectionInfo.front().m_intersectionPoint; cvf::Vec3d newPoint = intersectionInfo.front().m_intersectionPoint + intersectionRay * eps; CVF_ASSERT(RigHexIntersectionTools::isPointInCell(newPoint, cornerVertices.data())); diff --git a/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h index 789c454528..77e39aed04 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h +++ b/ApplicationCode/Commands/WellPathCommands/RicCreateWellTargetsPickEventHandler.h @@ -44,6 +44,7 @@ private: double* azimuth, double* inclination) const; + static bool isGridSourceObject(const cvf::Object* object); static cvf::Vec3d findHexElementIntersection(Rim3dView* view, const RiuPickItemInfo& pickItem, const cvf::Vec3d& domainRayOrigin, const cvf::Vec3d& domainRayEnd); private: caf::PdmPointer m_geometryToAddTargetsTo;