#2049 Curve calc. Add curve calc command to more objects and toolbar

This commit is contained in:
Bjørn Erik Jensen
2017-11-01 15:01:37 +01:00
parent 257a5c18d2
commit 62b96a5ae5
4 changed files with 7 additions and 22 deletions

View File

@@ -24,6 +24,7 @@
#include "cafPdmObject.h"
#include "cafSelectionManager.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
@@ -35,9 +36,7 @@ CAF_CMD_SOURCE_INIT(RicShowSummaryCurveCalculatorFeature, "RicShowSummaryCurveCa
//--------------------------------------------------------------------------------------------------
bool RicShowSummaryCurveCalculatorFeature::isCommandEnabled()
{
if (selectedSummaryPlot()) return true;
return false;
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -57,19 +56,3 @@ void RicShowSummaryCurveCalculatorFeature::setupActionLook(QAction* actionToSetu
actionToSetup->setText("Curve Calculator");
actionToSetup->setIcon(QIcon(":/SummaryPlot16x16.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlot* RicShowSummaryCurveCalculatorFeature::selectedSummaryPlot() const
{
RimSummaryPlot* sumPlot = nullptr;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
if (selObj)
{
selObj->firstAncestorOrThisOfType(sumPlot);
}
return sumPlot;
}

View File

@@ -21,6 +21,8 @@
#include "cafCmdFeature.h"
class RimSummaryPlot;
class RimSummaryPlotCollection;
class RimSummaryCase;
//==================================================================================================
///
@@ -33,7 +35,4 @@ protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
RimSummaryPlot* selectedSummaryPlot() const;
};

View File

@@ -285,6 +285,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicPasteSummaryPlotFeature";
commandIds << "RicPasteAsciiDataToSummaryPlotFeature";
commandIds << "Separator";
commandIds << "RicShowSummaryCurveCalculatorFeature";
commandIds << "RicNewSummaryPlotFeature";
}
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
@@ -353,6 +354,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
if (!dynamic_cast<RimObservedData*>(uiItem))
{
commandIds << "RicShowSummaryCurveCalculatorFeature";
commandIds << "RicNewSummaryPlotFeature";
}
}

View File

@@ -267,6 +267,7 @@ QStringList RiuMainPlotWindow::toolbarCommandIds(const QString& toolbarName)
{
commandIds << "RicShowMainWindowFeature";
commandIds << "RicTilePlotWindowsFeature";
commandIds << "RicShowSummaryCurveCalculatorFeature";
}
if (toolbarName.isEmpty() || toolbarName == "View Snapshots")