mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#11859 Summary Plot: Missing legend curve name for Excel data
Remove virtual from RimPlotCurve::setTitle() Set curve name for an Ascii curve to custom Make the curve title obsolete
This commit is contained in:
parent
036ed8b70e
commit
6894149f8e
@ -180,11 +180,11 @@ std::vector<RimAsciiDataCurve*> RicPasteAsciiDataToSummaryPlotFeature::parseCurv
|
|||||||
curve->setValues( parser.columnInfo( i )->values );
|
curve->setValues( parser.columnInfo( i )->values );
|
||||||
if ( curvePrefix.isEmpty() )
|
if ( curvePrefix.isEmpty() )
|
||||||
{
|
{
|
||||||
curve->setTitle( QString::fromStdString( col->columnName() ) );
|
curve->setCustomName( QString::fromStdString( col->columnName() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curve->setTitle( QString( "%1: %2" ).arg( curvePrefix ).arg( QString::fromStdString( col->columnName() ) ) );
|
curve->setCustomName( QString( "%1: %2" ).arg( curvePrefix ).arg( QString::fromStdString( col->columnName() ) ) );
|
||||||
}
|
}
|
||||||
// Appearance
|
// Appearance
|
||||||
curve->setSymbol( parseOptions.curveSymbol );
|
curve->setSymbol( parseOptions.curveSymbol );
|
||||||
|
@ -789,6 +789,9 @@ void RimPlotCurve::updateLegendsInPlot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setTitle( const QString& title )
|
void RimPlotCurve::setTitle( const QString& title )
|
||||||
{
|
{
|
||||||
if ( m_plotCurve ) m_plotCurve->setTitle( title );
|
if ( m_plotCurve ) m_plotCurve->setTitle( title );
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
virtual bool xValueRange( double* minimumValue, double* maximumValue ) const;
|
virtual bool xValueRange( double* minimumValue, double* maximumValue ) const;
|
||||||
virtual bool yValueRange( double* minimumValue, double* maximumValue ) const;
|
virtual bool yValueRange( double* minimumValue, double* maximumValue ) const;
|
||||||
|
|
||||||
virtual void setTitle( const QString& title );
|
void setTitle( const QString& title );
|
||||||
|
|
||||||
int dataSize() const;
|
int dataSize() const;
|
||||||
std::pair<double, double> sample( int index ) const;
|
std::pair<double, double> sample( int index ) const;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "RimAsciiDataCurve.h"
|
#include "RimAsciiDataCurve.h"
|
||||||
|
|
||||||
#include "RiaDefines.h"
|
#include "RiaDefines.h"
|
||||||
|
|
||||||
#include "RimEclipseResultCase.h"
|
#include "RimEclipseResultCase.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
@ -48,7 +49,7 @@ RimAsciiDataCurve::RimAsciiDataCurve()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values" );
|
CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values" );
|
||||||
m_values.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
m_values.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_title, "Title", "Title" );
|
CAF_PDM_InitFieldNoDefault( &m_title_OBSOLETE, "Title", "Title" );
|
||||||
|
|
||||||
setSymbolSkipDistance( 10.0f );
|
setSymbolSkipDistance( 10.0f );
|
||||||
setLineThickness( 2 );
|
setLineThickness( 2 );
|
||||||
@ -103,14 +104,6 @@ RiuPlotAxis RimAsciiDataCurve::yAxis() const
|
|||||||
return RiuPlotAxis( m_plotAxis() );
|
return RiuPlotAxis( m_plotAxis() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimAsciiDataCurve::createCurveAutoName()
|
|
||||||
{
|
|
||||||
return m_title();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -192,6 +185,23 @@ void RimAsciiDataCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
|
|||||||
uiOrdering.skipRemainingFields( true );
|
uiOrdering.skipRemainingFields( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimAsciiDataCurve::initAfterRead()
|
||||||
|
{
|
||||||
|
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2024.09.2" ) &&
|
||||||
|
( m_namingMethod() == RiaDefines::ObjectNamingMethod::AUTO ) )
|
||||||
|
{
|
||||||
|
setCustomName( m_title_OBSOLETE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use default curve name defined in base class. CUSTOM is the only valid naming method for this class, see calculateValueOptions()
|
||||||
|
setCustomName( createCurveAutoName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -216,14 +226,6 @@ void RimAsciiDataCurve::setValues( const std::vector<double>& values )
|
|||||||
m_values = values;
|
m_values = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimAsciiDataCurve::setTitle( const QString& title )
|
|
||||||
{
|
|
||||||
m_title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -256,3 +258,17 @@ void RimAsciiDataCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
|||||||
plot->updateAxes();
|
plot->updateAxes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RimAsciiDataCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
if ( fieldNeedingOptions == &m_namingMethod )
|
||||||
|
{
|
||||||
|
options.push_back( caf::PdmOptionItemInfo( caf::AppEnum<RiaDefines::ObjectNamingMethod>::uiText( RiaDefines::ObjectNamingMethod::CUSTOM ),
|
||||||
|
RiaDefines::ObjectNamingMethod::CUSTOM ) );
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
@ -53,20 +53,17 @@ public:
|
|||||||
|
|
||||||
void setTimeSteps( const std::vector<QDateTime>& timeSteps );
|
void setTimeSteps( const std::vector<QDateTime>& timeSteps );
|
||||||
void setValues( const std::vector<double>& values );
|
void setValues( const std::vector<double>& values );
|
||||||
void setTitle( const QString& title ) override;
|
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
// RimPlotCurve overrides
|
|
||||||
|
|
||||||
QString createCurveAutoName() override;
|
|
||||||
void updateZoomInParentPlot() override;
|
void updateZoomInParentPlot() override;
|
||||||
void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
|
void initAfterRead() override;
|
||||||
|
|
||||||
private:
|
|
||||||
bool curveData( std::vector<QDateTime>* timeSteps, std::vector<double>* values ) const;
|
bool curveData( std::vector<QDateTime>* timeSteps, std::vector<double>* values ) const;
|
||||||
|
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Fields
|
// Fields
|
||||||
@ -74,5 +71,5 @@ private:
|
|||||||
|
|
||||||
caf::PdmField<std::vector<QDateTime>> m_timeSteps;
|
caf::PdmField<std::vector<QDateTime>> m_timeSteps;
|
||||||
caf::PdmField<std::vector<double>> m_values;
|
caf::PdmField<std::vector<double>> m_values;
|
||||||
caf::PdmField<QString> m_title;
|
caf::PdmField<QString> m_title_OBSOLETE;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user