2019-03-29 07:17:39 -05:00
|
|
|
#include "RicSwapGridCrossPlotDataSetAxesFeature.h"
|
2019-03-08 02:59:29 -06:00
|
|
|
|
|
|
|
#include "RimGridCrossPlot.h"
|
2019-03-29 07:17:39 -05:00
|
|
|
#include "RimGridCrossPlotDataSet.h"
|
2019-03-08 02:59:29 -06:00
|
|
|
|
|
|
|
#include <cafSelectionManager.h>
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicSwapGridCrossPlotDataSetAxesFeature, "RicSwapGridCrossPlotDataSetAxesFeature" );
|
2019-03-08 02:59:29 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-03-29 07:17:39 -05:00
|
|
|
bool RicSwapGridCrossPlotDataSetAxesFeature::isCommandEnabled()
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>() )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>() )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
|
|
|
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !plot->dataSets().empty() ) return true;
|
2019-03-08 02:59:29 -06:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicSwapGridCrossPlotDataSetAxesFeature::onActionTriggered( bool isChecked )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>() )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
2019-03-29 07:17:39 -05:00
|
|
|
auto dataSet = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>();
|
2019-09-06 03:40:57 -05:00
|
|
|
dataSet->swapAxisProperties( true );
|
2019-03-08 02:59:29 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>() )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
|
|
|
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
2019-03-13 02:38:18 -05:00
|
|
|
plot->swapAxes();
|
2019-03-08 02:59:29 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicSwapGridCrossPlotDataSetAxesFeature::setupActionLook( QAction* actionToSetup )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>() )
|
2019-03-08 02:59:29 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Swap Axis Properties" );
|
2019-03-08 02:59:29 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Swap Axis Properties for all Data Sets in Plot" );
|
2019-03-08 02:59:29 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/Swap.png" ) );
|
2019-03-08 02:59:29 -06:00
|
|
|
}
|