#2075 RFT Plot: Add "New RFT plot" command to well path

This commit is contained in:
Rebecca Cox 2017-11-02 10:00:27 +01:00
parent dc93767683
commit e60941aa2c
4 changed files with 28 additions and 111 deletions

View File

@ -1,7 +1,6 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2017 Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -19,27 +18,18 @@
#include "RicNewRftPlotFeature.h" #include "RicNewRftPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RigWellLogCurveData.h" #include "RimMainPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimRftPlotCollection.h"
#include "RimSimWellInView.h" #include "RimSimWellInView.h"
#include "RimView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellRftPlot.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimRftPlotCollection.h" #include "RimWellRftPlot.h"
#include "RimMainPlotCollection.h"
#include "RimEclipseResultCase.h"
#include "RiuMainPlotWindow.h" #include "RiuMainPlotWindow.h"
#include "RiuSelectionManager.h"
#include "cafSelectionManagerTools.h" #include "cafSelectionManagerTools.h"
@ -55,25 +45,15 @@ CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::isCommandEnabled() bool RicNewRftPlotFeature::isCommandEnabled()
{ {
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false; RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>();
if (simWell) return true;
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* rimWellPath = simWell == nullptr ? caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>() : nullptr;
bool enable = true; if (selectedWellName().isEmpty())
if (simWell != nullptr)
{ {
RimEclipseResultCase* eclCase = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseResultCase*>(); return false;
if (simWell != nullptr)
{
enable &= RimWellRftPlot::hasPressureData(eclCase);
}
} }
else if (rimWellPath)
{ return true;
enable &= RimWellRftPlot::hasPressureData(rimWellPath);
}
return enable;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -81,24 +61,12 @@ bool RicNewRftPlotFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::onActionTriggered(bool isChecked) void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
{ {
//if (RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()) return;
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection(); RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if (rftPlotColl) if (rftPlotColl)
{ {
QString wellName; QString wellName = selectedWellName();
RimWellPath* wellPath = nullptr;
RimSimWellInView* eclipseWell = nullptr;
if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr)
{
wellName = wellPath->name();
}
else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr)
{
wellName = eclipseWell->name();
}
QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName); QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName);
@ -137,50 +105,13 @@ void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewRftPlotFeature::selectedWellLogPlotTrack() const QString RicNewRftPlotFeature::selectedWellName()
{ {
auto selection = caf::selectedObjectsByType<RimWellLogTrack*>(); RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
return selection.size() > 0 ? selection[0] : nullptr; if (simWell) return simWell->name();
RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
if (rimWellPath) return rimWellPath->name();
return QString();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewRftPlotFeature::selectedWellPath() const
{
auto selection = caf::selectedObjectsByType<RimWellPath*>();
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSimWellInView* RicNewRftPlotFeature::selectedSimulationWell(int * branchIndex) const
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::caseAvailable() const
{
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
return cases.size() > 0;
}

View File

@ -1,7 +1,6 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2017 Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -21,32 +20,18 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
class RimSimWellInView;
class RimView;
class RimWellLogExtractionCurve;
class RimWellLogTrack;
class RimWellPath;
class RimRftPlotCollection;
class RimWellRftPlot;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicNewRftPlotFeature : public caf::CmdFeature class RicNewRftPlotFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private: private:
RimWellLogTrack* selectedWellLogPlotTrack() const; virtual bool isCommandEnabled() override;
RimWellPath* selectedWellPath() const; virtual void onActionTriggered( bool isChecked ) override;
RimSimWellInView* selectedSimulationWell(int * branchIndex) const; virtual void setupActionLook( QAction* actionToSetup ) override;
bool caseAvailable() const;
static QString selectedWellName();
}; };

View File

@ -234,6 +234,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicNewWellLogFileCurveFeature"; commandIds << "RicNewWellLogFileCurveFeature";
commandIds << "RicNewWellLogCurveExtractionFeature"; commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewWellPathIntersectionFeature"; commandIds << "RicNewWellPathIntersectionFeature";
commandIds << "RicNewRftPlotFeature";
} }
else if (dynamic_cast<RimWellLogFile*>(uiItem)) else if (dynamic_cast<RimWellLogFile*>(uiItem))
{ {
@ -504,7 +505,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicDeleteSummaryCaseCollectionFeature"; commandIds << "RicDeleteSummaryCaseCollectionFeature";
commandIds << "RicCloseObservedDataFeature"; commandIds << "RicCloseObservedDataFeature";
// Fracture commands // Fracture commands
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES #ifdef USE_PROTOTYPE_FEATURE_FRACTURES
commandIds << "RicNewWellPathFractureFeature"; commandIds << "RicNewWellPathFractureFeature";

View File

@ -306,6 +306,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
commandIds << "RicNewWellLogCurveExtractionFeature"; commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewWellLogFileCurveFeature"; commandIds << "RicNewWellLogFileCurveFeature";
commandIds << "RicNewRftPlotFeature";
commandIds << "Separator"; commandIds << "Separator";
commandIds << "RicNewWellPathIntersectionFeature"; commandIds << "RicNewWellPathIntersectionFeature";
commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature"; commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature";