#6497 Fix legends in Summary preview and clean up plot titles

This commit is contained in:
Gaute Lindkvist 2020-09-16 13:22:16 +02:00 committed by Magne Sjaastad
parent 409db46ab3
commit a3161047af
20 changed files with 89 additions and 131 deletions

View File

@ -900,7 +900,7 @@ void RicSummaryPlotEditorUi::selectionEditorFieldChanged()
void RicSummaryPlotEditorUi::proxyEnablePlotAutoTitle( const bool& enable )
{
m_previewPlot->enableAutoPlotTitle( enable );
m_previewPlot->setShowPlotTitle( enable );
m_previewPlot->setPlotTitleVisible( enable );
m_previewPlot->updateCurveNames();
m_previewPlot->loadDataAndUpdate();
}

View File

@ -114,10 +114,6 @@ RimAnalysisPlot::RimAnalysisPlot()
CAF_PDM_InitFieldNoDefault( &m_referenceCase, "ReferenceCase", "Reference Case", "", "", "" );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Title", "", "", "" );
m_showPlotTitle.xmlCapability()->setIOWritable( false );
m_showPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto", "", "", "" );
m_useAutoPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
@ -1650,7 +1646,7 @@ void RimAnalysisPlot::updatePlotTitle()
{
QString plotTitle = description();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
m_plotWidget->scheduleReplot();
}
}

View File

@ -199,7 +199,6 @@ private:
caf::PdmPtrField<RimSummaryCase*> m_referenceCase;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;

View File

@ -50,7 +50,6 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step", "", "", "" );
m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitField( &m_useAutoPlotTitle, "AutoTitle", true, "Automatic Plot Title", "", "", "" );
CAF_PDM_InitField( &m_description, "PlotTitle", QString( "Correlation Plot" ), "Custom Plot Title", "", "", "" );

View File

@ -135,7 +135,6 @@ protected:
caf::PdmField<TimeStepFilterEnum> m_timeStepFilter;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;

View File

@ -661,7 +661,7 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
if ( m_plotWidget )
{
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
if ( isMdiWindow() )
{
m_plotWidget->setPlotTitleFontSize( titleFontSize() );

View File

@ -296,12 +296,8 @@ void RimCorrelationPlot::updatePlotTitle()
.arg( timeStepString() );
}
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
if ( isMdiWindow() )
{
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -307,10 +307,6 @@ void RimParameterResultCrossPlot::updatePlotTitle()
.arg( timeStepString() );
}
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
if ( isMdiWindow() )
{
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}

View File

@ -100,9 +100,6 @@ RimWellPltPlot::RimWellPltPlot()
{
CAF_PDM_InitObject( "Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "" );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "" );
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true );
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
@ -1034,11 +1031,6 @@ void RimWellPltPlot::initAfterRead()
m_wellLogPlot_OBSOLETE = nullptr;
}
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
{
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();
// Postpone init until data has been loaded

View File

@ -114,8 +114,6 @@ private:
void updateFormationsOnPlot() const;
private:
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<QString> m_wellPathName;
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;

View File

@ -83,9 +83,6 @@ RimWellRftPlot::RimWellRftPlot()
{
CAF_PDM_InitObject( "RFT Plot", ":/RFTPlot16x16.png", "", "" );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", "" );
CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", "" );
CAF_PDM_InitField( &m_showErrorInObservedData, "ShowErrorObserved", true, "Show Observed Data Error", "", "", "" );
@ -911,11 +908,6 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
updateFormationsOnPlot();
syncCurvesFromUiSelection();
}
else if ( changedField == &m_showPlotWindowTitle )
{
// m_wellLogPlot->setShowDescription(m_showPlotTitle);
}
}
//--------------------------------------------------------------------------------------------------
@ -1108,10 +1100,6 @@ void RimWellRftPlot::initAfterRead()
delete m_wellLogPlot_OBSOLETE;
m_wellLogPlot_OBSOLETE = nullptr;
}
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
{
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();
}

View File

@ -161,6 +161,5 @@ private:
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
bool m_isOnLoad;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
};

View File

