mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4166 Add feature for swapping cross plot axes + tweaks to legend
* Also put x and y property side by side in property editor
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotCurveSetAxesFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.cpp)
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotCurveSetAxesFeature.cpp)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "RicSwapGridCrossPlotCurveSetAxesFeature.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCurveSet.h"
|
||||
|
||||
#include <cafSelectionManager.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicSwapGridCrossPlotCurveSetAxesFeature, "RicSwapGridCrossPlotCurveSetAxesFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSwapGridCrossPlotCurveSetAxesFeature::isCommandEnabled()
|
||||
{
|
||||
if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotCurveSet>())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>())
|
||||
{
|
||||
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
||||
if (!plot->curveSets().empty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSwapGridCrossPlotCurveSetAxesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotCurveSet>())
|
||||
{
|
||||
auto curveSet = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotCurveSet>();
|
||||
curveSet->swapAxisProperties(true);
|
||||
}
|
||||
else if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>())
|
||||
{
|
||||
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
||||
plot->swapAllAxisProperties();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSwapGridCrossPlotCurveSetAxesFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
if (caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotCurveSet>())
|
||||
{
|
||||
actionToSetup->setText("Swap Axis Properties");
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText("Swap Axis Properties for all Data Sets in Plot");
|
||||
}
|
||||
actionToSetup->setIcon(QIcon(":/Swap.png"));
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSwapGridCrossPlotCurveSetAxesFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user