mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Minor adjustments (#9070)
* Add system commands to test toolbar * #9069 Summary Plot: Update only Y axis values during source stepping * Reduce default brightness for ensemble summary curves * Add a separate flag to control linking of time axis * Make sure interactive zoom in plot is handled * Move message dock window to right dock panel
This commit is contained in:
@@ -143,6 +143,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
|
||||
CAF_PDM_InitField( &m_linkTimeAxis, "LinkTimeAxis", true, "Link Time Axis" );
|
||||
CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", true, "Auto Adjust Appearance" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Control" );
|
||||
@@ -381,6 +382,7 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
auto axesGroup = uiOrdering.addNewGroup( "Axes" );
|
||||
axesGroup->add( &m_axisRangeAggregation );
|
||||
axesGroup->add( &m_linkSubPlotAxes );
|
||||
axesGroup->add( &m_linkTimeAxis );
|
||||
axesGroup->add( &m_autoAdjustAppearance );
|
||||
|
||||
m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() );
|
||||
@@ -428,7 +430,16 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
onLoadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation )
|
||||
else if ( changedField == &m_linkTimeAxis )
|
||||
{
|
||||
auto plots = summaryPlots();
|
||||
if ( !plots.empty() )
|
||||
{
|
||||
syncTimeAxisRanges( plots.front() );
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation ||
|
||||
changedField == &m_linkTimeAxis )
|
||||
{
|
||||
syncAxisRanges();
|
||||
|
||||
@@ -795,7 +806,7 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
}
|
||||
|
||||
// Reset zoom to make sure the complete range for min/max is available
|
||||
RimMultiPlot::zoomAll();
|
||||
RimMultiPlot::zoomAllYAxes();
|
||||
|
||||
if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS )
|
||||
{
|
||||
@@ -804,7 +815,7 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
// gather current min/max values for each category (axis label)
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
for ( auto axis : plot->plotYAxes() )
|
||||
{
|
||||
double minVal = axis->visibleRangeMin();
|
||||
double maxVal = axis->visibleRangeMax();
|
||||
@@ -826,7 +837,7 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
// set all plots to use the global min/max values for each category
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
for ( auto axis : plot->plotYAxes() )
|
||||
{
|
||||
auto [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
if ( axis->isAxisInverted() ) std::swap( minVal, maxVal );
|
||||
@@ -844,6 +855,24 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::syncTimeAxisRanges( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
if ( m_linkTimeAxis )
|
||||
{
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
if ( plot != summaryPlot )
|
||||
{
|
||||
plot->copyAxisPropertiesFromOther( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, *summaryPlot );
|
||||
plot->updateAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -975,7 +1004,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
{
|
||||
std::map<RiuPlotAxis, std::pair<double, double>> axisRanges;
|
||||
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
for ( auto axis : plot->plotYAxes() )
|
||||
{
|
||||
for ( auto curve : plot->summaryCurves() )
|
||||
{
|
||||
@@ -1042,7 +1071,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
}
|
||||
|
||||
// set all plots to use the global min/max values for each category
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
for ( auto axis : plot->plotYAxes() )
|
||||
{
|
||||
auto [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
if ( RiaDefines::isVertical( axis->plotAxisType().axis() ) && !std::isinf( minVal ) && !std::isinf( maxVal ) )
|
||||
@@ -1170,7 +1199,7 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings()
|
||||
else
|
||||
timeAxisProp->setMajorTickmarkCount( RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_FEW );
|
||||
|
||||
for ( RimPlotAxisPropertiesInterface* axisInterface : p->plotAxes() )
|
||||
for ( RimPlotAxisPropertiesInterface* axisInterface : p->plotYAxes() )
|
||||
{
|
||||
auto axisProp = dynamic_cast<RimPlotAxisProperties*>( axisInterface );
|
||||
|
||||
@@ -1226,6 +1255,14 @@ bool RimSummaryMultiPlot::isSubPlotAxesLinked() const
|
||||
return m_linkSubPlotAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryMultiPlot::isTimeAxisLinked() const
|
||||
{
|
||||
return m_linkTimeAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1251,6 +1288,8 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
syncTimeAxisRanges( summaryPlot );
|
||||
|
||||
if ( !m_linkSubPlotAxes() )
|
||||
{
|
||||
syncAxisRanges();
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar() override;
|
||||
|
||||
void syncAxisRanges();
|
||||
void syncTimeAxisRanges( RimSummaryPlot* summaryPlot );
|
||||
|
||||
void handleDroppedObjects( const std::vector<caf::PdmObjectHandle*>& objects );
|
||||
|
||||
@@ -96,6 +97,7 @@ public:
|
||||
|
||||
void setSubPlotAxesLinked( bool enable );
|
||||
bool isSubPlotAxesLinked() const;
|
||||
bool isTimeAxisLinked() const;
|
||||
|
||||
std::pair<int, int> gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const;
|
||||
|
||||
@@ -150,6 +152,7 @@ private:
|
||||
caf::PdmField<bool> m_disableWheelZoom;
|
||||
caf::PdmField<bool> m_createPlotDuplicate;
|
||||
caf::PdmField<bool> m_linkSubPlotAxes;
|
||||
caf::PdmField<bool> m_linkTimeAxis;
|
||||
caf::PdmField<bool> m_autoAdjustAppearance;
|
||||
|
||||
caf::PdmField<bool> m_hidePlotsWithValuesBelow;
|
||||
|
||||
@@ -623,6 +623,22 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSu
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::copyAxisPropertiesFromOther( RiaDefines::PlotAxis plotAxisType, const RimSummaryPlot& sourceSummaryPlot )
|
||||
{
|
||||
for ( auto ap : sourceSummaryPlot.plotAxes() )
|
||||
{
|
||||
if ( ap->plotAxisType().axis() != plotAxisType ) continue;
|
||||
|
||||
QString data = ap->writeObjectToXmlString();
|
||||
|
||||
axisPropertiesForPlotAxis( ap->plotAxisType() )
|
||||
->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -769,15 +785,18 @@ void RimSummaryPlot::applyDefaultCurveAppearances()
|
||||
cvf::Color3f curveColor;
|
||||
if ( RiaPreferencesSummary::current()->colorCurvesByPhase() )
|
||||
{
|
||||
auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() );
|
||||
|
||||
curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 );
|
||||
curveColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() );
|
||||
}
|
||||
else
|
||||
{
|
||||
curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ );
|
||||
}
|
||||
|
||||
int weightBaseColor = 10;
|
||||
int weightWhite = 25;
|
||||
|
||||
curveColor = RiaColorTools::blendCvfColors( curveColor, cvf::Color3f::WHITE, weightBaseColor, weightWhite );
|
||||
|
||||
curveSet->setColor( curveColor );
|
||||
}
|
||||
}
|
||||
@@ -1192,6 +1211,8 @@ void RimSummaryPlot::zoomAll()
|
||||
setAutoScaleXEnabled( true );
|
||||
setAutoScaleYEnabled( true );
|
||||
updateZoomInParentPlot();
|
||||
|
||||
axisChanged.send( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2282,6 +2303,8 @@ void RimSummaryPlot::onPlotZoomed()
|
||||
setAutoScaleXEnabled( false );
|
||||
setAutoScaleYEnabled( false );
|
||||
updateZoomFromParentPlot();
|
||||
|
||||
axisChanged.send( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2755,6 +2778,20 @@ std::vector<RimPlotAxisPropertiesInterface*> RimSummaryPlot::plotAxes() const
|
||||
return axisProps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotAxisPropertiesInterface*> RimSummaryPlot::plotYAxes() const
|
||||
{
|
||||
std::vector<RimPlotAxisPropertiesInterface*> axisProps;
|
||||
for ( const auto& ap : m_axisProperties )
|
||||
{
|
||||
if ( RiaDefines::isVertical( ap->plotAxisType().axis() ) ) axisProps.push_back( ap );
|
||||
}
|
||||
|
||||
return axisProps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -150,6 +150,7 @@ public:
|
||||
void updateCurveNames();
|
||||
|
||||
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||
void copyAxisPropertiesFromOther( RiaDefines::PlotAxis plotAxisType, const RimSummaryPlot& sourceSummaryPlot );
|
||||
void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||
|
||||
void updateAll();
|
||||
@@ -196,6 +197,7 @@ public:
|
||||
std::vector<RimSummaryCurve*> allCurves( RimSummaryDataSourceStepping::Axis axis ) const override;
|
||||
|
||||
std::vector<RimPlotAxisPropertiesInterface*> plotAxes() const;
|
||||
std::vector<RimPlotAxisPropertiesInterface*> plotYAxes() const;
|
||||
|
||||
RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const;
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
{
|
||||
summaryMultiPlot->updatePlots();
|
||||
summaryMultiPlot->updatePlotWindowTitle();
|
||||
summaryMultiPlot->zoomAll();
|
||||
summaryMultiPlot->zoomAllYAxes();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateMultiPlotToolBar();
|
||||
}
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiDateEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiTimeEditor.h"
|
||||
#include "cafPdmUiTreeAttributes.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@@ -163,6 +165,28 @@ caf::FontTools::FontSize RimSummaryTimeAxisProperties::plotFontSize() const
|
||||
return RiaPreferences::current()->defaultPlotFontSize();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
RimSummaryMultiPlot* summaryMultiPlot = nullptr;
|
||||
firstAncestorOfType( summaryMultiPlot );
|
||||
|
||||
if ( summaryMultiPlot && summaryMultiPlot->isTimeAxisLinked() )
|
||||
{
|
||||
auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute );
|
||||
if ( treeItemAttribute )
|
||||
{
|
||||
treeItemAttribute->tags.clear();
|
||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
||||
tag->icon = caf::IconProvider( ":/chain.png" );
|
||||
|
||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -125,6 +125,9 @@ protected:
|
||||
void updateDateVisibleRange();
|
||||
caf::FontTools::FontSize plotFontSize() const;
|
||||
|
||||
private:
|
||||
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<TimeModeType>> m_timeMode;
|
||||
caf::PdmField<caf::AppEnum<TimeUnitType>> m_timeUnit;
|
||||
|
||||
Reference in New Issue
Block a user