From ff1f7b24b59694ee5f45dd2fa40cbe46269bb023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Hagen?= Date: Tue, 22 Sep 2015 13:14:08 +0200 Subject: [PATCH] (#468) Showing well log plot context menu items only when a well path is picked --- .../UserInterface/RiuViewerCommands.cpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index fc59a89e49..03e85323de 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -204,16 +204,25 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event) } // Well log curve creation commands + if (firstHitPart && firstHitPart->sourceInfo()) { - RicNewWellLogFileCurveFeature* newWellLogFileCurveFeature = dynamic_cast(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogFileCurveFeature")); - CVF_ASSERT(newWellLogFileCurveFeature); - - menu.addAction(newWellLogFileCurveFeature->action()); + const RivWellPathSourceInfo* wellPathSourceInfo = dynamic_cast(firstHitPart->sourceInfo()); + if (wellPathSourceInfo) + { + RimWellPath* wellPath = wellPathSourceInfo->wellPath(); + if (wellPath) + { + RicNewWellLogFileCurveFeature* newWellLogFileCurveFeature = dynamic_cast(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogFileCurveFeature")); + CVF_ASSERT(newWellLogFileCurveFeature); - RicNewWellLogCurveExtractionFeature* newExtractionCurveFeature = dynamic_cast(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogCurveExtractionFeature")); - CVF_ASSERT(newExtractionCurveFeature); + menu.addAction(newWellLogFileCurveFeature->action()); - menu.addAction(newExtractionCurveFeature->action()); + RicNewWellLogCurveExtractionFeature* newExtractionCurveFeature = dynamic_cast(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogCurveExtractionFeature")); + CVF_ASSERT(newExtractionCurveFeature); + + menu.addAction(newExtractionCurveFeature->action()); + } + } } // View Link commands