From 440b10e381f3428c7692e32e54b50083896c9d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Tue, 14 Nov 2017 11:37:03 +0100 Subject: [PATCH] #2138 PLT Plot. Add context command to tree view and 3D objects --- .../WellLogCommands/RicNewPltPlotFeature.cpp | 15 +++++---------- .../ProjectDataModel/RimContextCommandBuilder.cpp | 1 - .../UserInterface/RiuViewerCommands.cpp | 1 + 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp index 3ac8b5d5c6..aa9d989198 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp @@ -58,20 +58,15 @@ bool RicNewPltPlotFeature::isCommandEnabled() if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false; RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject(); - RimWellPath* rimWellPath = simWell == nullptr ? caf::firstAncestorOfTypeFromSelectedObject() : nullptr; bool enable = true; if (simWell != nullptr) { - RimEclipseResultCase* eclCase = caf::firstAncestorOfTypeFromSelectedObject(); - if (simWell != nullptr) - { - enable &= RimWellPlotTools::hasFlowData(eclCase); - } - } - else if (rimWellPath) - { - enable &= RimWellPlotTools::hasFlowData(rimWellPath); + RimProject* proj = RiaApplication::instance()->project(); + QString simWellName = simWell->name(); + + RimWellPath* wellPath = proj->wellPathFromSimulationWell(simWellName); + enable = wellPath != nullptr; } return enable; } diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 40366fd8b9..4ab5faf5a6 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -235,7 +235,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection() commandIds << "RicNewWellLogFileCurveFeature"; commandIds << "RicNewWellLogCurveExtractionFeature"; commandIds << "RicNewWellPathIntersectionFeature"; - commandIds << "RicNewRftPlotFeature"; } else if (dynamic_cast(uiItem)) { diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index d1967dbace..1e393ceaa0 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -307,6 +307,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event) commandIds << "RicNewWellLogCurveExtractionFeature"; commandIds << "RicNewWellLogFileCurveFeature"; commandIds << "RicNewRftPlotFeature"; + commandIds << "RicNewPltPlotFeature"; commandIds << "Separator"; commandIds << "RicNewWellPathIntersectionFeature"; commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature";