#7716 Ensemble Well Logs: improve legends appearance

Also remove some unused code.
This commit is contained in:
Kristian Bendiksen 2021-06-28 12:24:23 +02:00
parent cdec36a582
commit 6aa28bceb2
2 changed files with 29 additions and 95 deletions

View File

@ -42,17 +42,11 @@
#include "RiuAbstractLegendFrame.h" #include "RiuAbstractLegendFrame.h"
#include "RiuDraggableOverlayFrame.h" #include "RiuDraggableOverlayFrame.h"
#include "RiuPlotMainWindow.h" #include "RiuPlotMainWindow.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotWidget.h" #include "RiuQwtPlotWidget.h"
#include "RiuTextContentFrame.h" #include "RiuTextContentFrame.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiDateEditor.h"
#include "cafPdmUiItem.h" #include "cafPdmUiItem.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiSliderEditor.h"
#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeOrdering.h"
#include "qwt_plot_curve.h" #include "qwt_plot_curve.h"
@ -137,23 +131,22 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimEnsembleWellLogCurveSet::~RimEnsembleWellLogCurveSet() RimEnsembleWellLogCurveSet::~RimEnsembleWellLogCurveSet()
{ {
// m_curves.deleteAllChildObjects(); RimWellLogTrack* plotTrack = nullptr;
firstAncestorOrThisOfType( plotTrack );
if ( plotTrack && plotTrack->viewer() )
{
if ( m_legendOverlayFrame )
{
plotTrack->viewer()->removeOverlayFrame( m_legendOverlayFrame );
}
}
RimWellLogPlot* parentPlot;
firstAncestorOrThisOfType( parentPlot );
// if ( parentPlot && parentPlot->viewer() )
// {
// m_qwtPlotCurveForLegendText->detach();
// if ( m_legendOverlayFrame )
// {
// parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
// }
// }
if ( m_legendOverlayFrame ) if ( m_legendOverlayFrame )
{ {
m_legendOverlayFrame->setParent( nullptr ); m_legendOverlayFrame->setParent( nullptr );
delete m_legendOverlayFrame; delete m_legendOverlayFrame;
} }
if ( m_filterOverlayFrame ) if ( m_filterOverlayFrame )
{ {
m_filterOverlayFrame->setParent( nullptr ); m_filterOverlayFrame->setParent( nullptr );
@ -186,6 +179,7 @@ void RimEnsembleWellLogCurveSet::loadDataAndUpdate( bool updateParentPlot )
{ {
updateAllCurves(); updateAllCurves();
updateFilterLegend(); updateFilterLegend();
updateAllTextInPlot();
if ( updateParentPlot ) if ( updateParentPlot )
{ {
@ -231,42 +225,14 @@ void RimEnsembleWellLogCurveSet::reattachQwtCurves()
m_qwtPlotCurveForLegendText->detach(); m_qwtPlotCurveForLegendText->detach();
RimWellLogPlot* plot = nullptr; RimWellLogTrack* plot = nullptr;
firstAncestorOrThisOfType( plot ); firstAncestorOrThisOfType( plot );
// if ( plot ) if ( plot )
// {
// m_qwtPlotCurveForLegendText->attach( plot->viewer() );
// }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::addCurve( RimWellLogCurve* curve )
{
if ( curve )
{ {
RimWellLogPlot* plot; m_qwtPlotCurveForLegendText->attach( plot->viewer() );
firstAncestorOrThisOfType( plot );
// if ( plot ) curve->setParentQwtPlotNoReplot( plot->viewer() );
curve->setColor( m_color );
m_curves.push_back( curve );
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::deleteCurve( RimWellLogCurve* curve )
{
// if ( curve )
// {
// m_curves.removeChildObject( curve );
// delete curve;
// }
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -341,14 +307,6 @@ RiuDraggableOverlayFrame* RimEnsembleWellLogCurveSet::legendFrame() const
return m_legendOverlayFrame; return m_legendOverlayFrame;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::onLegendDefinitionChanged()
{
updateCurveColors();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -525,13 +483,6 @@ void RimEnsembleWellLogCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& u
caf::IconProvider iconProvider = this->uiIconProvider(); caf::IconProvider iconProvider = this->uiIconProvider();
if ( !iconProvider.valid() ) return; if ( !iconProvider.valid() ) return;
// RimEnsembleWellLogCurveSetCollection* coll = nullptr;
// this->firstAncestorOrThisOfType( coll );
// if ( coll && coll->curveSetForSourceStepping() == this )
// {
// iconProvider.setOverlayResourceString( ":/StepUpDownCorner16x16.png" );
// }
this->setUiIcon( iconProvider ); this->setUiIcon( iconProvider );
} }
@ -776,11 +727,13 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
CVF_ASSERT( wellLogPlot ); CVF_ASSERT( wellLogPlot );
deleteEnsembleCurves(); deleteEnsembleCurves();
// m_qwtPlotCurveForLegendText->detach(); m_qwtPlotCurveForLegendText->detach();
deleteStatisticsCurves(); deleteStatisticsCurves();
if ( m_statistics->hideEnsembleCurves() ) return; if ( m_statistics->hideEnsembleCurves() ) return;
m_qwtPlotCurveForLegendText->attach( plotTrack->viewer() );
QString wellLogChannelName = m_wellLogChannelName(); QString wellLogChannelName = m_wellLogChannelName();
if ( plotTrack && wellLogChannelName != "None" ) if ( plotTrack && wellLogChannelName != "None" )
{ {
@ -819,6 +772,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
curve->loadDataAndUpdate( true ); curve->loadDataAndUpdate( true );
curve->updateCurveVisibility(); curve->updateCurveVisibility();
curve->setShowInLegend( false );
m_curves.push_back( curve ); m_curves.push_back( curve );
} }
@ -826,6 +780,8 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
updateCurveColors(); updateCurveColors();
} }
} }
plotTrack->updateLegend();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -932,16 +888,6 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves()
updateStatisticsCurves( std::vector<RimWellLogFile*>() ); updateStatisticsCurves( std::vector<RimWellLogFile*>() );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// RimEnsembleWellLogCurveSet* RimEnsembleWellLogCurveSet::clone() const
// {
// RimEnsembleWellLogCurveSet* copy = dynamic_cast<RimEnsembleWellLogCurveSet*>(
// this->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
// return copy;
// }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -955,7 +901,14 @@ void RimEnsembleWellLogCurveSet::showCurves( bool show )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleWellLogCurveSet::updateAllTextInPlot() void RimEnsembleWellLogCurveSet::updateAllTextInPlot()
{ {
RimWellLogTrack* plotTrack = nullptr;
firstAncestorOrThisOfType( plotTrack );
CVF_ASSERT( plotTrack );
plotTrack->viewer()->setPlotTitle( name() );
updateEnsembleLegendItem(); updateEnsembleLegendItem();
plotTrack->updateLegend();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -967,9 +920,7 @@ std::vector<RimWellLogFile*>
std::vector<RimWellLogFile*> filteredCases; std::vector<RimWellLogFile*> filteredCases;
if ( m_ensembleCurveSet != nullptr && m_statistics->basedOnFilteredCases() ) if ( m_ensembleCurveSet != nullptr && m_statistics->basedOnFilteredCases() )
{ // && m_ensembleCurveSet->isFiltered() ) {
RiaLogging::debug( QString( "FILTERING ENSEMBLE CASES" ) );
// Get the summary cases from the related ensemble summary curve set. // Get the summary cases from the related ensemble summary curve set.
RimSummaryCaseCollection* summaryCaseCollection = m_ensembleCurveSet->summaryCaseCollection(); RimSummaryCaseCollection* summaryCaseCollection = m_ensembleCurveSet->summaryCaseCollection();
@ -989,8 +940,6 @@ std::vector<RimWellLogFile*>
} }
else else
{ {
RiaLogging::debug( QString( "NOT FILTERING ENSEMBLE CASES" ) );
filteredCases = wellLogFiles; filteredCases = wellLogFiles;
} }
@ -1013,14 +962,10 @@ bool RimEnsembleWellLogCurveSet::isSameRealization( RimSummaryCase* summaryCase,
if ( wellLogFileName.contains( QString( "realization-%1" ).arg( realizationNumber ) ) ) if ( wellLogFileName.contains( QString( "realization-%1" ).arg( realizationNumber ) ) )
{ {
RiaLogging::debug(
QString( "Matching summary case %1 with well log file %2" ).arg( summaryCaseFileName ).arg( wellLogFileName ) );
return true; return true;
} }
} }
RiaLogging::debug( QString( "No matching summary case found for well log file: %1." ).arg( wellLogFileName ) );
return false; return false;
} }

View File

@ -81,27 +81,18 @@ public:
void detachQwtCurves(); void detachQwtCurves();
void reattachQwtCurves(); void reattachQwtCurves();
void addCurve( RimWellLogCurve* curve );
void deleteCurve( RimWellLogCurve* curve );
std::vector<RimWellLogCurve*> curves() const; std::vector<RimWellLogCurve*> curves() const;
void deleteEnsembleCurves(); void deleteEnsembleCurves();
void deleteStatisticsCurves(); void deleteStatisticsCurves();
void onLegendDefinitionChanged();
void setSummaryCaseCollection( RimSummaryCaseCollection* sumCaseCollection );
RimSummaryCaseCollection* summaryCaseCollection() const;
ColorMode colorMode() const; ColorMode colorMode() const;
void setColorMode( ColorMode mode ); void setColorMode( ColorMode mode );
void updateEnsembleLegendItem(); void updateEnsembleLegendItem();
RiuDraggableOverlayFrame* legendFrame() const; RiuDraggableOverlayFrame* legendFrame() const;
RimEnsembleWellLogCurveSet* clone() const; void showCurves( bool show );
void showCurves( bool show );
void updateAllTextInPlot(); void updateAllTextInPlot();
@ -145,8 +136,6 @@ private:
QString createAutoName() const; QString createAutoName() const;
void updateLegendMappingMode();
void updateMaxMinAndDefaultValues();
void updateCurveColors(); void updateCurveColors();
bool isSameRealization( RimSummaryCase* summaryCase, RimWellLogFile* wellLogFile ) const; bool isSameRealization( RimSummaryCase* summaryCase, RimWellLogFile* wellLogFile ) const;