mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2089 Cross Plot : Make sure context menu items works as expected
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RicSummaryCurveCreator.h"
|
||||
#include "RicSummaryCurveCreatorDialog.h"
|
||||
@@ -122,7 +123,7 @@ RimSummaryPlot* RicEditSummaryPlotFeature::selectedSummaryPlot() const
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (selObj)
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType(sumPlot);
|
||||
sumPlot = RiaSummaryTools::parentSummaryPlot(selObj);
|
||||
}
|
||||
|
||||
return sumPlot;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RicNewSummaryCrossPlotCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryCrossPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
@@ -45,7 +46,7 @@ CAF_CMD_SOURCE_INIT(RicNewSummaryCrossPlotCurveFeature, "RicNewSummaryCrossPlotC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryCrossPlotCurveFeature::isCommandEnabled()
|
||||
{
|
||||
return (selectedSummaryPlot());
|
||||
return (selectedCrossPlot());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -55,7 +56,7 @@ void RicNewSummaryCrossPlotCurveFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||
RimSummaryCrossPlot* plot = selectedCrossPlot();
|
||||
if (plot)
|
||||
{
|
||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
@@ -91,19 +92,15 @@ void RicNewSummaryCrossPlotCurveFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewSummaryCrossPlotCurveFeature::selectedSummaryPlot() const
|
||||
RimSummaryCrossPlot* RicNewSummaryCrossPlotCurveFeature::selectedCrossPlot() const
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (selObj)
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType(sumPlot);
|
||||
crossPlot = RiaSummaryTools::parentCrossPlot(selObj);
|
||||
}
|
||||
|
||||
RimSummaryCrossPlotCollection* crossPlotColl = nullptr;
|
||||
sumPlot->firstAncestorOrThisOfType(crossPlotColl);
|
||||
if (!crossPlotColl) return nullptr;
|
||||
|
||||
return sumPlot;
|
||||
return crossPlot;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryCrossPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -36,5 +36,5 @@ protected:
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimSummaryPlot* selectedSummaryPlot() const;
|
||||
RimSummaryCrossPlot* selectedCrossPlot() const;
|
||||
};
|
||||
|
||||
@@ -103,7 +103,7 @@ RimSummaryPlot* RicNewSummaryCurveFeature::selectedSummaryPlot() const
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (selObj)
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType(sumPlot);
|
||||
sumPlot = RiaSummaryTools::parentSummaryPlot(selObj);
|
||||
}
|
||||
|
||||
return sumPlot;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RicEditSummaryPlotFeature.h"
|
||||
#include "RicSummaryCurveCreator.h"
|
||||
@@ -32,6 +33,7 @@
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@@ -43,7 +45,17 @@ CAF_CMD_SOURCE_INIT(RicNewSummaryPlotFeature, "RicNewSummaryPlotFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryPlotFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
RimSummaryPlotCollection* sumPlotColl = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (selObj)
|
||||
{
|
||||
sumPlotColl = RiaSummaryTools::parentSummaryPlotCollection(selObj);
|
||||
}
|
||||
|
||||
if (sumPlotColl) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user