mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8844 Summary Multi Plot : Optional auto appearance settings
This commit is contained in:
parent
73d598ee7e
commit
774538868a
@ -27,6 +27,7 @@
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
#include "RimSummaryAddressModifier.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
@ -39,80 +40,6 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForObjectsFeature, "RicAppendSummaryPlotsForObjectsFeature" );
|
||||
|
||||
class SummaryAdrModifier
|
||||
{
|
||||
public:
|
||||
SummaryAdrModifier( RimSummaryCurve* curve )
|
||||
: m_curve( curve )
|
||||
, m_curveSet( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
SummaryAdrModifier( RimEnsembleCurveSet* curveSet )
|
||||
: m_curve( nullptr )
|
||||
, m_curveSet( curveSet )
|
||||
{
|
||||
}
|
||||
|
||||
static std::vector<SummaryAdrModifier> createAddressModifiersForPlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
std::vector<SummaryAdrModifier> mods;
|
||||
if ( summaryPlot )
|
||||
{
|
||||
auto curveSets = summaryPlot->curveSets();
|
||||
for ( auto curveSet : curveSets )
|
||||
{
|
||||
mods.emplace_back( SummaryAdrModifier( curveSet ) );
|
||||
}
|
||||
|
||||
auto curves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS );
|
||||
for ( auto c : curves )
|
||||
{
|
||||
mods.emplace_back( SummaryAdrModifier( c ) );
|
||||
}
|
||||
}
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
static std::vector<RifEclipseSummaryAddress> createEclipseSummaryAddress( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
auto mods = createAddressModifiersForPlot( summaryPlot );
|
||||
return convertToEclipseSummaryAddress( mods );
|
||||
}
|
||||
|
||||
RifEclipseSummaryAddress address() const
|
||||
{
|
||||
if ( m_curve ) return m_curve->summaryAddressY();
|
||||
if ( m_curveSet ) return m_curveSet->summaryAddress();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void setAddress( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
if ( m_curve ) m_curve->setSummaryAddressY( address );
|
||||
if ( m_curveSet ) m_curveSet->setSummaryAddress( address );
|
||||
}
|
||||
|
||||
private:
|
||||
static std::vector<RifEclipseSummaryAddress>
|
||||
convertToEclipseSummaryAddress( const std::vector<SummaryAdrModifier>& modifiers )
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> tmp;
|
||||
tmp.reserve( modifiers.size() );
|
||||
for ( const auto& m : modifiers )
|
||||
{
|
||||
tmp.emplace_back( m.address() );
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private:
|
||||
RimSummaryCurve* m_curve;
|
||||
RimEnsembleCurveSet* m_curveSet;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -149,7 +76,7 @@ void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked )
|
||||
auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance );
|
||||
for ( auto duplicatedPlot : duplicatedPlots )
|
||||
{
|
||||
auto adrMods = SummaryAdrModifier::createAddressModifiersForPlot( duplicatedPlot );
|
||||
auto adrMods = RimSummaryAddressModifier::createAddressModifiersForPlot( duplicatedPlot );
|
||||
for ( auto adrMod : adrMods )
|
||||
{
|
||||
auto sourceAddress = adrMod.address();
|
||||
@ -246,7 +173,7 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot(
|
||||
|
||||
for ( auto plot : plotsForObjectType )
|
||||
{
|
||||
auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( plot );
|
||||
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( plot );
|
||||
analyzer.appendAddresses( addresses );
|
||||
}
|
||||
}
|
||||
@ -339,7 +266,7 @@ std::vector<RimSummaryPlot*> RicAppendSummaryPlotsForObjectsFeature::plotsForOne
|
||||
RiaSummaryAddressAnalyzer myAnalyser;
|
||||
for ( auto sourcePlot : sourcePlots )
|
||||
{
|
||||
auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( sourcePlot );
|
||||
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot );
|
||||
myAnalyser.appendAddresses( addresses );
|
||||
}
|
||||
|
||||
@ -358,7 +285,7 @@ std::vector<RimSummaryPlot*> RicAppendSummaryPlotsForObjectsFeature::plotsForOne
|
||||
|
||||
for ( auto sourcePlot : sourcePlots )
|
||||
{
|
||||
auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( sourcePlot );
|
||||
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot );
|
||||
|
||||
bool isMatching = false;
|
||||
for ( const auto& a : addresses )
|
||||
|
@ -304,6 +304,14 @@ bool RimPlotAxisProperties::useAutoTitle() const
|
||||
return isAutoTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setShowDescription( bool enable )
|
||||
{
|
||||
m_displayLongName = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -312,6 +320,14 @@ bool RimPlotAxisProperties::showDescription() const
|
||||
return m_displayLongName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setShowAcronym( bool enable )
|
||||
{
|
||||
m_displayShortName = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -320,6 +336,14 @@ bool RimPlotAxisProperties::showAcronym() const
|
||||
return m_displayShortName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setShowUnitText( bool enable )
|
||||
{
|
||||
m_displayUnitText = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -400,6 +424,32 @@ void RimPlotAxisProperties::setShowNumbers( bool enable )
|
||||
m_showNumbers = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setVisible( bool visible )
|
||||
{
|
||||
m_isActive = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::computeAndSetScaleFactor()
|
||||
{
|
||||
int exponent = std::log10( visibleRangeMax() );
|
||||
|
||||
while ( exponent > 0 && ( exponent % 3 ) != 0 )
|
||||
{
|
||||
exponent--;
|
||||
}
|
||||
|
||||
if ( exponent > 0 )
|
||||
{
|
||||
scaleFactor = std::pow( 10, exponent );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -70,15 +70,25 @@ public:
|
||||
const QString& name() const override;
|
||||
RiuPlotAxis plotAxisType() const override;
|
||||
bool useAutoTitle() const;
|
||||
bool showDescription() const;
|
||||
bool showAcronym() const;
|
||||
bool showUnitText() const;
|
||||
bool isAutoZoom() const override;
|
||||
void setAutoZoom( bool enableAutoZoom ) override;
|
||||
bool isAxisInverted() const override;
|
||||
void setAxisInverted( bool inverted );
|
||||
bool showNumbers() const;
|
||||
void setShowNumbers( bool enable );
|
||||
|
||||
void setShowDescription( bool enable );
|
||||
bool showDescription() const;
|
||||
|
||||
void setShowAcronym( bool enable );
|
||||
bool showAcronym() const;
|
||||
|
||||
void setShowUnitText( bool enable );
|
||||
bool showUnitText() const;
|
||||
|
||||
bool isAutoZoom() const override;
|
||||
void setAutoZoom( bool enableAutoZoom ) override;
|
||||
bool isAxisInverted() const override;
|
||||
void setAxisInverted( bool inverted );
|
||||
bool showNumbers() const;
|
||||
void setShowNumbers( bool enable );
|
||||
|
||||
void setVisible( bool visible );
|
||||
void computeAndSetScaleFactor();
|
||||
|
||||
bool isDeletable() const override;
|
||||
|
||||
|
@ -46,6 +46,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressModifier.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -96,6 +97,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressModifier.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSummaryAddressModifier.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryAddressModifier::RimSummaryAddressModifier( RimSummaryCurve* curve )
|
||||
: m_curve( curve )
|
||||
, m_curveSet( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryAddressModifier::RimSummaryAddressModifier( RimEnsembleCurveSet* curveSet )
|
||||
: m_curve( nullptr )
|
||||
, m_curveSet( curveSet )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryAddressModifier> RimSummaryAddressModifier::createAddressModifiersForPlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
std::vector<RimSummaryAddressModifier> mods;
|
||||
if ( summaryPlot )
|
||||
{
|
||||
auto curveSets = summaryPlot->curveSets();
|
||||
for ( auto curveSet : curveSets )
|
||||
{
|
||||
mods.emplace_back( RimSummaryAddressModifier( curveSet ) );
|
||||
}
|
||||
|
||||
auto curves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS );
|
||||
for ( auto c : curves )
|
||||
{
|
||||
mods.emplace_back( RimSummaryAddressModifier( c ) );
|
||||
}
|
||||
}
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifEclipseSummaryAddress> RimSummaryAddressModifier::createEclipseSummaryAddress( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
auto mods = createAddressModifiersForPlot( summaryPlot );
|
||||
return convertToEclipseSummaryAddress( mods );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RimSummaryAddressModifier::address() const
|
||||
{
|
||||
if ( m_curve ) return m_curve->summaryAddressY();
|
||||
if ( m_curveSet ) return m_curveSet->summaryAddress();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAddressModifier::setAddress( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
if ( m_curve ) m_curve->setSummaryAddressY( address );
|
||||
if ( m_curveSet ) m_curveSet->setSummaryAddress( address );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifEclipseSummaryAddress>
|
||||
RimSummaryAddressModifier::convertToEclipseSummaryAddress( const std::vector<RimSummaryAddressModifier>& modifiers )
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> tmp;
|
||||
tmp.reserve( modifiers.size() );
|
||||
for ( const auto& m : modifiers )
|
||||
{
|
||||
tmp.emplace_back( m.address() );
|
||||
}
|
||||
return tmp;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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
|
||||
|
||||
class RimSummaryCurve;
|
||||
class RimEnsembleCurveSet;
|
||||
class RimSummaryPlot;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryAddressModifier
|
||||
{
|
||||
public:
|
||||
RimSummaryAddressModifier( RimSummaryCurve* curve );
|
||||
RimSummaryAddressModifier( RimEnsembleCurveSet* curveSet );
|
||||
|
||||
static std::vector<RimSummaryAddressModifier> createAddressModifiersForPlot( RimSummaryPlot* summaryPlot );
|
||||
static std::vector<RifEclipseSummaryAddress> createEclipseSummaryAddress( RimSummaryPlot* summaryPlot );
|
||||
|
||||
RifEclipseSummaryAddress address() const;
|
||||
void setAddress( const RifEclipseSummaryAddress& address );
|
||||
|
||||
private:
|
||||
static std::vector<RifEclipseSummaryAddress>
|
||||
convertToEclipseSummaryAddress( const std::vector<RimSummaryAddressModifier>& modifiers );
|
||||
|
||||
private:
|
||||
RimSummaryCurve* m_curve;
|
||||
RimEnsembleCurveSet* m_curveSet;
|
||||
};
|
@ -1026,6 +1026,16 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::setDefaultCurveAppearance()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot ) plot->applyDefaultCurveAppearances( { this } );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
|
||||
QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const override;
|
||||
void setCurveAppearanceFromCaseType();
|
||||
void setDefaultCurveAppearance();
|
||||
|
||||
void setAsTopZWithinCategory( bool enable );
|
||||
void setZIndexFromCurveInfo();
|
||||
|
@ -31,8 +31,10 @@
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimMultipleSummaryPlotNameHelper.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryAddressModifier.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
@ -40,6 +42,7 @@
|
||||
#include "RimSummaryPlotControls.h"
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
#include "RimSummaryPlotSourceStepping.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiuSummaryMultiPlotBook.h"
|
||||
#include "RiuSummaryVectorSelectionUi.h"
|
||||
@ -69,6 +72,23 @@ void AppEnum<RimSummaryMultiPlot::AxisRangeAggregation>::setUp()
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::setLayoutInfo( RimSummaryPlot* summaryPlot, int row, int col )
|
||||
{
|
||||
m_gridLayoutInfo[summaryPlot] = std::make_pair( row, col );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::clearLayoutInfo()
|
||||
{
|
||||
m_gridLayoutInfo.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -92,9 +112,12 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
|
||||
CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" );
|
||||
|
||||
m_sourceStepping = new RimSummaryPlotSourceStepping;
|
||||
m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS );
|
||||
m_sourceStepping->setSourceSteppingObject( this );
|
||||
@ -310,7 +333,12 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
|
||||
auto axesGroup = uiOrdering.addNewGroup( "Axes" );
|
||||
axesGroup->add( &m_axisRangeAggregation );
|
||||
|
||||
axesGroup->add( &m_linkSubPlotAxes );
|
||||
axesGroup->add( &m_autoAdjustAppearance );
|
||||
|
||||
m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() );
|
||||
if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false;
|
||||
|
||||
auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" );
|
||||
m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup );
|
||||
@ -339,6 +367,10 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
m_createPlotDuplicate = false;
|
||||
duplicate();
|
||||
}
|
||||
else if ( changedField == &m_autoAdjustAppearance )
|
||||
{
|
||||
checkAndApplyAutoAppearance();
|
||||
}
|
||||
else
|
||||
{
|
||||
RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
@ -516,6 +548,16 @@ void RimSummaryMultiPlot::initAfterRead()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
RimMultiPlot::onLoadDataAndUpdate();
|
||||
|
||||
checkAndApplyAutoAppearance();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -524,6 +566,18 @@ void RimSummaryMultiPlot::zoomAll()
|
||||
syncAxisRanges();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::checkAndApplyAutoAppearance()
|
||||
{
|
||||
if ( m_autoAdjustAppearance )
|
||||
{
|
||||
analyzePlotsAndAdjustAppearanceSettings();
|
||||
syncAxisRanges();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -778,6 +832,62 @@ void RimSummaryMultiPlot::duplicate()
|
||||
duplicatePlot.send( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings()
|
||||
{
|
||||
RiaSummaryAddressAnalyzer analyzer;
|
||||
|
||||
for ( auto p : summaryPlots() )
|
||||
{
|
||||
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( p );
|
||||
analyzer.appendAddresses( addresses );
|
||||
}
|
||||
|
||||
bool hasOnlyOneQuantity = analyzer.quantities().size() == 1;
|
||||
|
||||
for ( auto p : summaryPlots() )
|
||||
{
|
||||
auto timeAxisProp = p->timeAxisProperties();
|
||||
|
||||
if ( columnCount() < 3 )
|
||||
timeAxisProp->setMajorTickmarkCount( RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_DEFAULT );
|
||||
else
|
||||
timeAxisProp->setMajorTickmarkCount( RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_FEW );
|
||||
|
||||
for ( RimPlotAxisPropertiesInterface* axisInterface : p->plotAxes() )
|
||||
{
|
||||
auto axisProp = dynamic_cast<RimPlotAxisProperties*>( axisInterface );
|
||||
|
||||
if ( !axisProp ) continue;
|
||||
|
||||
if ( rowsPerPage() == 1 )
|
||||
axisProp->setMajorTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT );
|
||||
else
|
||||
axisProp->setMajorTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW );
|
||||
|
||||
axisProp->computeAndSetScaleFactor();
|
||||
|
||||
if ( hasOnlyOneQuantity )
|
||||
{
|
||||
// Disable sub plot linking to be able to configure individually
|
||||
setSubPlotAxesLinked( false );
|
||||
|
||||
axisProp->setShowDescription( false );
|
||||
|
||||
auto [row, col] = gridLayoutInfoForSubPlot( p );
|
||||
if ( col == 0 )
|
||||
axisProp->setShowUnitText( true );
|
||||
else
|
||||
axisProp->setShowUnitText( false );
|
||||
}
|
||||
}
|
||||
|
||||
p->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -786,6 +896,14 @@ void RimSummaryMultiPlot::makeSureIsVisible( RimSummaryPlot* summaryPlot )
|
||||
if ( summaryPlot->plotWidget() && !m_viewer.isNull() ) m_viewer->scrollToPlot( summaryPlot->plotWidget() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::setSubPlotAxesLinked( bool enable )
|
||||
{
|
||||
m_linkSubPlotAxes = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -794,6 +912,17 @@ bool RimSummaryMultiPlot::isSubPlotAxesLinked() const
|
||||
return m_linkSubPlotAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, int> RimSummaryMultiPlot::gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const
|
||||
{
|
||||
auto it = m_gridLayoutInfo.find( summaryPlot );
|
||||
if ( it != m_gridLayoutInfo.end() ) return it->second;
|
||||
|
||||
return { -1, -1 };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,6 +62,9 @@ public:
|
||||
|
||||
const RimSummaryNameHelper* nameHelper() const;
|
||||
|
||||
void setLayoutInfo( RimSummaryPlot* summaryPlot, int row, int col );
|
||||
void clearLayoutInfo();
|
||||
|
||||
void setAutoTitlePlot( bool enable );
|
||||
void setAutoTitleGraphs( bool enable );
|
||||
|
||||
@ -90,15 +93,21 @@ public:
|
||||
|
||||
void makeSureIsVisible( RimSummaryPlot* plot );
|
||||
|
||||
void setSubPlotAxesLinked( bool enable );
|
||||
bool isSubPlotAxesLinked() const;
|
||||
|
||||
std::pair<int, int> gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const;
|
||||
|
||||
void zoomAll() override;
|
||||
|
||||
void checkAndApplyAutoAppearance();
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
|
||||
|
||||
void initAfterRead() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
|
||||
@ -112,6 +121,8 @@ private:
|
||||
|
||||
void duplicate();
|
||||
|
||||
void analyzePlotsAndAdjustAppearanceSettings();
|
||||
|
||||
void onSubPlotChanged( const caf::SignalEmitter* emitter );
|
||||
void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot );
|
||||
|
||||
@ -121,10 +132,13 @@ private:
|
||||
caf::PdmField<bool> m_disableWheelZoom;
|
||||
caf::PdmField<bool> m_createPlotDuplicate;
|
||||
caf::PdmField<bool> m_linkSubPlotAxes;
|
||||
caf::PdmField<bool> m_autoAdjustAppearance;
|
||||
|
||||
caf::PdmField<caf::AppEnum<AxisRangeAggregation>> m_axisRangeAggregation;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_sourceStepping;
|
||||
|
||||
std::unique_ptr<RimSummaryPlotNameHelper> m_nameHelper;
|
||||
|
||||
std::map<RimSummaryPlot*, std::pair<int, int>> m_gridLayoutInfo;
|
||||
};
|
||||
|
@ -758,16 +758,7 @@ size_t RimSummaryPlot::singleColorCurveCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::applyDefaultCurveAppearances()
|
||||
{
|
||||
std::set<RiaSummaryCurveDefinition> allCurveDefs = this->summaryAndEnsembleCurveDefinitions();
|
||||
|
||||
RimSummaryCurveAppearanceCalculator curveLookCalc( allCurveDefs );
|
||||
|
||||
// Summary curves
|
||||
for ( auto& curve : this->summaryCurves() )
|
||||
{
|
||||
curve->resetAppearance();
|
||||
curveLookCalc.setupCurveLook( curve );
|
||||
}
|
||||
applyDefaultCurveAppearances( summaryCurves() );
|
||||
|
||||
// Ensemble curve sets
|
||||
int colorIndex = 0;
|
||||
@ -783,13 +774,7 @@ void RimSummaryPlot::applyDefaultCurveAppearances()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate )
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> allCurveDefs;
|
||||
|
||||
for ( const auto& curve : this->summaryAndEnsembleCurves() )
|
||||
{
|
||||
allCurveDefs.emplace_back( curve->summaryCaseY(), curve->summaryAddressY(), curve->isEnsembleCurve() );
|
||||
}
|
||||
|
||||
std::set<RiaSummaryCurveDefinition> allCurveDefs = this->summaryAndEnsembleCurveDefinitions();
|
||||
RimSummaryCurveAppearanceCalculator curveLookCalc( allCurveDefs );
|
||||
|
||||
for ( auto& curve : curvesToUpdate )
|
||||
|
@ -164,6 +164,7 @@ public:
|
||||
|
||||
size_t singleColorCurveCount() const;
|
||||
void applyDefaultCurveAppearances();
|
||||
void applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate );
|
||||
|
||||
void setNormalizationEnabled( bool enable );
|
||||
bool isNormalizationEnabled();
|
||||
@ -290,7 +291,6 @@ private:
|
||||
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryCaseDrop( RimSummaryCase* summaryCase );
|
||||
std::pair<int, std::vector<RimSummaryCurve*>> handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl );
|
||||
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryAddressDrop( RimSummaryAddress* summaryAddr );
|
||||
void applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate );
|
||||
|
||||
bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis );
|
||||
|
||||
|
@ -214,12 +214,12 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
size_t cutPos = sumAddress.quantityName().find( ':' );
|
||||
if ( cutPos == std::string::npos ) cutPos = -1;
|
||||
|
||||
std::string quantityNameForDisplay;
|
||||
std::string titleText;
|
||||
const std::string& quantityName = sumAddress.quantityName().substr( cutPos + 1 );
|
||||
|
||||
if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||
{
|
||||
quantityNameForDisplay = shortCalculationName( quantityName );
|
||||
titleText = shortCalculationName( quantityName );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -229,27 +229,25 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
|
||||
if ( sumAddress.isHistoryQuantity() ) candidateName = quantityName.substr( 0, quantityName.size() - 1 );
|
||||
|
||||
quantityNameForDisplay =
|
||||
RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( candidateName );
|
||||
titleText = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( candidateName );
|
||||
}
|
||||
|
||||
if ( m_axisProperties->showAcronym() )
|
||||
{
|
||||
if ( !quantityNameForDisplay.empty() )
|
||||
if ( !titleText.empty() )
|
||||
{
|
||||
quantityNameForDisplay += " (";
|
||||
quantityNameForDisplay += quantityName;
|
||||
quantityNameForDisplay += ")";
|
||||
titleText += " (";
|
||||
titleText += quantityName;
|
||||
titleText += ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
titleText += quantityName;
|
||||
}
|
||||
}
|
||||
|
||||
if ( quantityNameForDisplay.empty() )
|
||||
{
|
||||
quantityNameForDisplay = quantityName;
|
||||
}
|
||||
}
|
||||
|
||||
unitToQuantityNameMap[unitText].insert( quantityNameForDisplay );
|
||||
unitToQuantityNameMap[unitText].insert( titleText );
|
||||
};
|
||||
|
||||
for ( RimSummaryCurve* rimCurve : m_summaryCurves )
|
||||
|
@ -110,7 +110,7 @@ RimSummaryPlotManager::RimSummaryPlotManager()
|
||||
m_labelB.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() );
|
||||
m_labelB.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" );
|
||||
CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", true, "One plot per Object" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerObject );
|
||||
|
||||
CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" );
|
||||
@ -119,7 +119,7 @@ RimSummaryPlotManager::RimSummaryPlotManager()
|
||||
CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerDataSource );
|
||||
|
||||
CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", false, "Create Multiple Plots in One Window" );
|
||||
CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", true, "Create Multiple Plots in One Window" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_createMultiPlot );
|
||||
}
|
||||
|
||||
|
@ -470,6 +470,8 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr );
|
||||
curve->setSummaryAddressX( adr );
|
||||
}
|
||||
|
||||
curve->setDefaultCurveAppearance();
|
||||
}
|
||||
|
||||
if ( dataSourceSteppingObject() )
|
||||
|
@ -501,6 +501,10 @@ void RiuMultiPlotBook::performUpdate( bool regeneratePages )
|
||||
createPages();
|
||||
}
|
||||
updateGeometry();
|
||||
|
||||
RimSummaryMultiPlot* multiPlot = dynamic_cast<RimSummaryMultiPlot*>( m_plotDefinition.p() );
|
||||
if ( multiPlot ) multiPlot->checkAndApplyAutoAppearance();
|
||||
|
||||
// use a timer to trigger a viewer page change, if needed
|
||||
if ( m_goToPageAfterUpdate )
|
||||
{
|
||||
|
@ -56,6 +56,9 @@ void RiuSummaryMultiPlotBook::createPages()
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( m_plotDefinition.p() );
|
||||
if ( summaryMultiPlot ) summaryMultiPlot->clearLayoutInfo();
|
||||
|
||||
RiuSummaryMultiPlotPage* page = createSummaryPage();
|
||||
|
||||
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RiuSummaryMultiPlotPage.h"
|
||||
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuPlotWidget.h"
|
||||
#include "RiuQwtPlotLegend.h"
|
||||
@ -89,33 +90,36 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets()
|
||||
continue;
|
||||
}
|
||||
|
||||
int expectedColSpan = plotWidgets[visibleIndex]->colSpan();
|
||||
int colSpan = std::min( expectedColSpan, cols - col );
|
||||
auto plotWidget = plotWidgets[visibleIndex];
|
||||
int expectedColSpan = plotWidget->colSpan();
|
||||
int colSpan = std::min( expectedColSpan, cols - col );
|
||||
|
||||
m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, col, 1, colSpan );
|
||||
if ( legends[visibleIndex] )
|
||||
{
|
||||
m_gridLayout->addWidget( legends[visibleIndex], 3 * row + 1, col, 1, colSpan, Qt::AlignHCenter | Qt::AlignBottom );
|
||||
}
|
||||
m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, col, 1, colSpan );
|
||||
m_gridLayout->addWidget( plotWidget, 3 * row + 2, col, 1, colSpan );
|
||||
auto summaryPlot = dynamic_cast<RimSummaryPlot*>( plotWidget->plotDefinition() );
|
||||
if ( summaryPlot ) m_summaryMultiPlot->setLayoutInfo( summaryPlot, row, col );
|
||||
|
||||
subTitles[visibleIndex]->setVisible( m_showSubTitles );
|
||||
QFont subTitleFont = subTitles[visibleIndex]->font();
|
||||
subTitleFont.setPixelSize( m_subTitleFontPixelSize );
|
||||
subTitles[visibleIndex]->setFont( subTitleFont );
|
||||
|
||||
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(),
|
||||
showYAxis( row, col ),
|
||||
showYAxis( row, col ) );
|
||||
plotWidgets[visibleIndex]->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, col ) );
|
||||
plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
|
||||
plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(),
|
||||
showYAxis( row, col ),
|
||||
showYAxis( row, col ) );
|
||||
plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, col ) );
|
||||
plotWidget->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
|
||||
|
||||
// Adjust the space below a graph to make sure the heading of the row below is closest to the
|
||||
// corresponding graph
|
||||
auto margins = plotWidgets[visibleIndex]->contentsMargins();
|
||||
auto margins = plotWidget->contentsMargins();
|
||||
margins.setBottom( 40 );
|
||||
plotWidgets[visibleIndex]->setContentsMargins( margins );
|
||||
plotWidgets[visibleIndex]->show();
|
||||
plotWidget->setContentsMargins( margins );
|
||||
plotWidget->show();
|
||||
|
||||
if ( legends[visibleIndex] )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user