#include "RicSwapGridCrossPlotCurveSetAxesFeature.h" #include "RimGridCrossPlot.h" #include "RimGridCrossPlotCurveSet.h" #include #include CAF_CMD_SOURCE_INIT(RicSwapGridCrossPlotCurveSetAxesFeature, "RicSwapGridCrossPlotCurveSetAxesFeature"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RicSwapGridCrossPlotCurveSetAxesFeature::isCommandEnabled() { if (caf::SelectionManager::instance()->selectedItemOfType()) { return true; } else if (caf::SelectionManager::instance()->selectedItemOfType()) { auto plot = caf::SelectionManager::instance()->selectedItemOfType(); if (!plot->curveSets().empty()) return true; } return false; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSwapGridCrossPlotCurveSetAxesFeature::onActionTriggered(bool isChecked) { if (caf::SelectionManager::instance()->selectedItemOfType()) { auto curveSet = caf::SelectionManager::instance()->selectedItemOfType(); curveSet->swapAxisProperties(true); } else if (caf::SelectionManager::instance()->selectedItemOfType()) { auto plot = caf::SelectionManager::instance()->selectedItemOfType(); plot->swapAxes(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSwapGridCrossPlotCurveSetAxesFeature::setupActionLook(QAction* actionToSetup) { if (caf::SelectionManager::instance()->selectedItemOfType()) { actionToSetup->setText("Swap Axis Properties"); } else { actionToSetup->setText("Swap Axis Properties for all Data Sets in Plot"); } actionToSetup->setIcon(QIcon(":/Swap.png")); }