#include "RicSwapGridCrossPlotDataSetAxesFeature.h" #include "RimGridCrossPlot.h" #include "RimGridCrossPlotDataSet.h" #include #include CAF_CMD_SOURCE_INIT(RicSwapGridCrossPlotDataSetAxesFeature, "RicSwapGridCrossPlotDataSetAxesFeature"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RicSwapGridCrossPlotDataSetAxesFeature::isCommandEnabled() { if (caf::SelectionManager::instance()->selectedItemOfType()) { return true; } else if (caf::SelectionManager::instance()->selectedItemOfType()) { auto plot = caf::SelectionManager::instance()->selectedItemOfType(); if (!plot->dataSets().empty()) return true; } return false; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSwapGridCrossPlotDataSetAxesFeature::onActionTriggered(bool isChecked) { if (caf::SelectionManager::instance()->selectedItemOfType()) { auto dataSet = caf::SelectionManager::instance()->selectedItemOfType(); dataSet->swapAxisProperties(true); } else if (caf::SelectionManager::instance()->selectedItemOfType()) { auto plot = caf::SelectionManager::instance()->selectedItemOfType(); plot->swapAxes(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSwapGridCrossPlotDataSetAxesFeature::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")); }