mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Improve user interface for axis linking
Several adjustments to UI as discussed with Håkon and Alireza. * add link/unlink command to right-click menu of axis * select curve in project tree when clicking on legend item * make sure internal legend is always visible when toggling plot * fix issue when using sub plot as data source for axis range
This commit is contained in:
parent
dc01594a95
commit
c734a22bd6
@ -100,8 +100,15 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
RimMainPlotCollection::current()->ensureDefaultFlowPlotsAreCreated();
|
||||
}
|
||||
|
||||
// Import summary cases
|
||||
bool importSummaryCases = readerSettings && readerSettings->importSummaryData;
|
||||
// The default value for summary case import is true, but we use the state from RifReaderSettings if defined
|
||||
//
|
||||
// TODO:
|
||||
// Refactor RifReaderSettings, separate the data structure sent to reader from the data structure in
|
||||
// preferences. See RifReaderSettings::createGridOnlyReaderSettings() for the only use of importSummaryData flag
|
||||
//
|
||||
bool importSummaryCases = true;
|
||||
if ( readerSettings ) importSummaryCases = readerSettings->importSummaryData;
|
||||
|
||||
if ( importSummaryCases && !summaryFileInfos.empty() )
|
||||
{
|
||||
RimSummaryCaseMainCollection* sumCaseColl =
|
||||
@ -208,6 +215,14 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
// Call process events to clear the queue. This make sure that we are able raise the 3D window on top of the
|
||||
// plot window. Otherwise the event processing ends up with the plot window on top.
|
||||
QApplication::processEvents();
|
||||
RiuMainWindow::instance()->activateWindow();
|
||||
}
|
||||
|
||||
if ( openedFilesOut )
|
||||
{
|
||||
*openedFilesOut = openedFiles;
|
||||
|
@ -46,6 +46,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPasteSummaryMultiPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubPlotCtxFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEditSummaryPlotCtxFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicToggleYAxisLinkingFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicToggleXAxisLinkingFeature.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -96,6 +98,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPasteSummaryMultiPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubPlotCtxFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEditSummaryPlotCtxFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicToggleYAxisLinkingFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicToggleXAxisLinkingFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -764,6 +764,8 @@ void RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( const QStringList&
|
||||
std::set<RifEclipseSummaryAddress>* setToInsertFilteredAddressesIn,
|
||||
std::vector<bool>* usedFilters )
|
||||
{
|
||||
if ( allAddressesInCase.empty() ) return;
|
||||
|
||||
int curveFilterCount = curveFilters.size();
|
||||
|
||||
usedFilters->clear();
|
||||
|
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicToggleXAxisLinkingFeature.h"
|
||||
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicToggleXAxisLinkingFeature, "RicToggleXAxisLinkingFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleXAxisLinkingFeature::isCommandEnabled()
|
||||
{
|
||||
auto* summaryMultiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryMultiPlot*>();
|
||||
return ( summaryMultiPlot != nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicToggleXAxisLinkingFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto* summaryMultiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryMultiPlot*>();
|
||||
if ( !summaryMultiPlot ) return;
|
||||
|
||||
bool linkedState = summaryMultiPlot->isTimeAxisLinked();
|
||||
summaryMultiPlot->setTimeAxisLinked( !linkedState );
|
||||
summaryMultiPlot->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicToggleXAxisLinkingFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
QString text = "Link";
|
||||
auto* summaryMultiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryMultiPlot*>();
|
||||
if ( summaryMultiPlot )
|
||||
{
|
||||
if ( summaryMultiPlot->isTimeAxisLinked() )
|
||||
{
|
||||
text = "Unlink";
|
||||
}
|
||||
}
|
||||
|
||||
actionToSetup->setText( text + " Time Axis" );
|
||||
actionToSetup->setIcon( QIcon( ":/chain.png" ) );
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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 RicToggleXAxisLinkingFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicToggleYAxisLinkingFeature.h"
|
||||
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicToggleYAxisLinkingFeature, "RicToggleYAxisLinkingFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleYAxisLinkingFeature::isCommandEnabled()
|
||||
{
|
||||
auto* summaryMultiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryMultiPlot*>();
|
||||
return ( summaryMultiPlot != nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicToggleYAxisLinkingFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto* summaryMultiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryMultiPlot*>();
|
||||
if ( !summaryMultiPlot ) return;
|
||||
|
||||
bool linkedState = summaryMultiPlot->isSubPlotAxesLinked();
|
||||
summaryMultiPlot->setSubPlotAxesLinked( !linkedState );
|
||||
|
||||
for ( auto plot : summaryMultiPlot->summaryPlots() )
|
||||
{
|
||||
plot->axisChanged.send( plot );
|
||||
plot->updateAxes();
|
||||
}
|
||||
|
||||
summaryMultiPlot->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicToggleYAxisLinkingFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
QString text = "Link";
|
||||
auto* summaryMultiPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryMultiPlot*>();
|
||||
if ( summaryMultiPlot )
|
||||
{
|
||||
if ( summaryMultiPlot->isSubPlotAxesLinked() )
|
||||
{
|
||||
text = "Unlink";
|
||||
}
|
||||
}
|
||||
|
||||
actionToSetup->setText( text + " Y Axis" );
|
||||
actionToSetup->setIcon( QIcon( ":/chain.png" ) );
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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 RicToggleYAxisLinkingFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -100,6 +100,7 @@
|
||||
#include "RimParameterResultCrossPlot.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
#include "RimPlotDataFilterItem.h"
|
||||
@ -184,6 +185,7 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1072,6 +1074,14 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if ( dynamic_cast<RimPlotAxisPropertiesInterface*>( firstUiItem ) )
|
||||
{
|
||||
if ( dynamic_cast<RimPlotAxisProperties*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicToggleYAxisLinkingFeature";
|
||||
}
|
||||
if ( dynamic_cast<RimSummaryTimeAxisProperties*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicToggleXAxisLinkingFeature";
|
||||
}
|
||||
menuBuilder << "RicNewPlotAxisPropertiesFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimRftCase*>( firstUiItem ) )
|
||||
|
@ -73,7 +73,7 @@ namespace caf
|
||||
template <>
|
||||
void AppEnum<RimSummaryMultiPlot::AxisRangeAggregation>::setUp()
|
||||
{
|
||||
addItem( RimSummaryMultiPlot::AxisRangeAggregation::NONE, "NONE", "None" );
|
||||
addItem( RimSummaryMultiPlot::AxisRangeAggregation::NONE, "NONE", "Per Sub Plot" );
|
||||
addItem( RimSummaryMultiPlot::AxisRangeAggregation::SUB_PLOTS, "SUB_PLOTS", "All Sub Plots" );
|
||||
addItem( RimSummaryMultiPlot::AxisRangeAggregation::WELLS, "WELLS", "All Wells" );
|
||||
addItem( RimSummaryMultiPlot::AxisRangeAggregation::REGIONS, "REGIONS", "All Regions" );
|
||||
@ -142,7 +142,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
m_appendPrevCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", false, "Link Y Axes" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_linkSubPlotAxes );
|
||||
CAF_PDM_InitField( &m_linkTimeAxis, "LinkTimeAxis", true, "Link Time Axis" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_linkTimeAxis );
|
||||
@ -151,7 +151,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
CAF_PDM_InitField( &m_allow3DSelectionLink, "Allow3DSelectionLink", true, "Allow Well Selection from 3D View" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_allow3DSelectionLink );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Control" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Y Axis Range" );
|
||||
|
||||
CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "" );
|
||||
m_hidePlotsWithValuesBelow.xmlCapability()->disableIO();
|
||||
@ -206,9 +206,10 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
sumPlot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged );
|
||||
sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
|
||||
sumPlot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed );
|
||||
|
||||
bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE;
|
||||
setOverriddenFlagsForPlot( sumPlot, isMinMaxOverridden, m_autoAdjustAppearance() );
|
||||
setAutoValueStatesForPlot( sumPlot, isMinMaxOverridden, m_autoAdjustAppearance() );
|
||||
|
||||
RimMultiPlot::insertPlot( plot, index );
|
||||
}
|
||||
@ -393,9 +394,6 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
axesGroup->add( &m_linkTimeAxis );
|
||||
axesGroup->add( &m_autoAdjustAppearance );
|
||||
|
||||
m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() );
|
||||
if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false;
|
||||
|
||||
auto plotVisibilityFilterGroup = uiOrdering.addNewGroup( "Plot Visibility Filter" );
|
||||
plotVisibilityFilterGroup->add( &m_plotFilterYAxisThreshold );
|
||||
plotVisibilityFilterGroup->add( &m_hidePlotsWithValuesBelow );
|
||||
@ -428,6 +426,8 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
legendsGroup->add( &m_legendFontSize );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
|
||||
updateReadOnlyState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -453,7 +453,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation ||
|
||||
changedField == &m_linkTimeAxis )
|
||||
{
|
||||
setOverriddenFlag();
|
||||
setAutoValueStates();
|
||||
syncAxisRanges();
|
||||
}
|
||||
else if ( changedField == &m_hidePlotsWithValuesBelow )
|
||||
@ -492,7 +492,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
}
|
||||
else if ( changedField == &m_autoAdjustAppearance )
|
||||
{
|
||||
setOverriddenFlag();
|
||||
setAutoValueStates();
|
||||
checkAndApplyAutoAppearance();
|
||||
}
|
||||
else
|
||||
@ -710,6 +710,7 @@ void RimSummaryMultiPlot::initAfterRead()
|
||||
{
|
||||
plot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged );
|
||||
plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
|
||||
plot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed );
|
||||
}
|
||||
updateStepDimensionFromDefault();
|
||||
}
|
||||
@ -730,7 +731,22 @@ void RimSummaryMultiPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::zoomAll()
|
||||
{
|
||||
setOverriddenFlag();
|
||||
setAutoValueStates();
|
||||
|
||||
if ( m_linkSubPlotAxes() )
|
||||
{
|
||||
// Reset zoom to make sure the complete range for min/max is available
|
||||
RimMultiPlot::zoomAll();
|
||||
|
||||
if ( !summaryPlots().empty() )
|
||||
{
|
||||
onSubPlotAxisChanged( nullptr, summaryPlots().front() );
|
||||
}
|
||||
|
||||
updateZoom();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset zoom to make sure the complete range for min/max is available
|
||||
RimMultiPlot::zoomAll();
|
||||
@ -792,7 +808,7 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension()
|
||||
m_axisRangeAggregation = rangeAggregation;
|
||||
m_sourceStepping->setStepDimension( stepDimension );
|
||||
|
||||
setOverriddenFlag();
|
||||
setAutoValueStates();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -812,6 +828,11 @@ void RimSummaryMultiPlot::checkAndApplyAutoAppearance()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::syncAxisRanges()
|
||||
{
|
||||
if ( m_linkSubPlotAxes() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_axisRangeAggregation() == AxisRangeAggregation::NONE )
|
||||
{
|
||||
return;
|
||||
@ -830,7 +851,7 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
|
||||
if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS )
|
||||
{
|
||||
std::map<RiuPlotAxis, std::pair<double, double>> axisRanges;
|
||||
std::map<QString, std::pair<double, double>> axisRanges;
|
||||
|
||||
// gather current min/max values for each category (axis label)
|
||||
for ( auto plot : summaryPlots() )
|
||||
@ -841,14 +862,15 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
double maxVal = axis->visibleRangeMax();
|
||||
if ( axis->isAxisInverted() ) std::swap( minVal, maxVal );
|
||||
|
||||
if ( axisRanges.count( axis->plotAxisType() ) == 0 )
|
||||
auto axisTitleText = axis->axisTitleText();
|
||||
if ( axisRanges.count( axisTitleText ) == 0 )
|
||||
{
|
||||
axisRanges[axis->plotAxisType()] = std::make_pair( minVal, maxVal );
|
||||
axisRanges[axisTitleText] = std::make_pair( minVal, maxVal );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
|
||||
axisRanges[axis->plotAxisType()] =
|
||||
auto& [currentMin, currentMax] = axisRanges[axisTitleText];
|
||||
axisRanges[axisTitleText] =
|
||||
std::make_pair( std::min( currentMin, minVal ), std::max( currentMax, maxVal ) );
|
||||
}
|
||||
}
|
||||
@ -859,7 +881,7 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
{
|
||||
for ( auto axis : plot->plotYAxes() )
|
||||
{
|
||||
auto [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
auto [minVal, maxVal] = axisRanges[axis->axisTitleText()];
|
||||
if ( axis->isAxisInverted() ) std::swap( minVal, maxVal );
|
||||
axis->setAutoZoom( false );
|
||||
axis->setAutoValueVisibleRangeMin( minVal );
|
||||
@ -1148,19 +1170,19 @@ void RimSummaryMultiPlot::updatePlotVisibility()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::setOverriddenFlag()
|
||||
void RimSummaryMultiPlot::setAutoValueStates()
|
||||
{
|
||||
bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE;
|
||||
bool enableMinMaxAutoValue = m_axisRangeAggregation() != AxisRangeAggregation::NONE;
|
||||
for ( auto p : summaryPlots() )
|
||||
{
|
||||
setOverriddenFlagsForPlot( p, isMinMaxOverridden, m_autoAdjustAppearance() );
|
||||
setAutoValueStatesForPlot( p, enableMinMaxAutoValue, m_autoAdjustAppearance() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::setOverriddenFlagsForPlot( RimSummaryPlot* summaryPlot,
|
||||
void RimSummaryMultiPlot::setAutoValueStatesForPlot( RimSummaryPlot* summaryPlot,
|
||||
bool enableAutoValueMinMax,
|
||||
bool enableAutoValueAppearance )
|
||||
{
|
||||
@ -1242,9 +1264,6 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings()
|
||||
|
||||
if ( hasOnlyOneQuantity )
|
||||
{
|
||||
// Disable sub plot linking to be able to configure individually
|
||||
setSubPlotAxesLinked( false );
|
||||
|
||||
auto [row, col] = gridLayoutInfoForSubPlot( p );
|
||||
if ( col == 0 )
|
||||
{
|
||||
@ -1287,6 +1306,14 @@ bool RimSummaryMultiPlot::isSubPlotAxesLinked() const
|
||||
return m_linkSubPlotAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::setTimeAxisLinked( bool enable )
|
||||
{
|
||||
m_linkTimeAxis = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1315,6 +1342,14 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter )
|
||||
applyPlotWindowTitleToWidgets();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::onSubPlotZoomed( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
m_axisRangeAggregation = AxisRangeAggregation::NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1340,6 +1375,14 @@ void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitte
|
||||
syncAxisRanges();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updateReadOnlyState()
|
||||
{
|
||||
m_axisRangeAggregation.uiCapability()->setUiReadOnly( m_linkSubPlotAxes() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
|
||||
void setSubPlotAxesLinked( bool enable );
|
||||
bool isSubPlotAxesLinked() const;
|
||||
void setTimeAxisLinked( bool enable );
|
||||
bool isTimeAxisLinked() const;
|
||||
|
||||
std::pair<int, int> gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const;
|
||||
@ -134,9 +135,9 @@ private:
|
||||
void updateSourceStepper();
|
||||
|
||||
void updatePlotVisibility();
|
||||
void setOverriddenFlag();
|
||||
void setAutoValueStates();
|
||||
static void
|
||||
setOverriddenFlagsForPlot( RimSummaryPlot* summaryPlot, bool isMinMaxOverridden, bool isAppearanceOverridden );
|
||||
setAutoValueStatesForPlot( RimSummaryPlot* summaryPlot, bool isMinMaxOverridden, bool isAppearanceOverridden );
|
||||
|
||||
void duplicate();
|
||||
|
||||
@ -146,8 +147,11 @@ private:
|
||||
void analyzePlotsAndAdjustAppearanceSettings();
|
||||
|
||||
void onSubPlotChanged( const caf::SignalEmitter* emitter );
|
||||
void onSubPlotZoomed( const caf::SignalEmitter* emitter );
|
||||
void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot );
|
||||
|
||||
void updateReadOnlyState();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_autoPlotTitle;
|
||||
caf::PdmField<bool> m_autoSubPlotTitle;
|
||||
|
@ -104,6 +104,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
|
||||
, m_isCrossPlot( isCrossPlot )
|
||||
, curvesChanged( this )
|
||||
, axisChanged( this )
|
||||
, plotZoomedByUser( this )
|
||||
, m_isValid( true )
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
|
||||
@ -1744,6 +1745,8 @@ void RimSummaryPlot::updateZoomFromParentPlot()
|
||||
{
|
||||
propertyAxis->setAutoValueVisibleRangeMax( axisMax );
|
||||
propertyAxis->setAutoValueVisibleRangeMin( axisMin );
|
||||
axisProperties->setVisibleRangeMax( axisMax );
|
||||
axisProperties->setVisibleRangeMin( axisMin );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2372,8 +2375,18 @@ RimEnsembleCurveSet* RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSumma
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::onPlotZoomed()
|
||||
{
|
||||
// Disable auto scale in plot engine
|
||||
setAutoScaleXEnabled( false );
|
||||
setAutoScaleYEnabled( false );
|
||||
|
||||
// Disable auto value for min/max fields
|
||||
for ( auto p : plotYAxes() )
|
||||
{
|
||||
p->enableAutoValueMinMax( false );
|
||||
}
|
||||
|
||||
plotZoomedByUser.send();
|
||||
|
||||
updateZoomFromParentPlot();
|
||||
|
||||
axisChanged.send( this );
|
||||
|
@ -81,6 +81,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping
|
||||
public:
|
||||
caf::Signal<> curvesChanged;
|
||||
caf::Signal<RimSummaryPlot*> axisChanged;
|
||||
caf::Signal<> plotZoomedByUser;
|
||||
|
||||
public:
|
||||
RimSummaryPlot( bool isCrossPlot = false );
|
||||
|
@ -755,7 +755,10 @@ void RiuMultiPlotPage::updateLegendVisibility( RiuPlotWidget* plotWid
|
||||
legend->show();
|
||||
|
||||
if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE )
|
||||
{
|
||||
plotWidget->addOverlayFrame( legendFrame );
|
||||
legendFrame->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
plotWidget->removeOverlayFrame( legendFrame );
|
||||
|
@ -1486,7 +1486,13 @@ void RiuQwtPlotWidget::onLegendClicked( const QVariant& itemInfo, int index )
|
||||
if ( !itemInfo.canConvert<QwtPlotItem*>() ) return;
|
||||
|
||||
QwtPlotItem* plotItem = qvariant_cast<QwtPlotItem*>( itemInfo );
|
||||
if ( plotItem ) highlightPlotItem( plotItem );
|
||||
if ( plotItem )
|
||||
{
|
||||
highlightPlotItem( plotItem );
|
||||
|
||||
auto wrappedPlotItem = std::make_shared<RiuQwtPlotItem>( plotItem );
|
||||
emit plotItemSelected( wrappedPlotItem, false, -1 );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -279,7 +279,8 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
m_autoValueToolButton->setIcon( icon );
|
||||
|
||||
m_autoValueToolButton->setChecked( uiField()->isAutoValueEnabled() );
|
||||
QString tooltipText = uiField()->isAutoValueEnabled() ? "Linked" : "Unlinked";
|
||||
QString tooltipText = uiField()->isAutoValueEnabled() ? UiAppearanceSettings::globaleValueButtonText()
|
||||
: UiAppearanceSettings::localValueButtonText();
|
||||
m_autoValueToolButton->setToolTip( tooltipText );
|
||||
m_layout->insertWidget( 3, m_autoValueToolButton );
|
||||
m_autoValueToolButton->show();
|
||||
|
@ -156,7 +156,8 @@ void PdmUiLineEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
m_autoValueToolButton->setIcon( icon );
|
||||
|
||||
m_autoValueToolButton->setChecked( uiField()->isAutoValueEnabled() );
|
||||
QString tooltipText = uiField()->isAutoValueEnabled() ? "Linked" : "Unlinked";
|
||||
QString tooltipText = uiField()->isAutoValueEnabled() ? UiAppearanceSettings::globaleValueButtonText()
|
||||
: UiAppearanceSettings::localValueButtonText();
|
||||
m_autoValueToolButton->setToolTip( tooltipText );
|
||||
|
||||
m_layout->insertWidget( 1, m_autoValueToolButton );
|
||||
|
@ -60,4 +60,20 @@ void UiAppearanceSettings::setAutoValueEditorColor( const QString& colorName )
|
||||
m_autoValueEditorColor = colorName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString UiAppearanceSettings::globaleValueButtonText()
|
||||
{
|
||||
return "Global Value";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString UiAppearanceSettings::localValueButtonText()
|
||||
{
|
||||
return "Local Value";
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
@ -47,6 +47,9 @@ public:
|
||||
QString autoValueEditorColor() const;
|
||||
void setAutoValueEditorColor( const QString& colorName );
|
||||
|
||||
static QString globaleValueButtonText();
|
||||
static QString localValueButtonText();
|
||||
|
||||
private:
|
||||
QString m_autoValueEditorColor;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user