@ -648,7 +648,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
{
QString plotTitle = this->createAutoName();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
}
updateMdiWindowTitle();
}
@ -774,7 +774,7 @@ void RimGridCrossPlot::updateLegend()
{
if ( m_plotWidget )
{
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() );
m_plotWidget->setLegendFontSize( legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{

View File

@ -86,7 +86,7 @@ RimDepthTrackPlot::RimDepthTrackPlot()
m_commonDataSource.xmlCapability()->disableIO();
m_commonDataSource = new RimWellLogCurveCommonDataSource;
CAF_PDM_InitScriptableField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" );
CAF_PDM_InitScriptableField( &m_showPlotWindowTitle_OBSOLETE, "ShowTitleInPlot", true, "Show Title", "", "", "" );
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" );
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
@ -148,6 +148,48 @@ RimDepthTrackPlot::~RimDepthTrackPlot()
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
/// Move-assignment operator. Argument has to be passed with std::move()
//--------------------------------------------------------------------------------------------------
RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
// Move all tracks
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( RimPlot* plot : plots )
{
m_plots.push_back( plot );
}
// Deliberately don't set m_plotWindowTitle and m_nameConfig. This operator is used for copying parameters from
// children. This only happens for some plots that used to own a plot but now inherits the plot.
// They had their own description at top level which we don't want to overwrite.
m_showPlotWindowTitle_OBSOLETE = rhs.m_showPlotWindowTitle_OBSOLETE;
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject( dataSource );
m_commonDataSource = dataSource;
m_commonDataSourceEnabled = rhs.m_commonDataSourceEnabled;
m_depthType = rhs.m_depthType();
m_depthUnit = rhs.m_depthUnit();
m_minVisibleDepth = rhs.m_minVisibleDepth();
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
m_subTitleFontSize = rhs.m_subTitleFontSize();
m_axisTitleFontSize = rhs.m_axisTitleFontSize();
m_axisValueFontSize = rhs.m_axisValueFontSize();
m_minAvailableDepth = rhs.m_minAvailableDepth;
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -172,22 +214,6 @@ QString RimDepthTrackPlot::description() const
return m_plotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimDepthTrackPlot::isPlotTitleVisible() const
{
return m_showPlotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::setPlotTitleVisible( bool visible )
{
m_showPlotWindowTitle = visible;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -425,7 +451,7 @@ void RimDepthTrackPlot::uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUi
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotWindowTitle );
uiOrdering.add( &m_showPlotTitle );
m_nameConfig->uiOrdering( uiConfigName, uiOrdering );
}
@ -559,7 +585,7 @@ void RimDepthTrackPlot::performAutoNameUpdate()
m_plotWindowTitle = createAutoName();
if ( m_viewer )
{
m_viewer->setTitleVisible( m_showPlotWindowTitle() );
m_viewer->setTitleVisible( m_showPlotTitle() );
m_viewer->setPlotTitle( m_plotWindowTitle );
}
updateMdiWindowTitle();
@ -826,7 +852,7 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
{
updateFonts();
}
else if ( changedField == &m_showPlotWindowTitle )
else if ( changedField == &m_showPlotTitle )
{
performAutoNameUpdate();
}
@ -910,6 +936,11 @@ void RimDepthTrackPlot::initAfterRead()
m_depthAxisGridVisibility = AXIS_GRID_MAJOR_AND_MINOR;
}
if ( !m_showPlotWindowTitle_OBSOLETE() )
{
m_showPlotTitle = false;
}
if ( !m_plotWindowTitle().isEmpty() )
{
m_nameConfig->setCustomName( m_plotWindowTitle );

View File

@ -63,13 +63,12 @@ public:
RimDepthTrackPlot();
~RimDepthTrackPlot() override;
RimDepthTrackPlot& operator=( RimDepthTrackPlot&& rhs );
QWidget* viewWidget() override;
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
QString description() const override;
bool isPlotTitleVisible() const;
void setPlotTitleVisible( bool visible );
void addPlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index );
void removePlot( RimPlot* plot );
@ -161,7 +160,7 @@ protected:
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
bool m_commonDataSourceEnabled;
caf::PdmField<bool> m_showPlotWindowTitle;
caf::PdmField<bool> m_showPlotWindowTitle_OBSOLETE;
caf::PdmField<QString> m_plotWindowTitle;
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;

View File

@ -52,6 +52,7 @@ RimPlotWindow::RimPlotWindow()
m_id.capability<caf::PdmAbstractFieldScriptingCapability>()->setIOWriteable( false );
m_id.xmlCapability()->setCopyable( false );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
@ -83,6 +84,7 @@ int RimPlotWindow::id() const
//--------------------------------------------------------------------------------------------------
RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
{
m_showPlotTitle = rhs.m_showPlotTitle();
m_showPlotLegends = rhs.m_showPlotLegends();
m_plotLegendsHorizontal = rhs.m_plotLegendsHorizontal();
m_titleFontSize = rhs.m_titleFontSize();
@ -90,6 +92,22 @@ RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotWindow::plotTitleVisible() const
{
return m_showPlotTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setPlotTitleVisible( bool showPlotTitle )
{
m_showPlotTitle = showPlotTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -50,6 +50,9 @@ public:
RimPlotWindow& operator=( RimPlotWindow&& rhs );
bool plotTitleVisible() const;
void setPlotTitleVisible( bool showPlotTitle );
virtual QString description() const = 0;
bool legendsVisible() const;
void setLegendsVisible( bool doShow );
@ -94,6 +97,7 @@ private:
protected:
caf::PdmField<int> m_id;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_showPlotLegends;
caf::PdmField<bool> m_plotLegendsHorizontal;

View File

@ -76,38 +76,6 @@ RimWellLogPlot::~RimWellLogPlot()
//--------------------------------------------------------------------------------------------------
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
// Move all tracks
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( RimPlot* plot : plots )
{
m_plots.push_back( plot );
}
// Deliberately don't set m_plotWindowTitle. This operator is used for copying parameters from children.
// This only happens for some plots that used to own a plot but now inherits the plot.
// These all had their own description at top level which we don't want to overwrite.
m_showPlotWindowTitle = rhs.m_showPlotWindowTitle;
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject( dataSource );
m_commonDataSource = dataSource;
m_depthType = rhs.m_depthType();
m_depthUnit = rhs.m_depthUnit();
m_minVisibleDepth = rhs.m_minVisibleDepth();
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
// Deliberately don't copy m_nameConfig. This operator is used for copying parameters from children.
// This only happens for some plots that used to own a plot but now inherits the plot.
// These all had their own description at top level which we don't want to overwrite.
m_minAvailableDepth = rhs.m_minAvailableDepth;
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
RimDepthTrackPlot::operator=( std::move( rhs ) );
return *this;
}

View File

@ -146,13 +146,8 @@ RimSummaryPlot::RimSummaryPlot()
{
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
CAF_PDM_InitScriptableField( &m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "" );
m_showPlotTitle.xmlCapability()->setIOWritable( false );
CAF_PDM_InitScriptableField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title", "", "", "" );
CAF_PDM_InitScriptableField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name", "", "", "" );
CAF_PDM_InitScriptableField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "", "", "", "" );
@ -235,22 +230,6 @@ RimSummaryPlot::~RimSummaryPlot()
delete m_ensembleCurveSetCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlot::showPlotTitle() const
{
return m_showPlotTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setShowPlotTitle( bool showTitle )
{
m_showPlotTitle = showTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -609,7 +588,7 @@ void RimSummaryPlot::updatePlotTitle()
{
QString plotTitle = description();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
m_plotWidget->scheduleReplot();
}
}
@ -677,7 +656,7 @@ void RimSummaryPlot::updateLegend()
{
if ( m_plotWidget )
{
m_plotWidget->setLegendVisible( m_showPlotLegends && isMdiWindow() );
m_plotWidget->setLegendVisible( m_showPlotLegends );
}
reattachAllCurves();
@ -1580,7 +1559,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
if ( m_plotWidget )
{
m_plotWidget->setLegendVisible( m_showPlotLegends && isMdiWindow() );
m_plotWidget->setLegendVisible( m_showPlotLegends );
m_plotWidget->setLegendFontSize( legendFontSize() );
m_plotWidget->updateLegend();
}

View File

@ -73,8 +73,6 @@ public:
RimSummaryPlot();
~RimSummaryPlot() override;
bool showPlotTitle() const;
void setShowPlotTitle( bool showTitle );
void setDescription( const QString& description );
QString description() const override;
@ -251,7 +249,6 @@ private:
private:
caf::PdmField<bool> m_normalizeCurveYValues;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;