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:
parent
1e777eaea0
commit
e00f983360
@ -2,11 +2,13 @@
|
|||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotCurveSetAxesFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.cpp
|
${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
|
list(APPEND CODE_HEADER_FILES
|
||||||
${SOURCE_GROUP_HEADER_FILES}
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#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;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -487,6 +487,7 @@ void RimGridCrossPlot::updatePlot()
|
|||||||
{
|
{
|
||||||
m_qwtPlot->insertLegend(nullptr);
|
m_qwtPlot->insertLegend(nullptr);
|
||||||
}
|
}
|
||||||
|
m_qwtPlot->updateLegendSizesToMatchPlot();
|
||||||
m_qwtPlot->replot();
|
m_qwtPlot->replot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,6 +508,18 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlot::swapAllAxisProperties()
|
||||||
|
{
|
||||||
|
for (auto curveSet : m_crossPlotCurveSets)
|
||||||
|
{
|
||||||
|
curveSet->swapAxisProperties(false);
|
||||||
|
}
|
||||||
|
loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
void detachAllCurves();
|
void detachAllCurves();
|
||||||
void performAutoNameUpdate() override;
|
void performAutoNameUpdate() override;
|
||||||
void updateCurveNamesAndPlotTitle();
|
void updateCurveNamesAndPlotTitle();
|
||||||
|
void swapAllAxisProperties();
|
||||||
|
|
||||||
RiuGridCrossQwtPlot* qwtPlot() const;
|
RiuGridCrossQwtPlot* qwtPlot() const;
|
||||||
public:
|
public:
|
||||||
|
@ -79,7 +79,7 @@ RimGridCrossPlotCurveSet::RimGridCrossPlotCurveSet()
|
|||||||
CAF_PDM_InitField(&m_timeStep, "TimeStep", -1, "Time Step", "", "", "");
|
CAF_PDM_InitField(&m_timeStep, "TimeStep", -1, "Time Step", "", "", "");
|
||||||
m_timeStep.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
m_timeStep.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_cellFilterView, "VisibleCellView", "Filter by Cells Visible in 3d View", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_cellFilterView, "VisibleCellView", "Filter by 3d View Visibility", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_grouping, "Grouping", "Group Data by", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_grouping, "Grouping", "Group Data by", "", "", "");
|
||||||
|
|
||||||
@ -87,11 +87,13 @@ RimGridCrossPlotCurveSet::RimGridCrossPlotCurveSet()
|
|||||||
m_xAxisProperty = new RimEclipseResultDefinition;
|
m_xAxisProperty = new RimEclipseResultDefinition;
|
||||||
m_xAxisProperty.uiCapability()->setUiHidden(true);
|
m_xAxisProperty.uiCapability()->setUiHidden(true);
|
||||||
m_xAxisProperty.uiCapability()->setUiTreeChildrenHidden(true);
|
m_xAxisProperty.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
m_xAxisProperty->setLabelsOnTop(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_yAxisProperty, "YAxisProperty", "Y-Axis Property", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_yAxisProperty, "YAxisProperty", "Y-Axis Property", "", "", "");
|
||||||
m_yAxisProperty = new RimEclipseResultDefinition;
|
m_yAxisProperty = new RimEclipseResultDefinition;
|
||||||
m_yAxisProperty.uiCapability()->setUiHidden(true);
|
m_yAxisProperty.uiCapability()->setUiHidden(true);
|
||||||
m_yAxisProperty.uiCapability()->setUiTreeChildrenHidden(true);
|
m_yAxisProperty.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
m_yAxisProperty->setLabelsOnTop(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_groupingProperty, "GroupingProperty", "Data Grouping Property", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_groupingProperty, "GroupingProperty", "Data Grouping Property", "", "", "");
|
||||||
m_groupingProperty = new RimEclipseCellColors;
|
m_groupingProperty = new RimEclipseCellColors;
|
||||||
@ -115,6 +117,7 @@ RimGridCrossPlotCurveSet::RimGridCrossPlotCurveSet()
|
|||||||
void RimGridCrossPlotCurveSet::setCellFilterView(RimGridView* cellFilterView)
|
void RimGridCrossPlotCurveSet::setCellFilterView(RimGridView* cellFilterView)
|
||||||
{
|
{
|
||||||
m_cellFilterView = cellFilterView;
|
m_cellFilterView = cellFilterView;
|
||||||
|
m_groupingProperty->setReservoirView(dynamic_cast<RimEclipseView*>(m_cellFilterView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -534,7 +537,7 @@ void RimGridCrossPlotCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
|||||||
caf::PdmUiGroup* xAxisGroup = uiOrdering.addNewGroup("X-Axis Property");
|
caf::PdmUiGroup* xAxisGroup = uiOrdering.addNewGroup("X-Axis Property");
|
||||||
m_xAxisProperty->uiOrdering(uiConfigName, *xAxisGroup);
|
m_xAxisProperty->uiOrdering(uiConfigName, *xAxisGroup);
|
||||||
|
|
||||||
caf::PdmUiGroup* yAxisGroup = uiOrdering.addNewGroup("Y-Axis Property");
|
caf::PdmUiGroup* yAxisGroup = uiOrdering.addNewGroup("Y-Axis Property", false);
|
||||||
m_yAxisProperty->uiOrdering(uiConfigName, *yAxisGroup);
|
m_yAxisProperty->uiOrdering(uiConfigName, *yAxisGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,6 +602,7 @@ void RimGridCrossPlotCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
}
|
}
|
||||||
else if (changedField == &m_cellFilterView)
|
else if (changedField == &m_cellFilterView)
|
||||||
{
|
{
|
||||||
|
m_groupingProperty->setReservoirView(dynamic_cast<RimEclipseView*>(m_cellFilterView()));
|
||||||
loadDataAndUpdate(true);
|
loadDataAndUpdate(true);
|
||||||
}
|
}
|
||||||
else if (changedField == &m_isChecked)
|
else if (changedField == &m_isChecked)
|
||||||
@ -767,6 +771,21 @@ bool RimGridCrossPlotCurveSet::groupingEnabled() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridCrossPlotCurveSet::swapAxisProperties(bool updatePlot)
|
||||||
|
{
|
||||||
|
RimEclipseResultDefinition* xAxisProperties = m_xAxisProperty();
|
||||||
|
RimEclipseResultDefinition* yAxisProperties = m_yAxisProperty();
|
||||||
|
|
||||||
|
m_xAxisProperty.removeChildObject(xAxisProperties);
|
||||||
|
m_yAxisProperty.removeChildObject(yAxisProperties);
|
||||||
|
m_yAxisProperty = xAxisProperties;
|
||||||
|
m_xAxisProperty = yAxisProperties;
|
||||||
|
loadDataAndUpdate(updatePlot);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -113,6 +113,7 @@ public:
|
|||||||
void updateLegend();
|
void updateLegend();
|
||||||
bool groupingByCategoryResult() const;
|
bool groupingByCategoryResult() const;
|
||||||
bool groupingEnabled() const;
|
bool groupingEnabled() const;
|
||||||
|
void swapAxisProperties(bool updatePlot);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initAfterRead() override;
|
void initAfterRead() override;
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#include "RimGridCollection.h"
|
#include "RimGridCollection.h"
|
||||||
#include "RimGridCrossPlot.h"
|
#include "RimGridCrossPlot.h"
|
||||||
#include "RimGridCrossPlotCollection.h"
|
#include "RimGridCrossPlotCollection.h"
|
||||||
|
#include "RimGridCrossPlotCurveSet.h"
|
||||||
#include "RimIdenticalGridCaseGroup.h"
|
#include "RimIdenticalGridCaseGroup.h"
|
||||||
#include "RimIntersection.h"
|
#include "RimIntersection.h"
|
||||||
#include "RimIntersectionBox.h"
|
#include "RimIntersectionBox.h"
|
||||||
@ -472,6 +473,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
else if (dynamic_cast<RimGridCrossPlot*>(uiItem))
|
else if (dynamic_cast<RimGridCrossPlot*>(uiItem))
|
||||||
{
|
{
|
||||||
menuBuilder << "RicCreateGridCrossPlotCurveSetFeature";
|
menuBuilder << "RicCreateGridCrossPlotCurveSetFeature";
|
||||||
|
menuBuilder << "RicSwapGridCrossPlotCurveSetAxesFeature";
|
||||||
|
}
|
||||||
|
else if (dynamic_cast<RimGridCrossPlotCurveSet*>(uiItem))
|
||||||
|
{
|
||||||
|
menuBuilder << "RicSwapGridCrossPlotCurveSetAxesFeature";
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem)) // This is also the definition for RimSummaryCrossPlot
|
else if (dynamic_cast<RimSummaryPlot*>(uiItem)) // This is also the definition for RimSummaryCrossPlot
|
||||||
{
|
{
|
||||||
|
@ -76,6 +76,7 @@ CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimEclipseResultDefinition::RimEclipseResultDefinition()
|
RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||||
: m_diffResultOptionsEnabled(false)
|
: m_diffResultOptionsEnabled(false)
|
||||||
|
, m_labelsOnTop(false)
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Result Definition", "", "", "");
|
CAF_PDM_InitObject("Result Definition", "", "", "");
|
||||||
|
|
||||||
@ -1172,6 +1173,14 @@ void RimEclipseResultDefinition::setDiffResultOptionsEnabled(bool enabled)
|
|||||||
m_diffResultOptionsEnabled = true;
|
m_diffResultOptionsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseResultDefinition::setLabelsOnTop(bool labelsOnTop)
|
||||||
|
{
|
||||||
|
m_labelsOnTop = labelsOnTop;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1302,6 +1311,19 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
|||||||
m_resultVariableUiField.uiCapability()->setUiName(resultPropertyLabel);
|
m_resultVariableUiField.uiCapability()->setUiName(resultPropertyLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_labelsOnTop)
|
||||||
|
{
|
||||||
|
std::vector<caf::PdmFieldHandle*> fields;
|
||||||
|
this->fields(fields);
|
||||||
|
for (auto field : fields)
|
||||||
|
{
|
||||||
|
if (field->uiCapability())
|
||||||
|
{
|
||||||
|
field->uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ public:
|
|||||||
void updateUiFieldsFromActiveResult();
|
void updateUiFieldsFromActiveResult();
|
||||||
|
|
||||||
void setDiffResultOptionsEnabled(bool enabled);
|
void setDiffResultOptionsEnabled(bool enabled);
|
||||||
|
void setLabelsOnTop(bool labelsOnTop);
|
||||||
protected:
|
protected:
|
||||||
virtual void updateLegendCategorySettings() {};
|
virtual void updateLegendCategorySettings() {};
|
||||||
|
|
||||||
@ -214,5 +215,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_diffResultOptionsEnabled;
|
bool m_diffResultOptionsEnabled;
|
||||||
|
bool m_labelsOnTop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@
|
|||||||
<file>ReachCircle16x16.png</file>
|
<file>ReachCircle16x16.png</file>
|
||||||
<file>2DMapProjection16x16.png</file>
|
<file>2DMapProjection16x16.png</file>
|
||||||
<file>Ruler24x24.png</file>
|
<file>Ruler24x24.png</file>
|
||||||
|
<file>Swap.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/Shader/">
|
<qresource prefix="/Shader/">
|
||||||
<file>fs_CellFace.glsl</file>
|
<file>fs_CellFace.glsl</file>
|
||||||
|
BIN
ApplicationCode/Resources/Swap.png
Normal file
BIN
ApplicationCode/Resources/Swap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 466 B |
@ -83,6 +83,41 @@ void RiuGridCrossQwtPlot::removeCurveSetLegend(RimGridCrossPlotCurveSet* curveSe
|
|||||||
this->updateLegendLayout();
|
this->updateLegendLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuGridCrossQwtPlot::updateLegendSizesToMatchPlot()
|
||||||
|
{
|
||||||
|
RimGridCrossPlot* crossPlot = dynamic_cast<RimGridCrossPlot*>(ownerPlotDefinition());
|
||||||
|
if (!crossPlot) return;
|
||||||
|
|
||||||
|
bool anyLegendResized = false;
|
||||||
|
|
||||||
|
for (RimGridCrossPlotCurveSet* curveSet : crossPlot->curveSets())
|
||||||
|
{
|
||||||
|
if (!curveSet->isChecked() || !curveSet->legendConfig()->showLegend()) continue;
|
||||||
|
|
||||||
|
auto pairIt = m_legendWidgets.find(curveSet);
|
||||||
|
if (pairIt != m_legendWidgets.end())
|
||||||
|
{
|
||||||
|
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
|
||||||
|
if (overlayWidget->isVisible())
|
||||||
|
{
|
||||||
|
caf::TitledOverlayFrame* overlayItem = curveSet->legendConfig()->titledOverlayFrame();
|
||||||
|
if (resizeOverlayItemToFitPlot(overlayItem))
|
||||||
|
{
|
||||||
|
anyLegendResized = true;
|
||||||
|
overlayWidget->updateFromOverlayItem(overlayItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (anyLegendResized)
|
||||||
|
{
|
||||||
|
updateLegendLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -146,35 +181,7 @@ void RiuGridCrossQwtPlot::updateLegendLayout()
|
|||||||
void RiuGridCrossQwtPlot::resizeEvent(QResizeEvent* e)
|
void RiuGridCrossQwtPlot::resizeEvent(QResizeEvent* e)
|
||||||
{
|
{
|
||||||
QwtPlot::resizeEvent(e);
|
QwtPlot::resizeEvent(e);
|
||||||
|
updateLegendSizesToMatchPlot();
|
||||||
RimGridCrossPlot* crossPlot = dynamic_cast<RimGridCrossPlot*>(ownerPlotDefinition());
|
|
||||||
if (!crossPlot) return;
|
|
||||||
|
|
||||||
bool anyLegendResized = false;
|
|
||||||
|
|
||||||
for (RimGridCrossPlotCurveSet* curveSet : crossPlot->curveSets())
|
|
||||||
{
|
|
||||||
if (!curveSet->isChecked() || !curveSet->legendConfig()->showLegend()) continue;
|
|
||||||
|
|
||||||
auto pairIt = m_legendWidgets.find(curveSet);
|
|
||||||
if (pairIt != m_legendWidgets.end())
|
|
||||||
{
|
|
||||||
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
|
|
||||||
if (overlayWidget->isVisible())
|
|
||||||
{
|
|
||||||
caf::TitledOverlayFrame* overlayItem = curveSet->legendConfig()->titledOverlayFrame();
|
|
||||||
if (resizeOverlayItemToFitPlot(overlayItem))
|
|
||||||
{
|
|
||||||
anyLegendResized = true;
|
|
||||||
overlayWidget->updateFromOverlayItem(overlayItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (anyLegendResized)
|
|
||||||
{
|
|
||||||
updateLegendLayout();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
void addOrUpdateCurveSetLegend(RimGridCrossPlotCurveSet* curveSetToShowLegendFor);
|
void addOrUpdateCurveSetLegend(RimGridCrossPlotCurveSet* curveSetToShowLegendFor);
|
||||||
void removeCurveSetLegend(RimGridCrossPlotCurveSet* curveSetToShowLegendFor);
|
void removeCurveSetLegend(RimGridCrossPlotCurveSet* curveSetToShowLegendFor);
|
||||||
|
void updateLegendSizesToMatchPlot();
|
||||||
protected:
|
protected:
|
||||||
void updateLayout() override;
|
void updateLayout() override;
|
||||||
void updateLegendLayout();
|
void updateLegendLayout();
|
||||||
|
@ -320,6 +320,10 @@ QMinimizePanel*
|
|||||||
groupBoxLayout->setContentsMargins(0, 0, 0, 0);
|
groupBoxLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
groupBoxLayout->setHorizontalSpacing(0);
|
groupBoxLayout->setHorizontalSpacing(0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
groupBoxLayout->setContentsMargins(6, 6, 6, 6);
|
||||||
|
}
|
||||||
groupBox->contentFrame()->setLayout(groupBoxLayout);
|
groupBox->contentFrame()->setLayout(groupBoxLayout);
|
||||||
connect(groupBox, SIGNAL(expandedChanged(bool)), this, SLOT(groupBoxExpandedStateToggled(bool)));
|
connect(groupBox, SIGNAL(expandedChanged(bool)), this, SLOT(groupBoxExpandedStateToggled(bool)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user