mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Introduce RimGridPlotWindow and RiuQwtPlotWidget
This commit is contained in:
@@ -186,10 +186,10 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet()
|
||||
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfType( parentPlot );
|
||||
if ( parentPlot && parentPlot->qwtPlot() )
|
||||
if ( parentPlot && parentPlot->viewer() )
|
||||
{
|
||||
m_qwtPlotCurveForLegendText->detach();
|
||||
parentPlot->qwtPlot()->removeEnsembleCurveSetLegend( this );
|
||||
parentPlot->removeEnsembleCurveSetLegend( this );
|
||||
}
|
||||
|
||||
delete m_qwtPlotCurveForLegendText;
|
||||
@@ -272,7 +272,7 @@ void RimEnsembleCurveSet::reattachQwtCurves()
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot )
|
||||
{
|
||||
m_qwtPlotCurveForLegendText->attach( plot->qwtPlot() );
|
||||
m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ void RimEnsembleCurveSet::addCurve( RimSummaryCurve* curve )
|
||||
{
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot ) curve->setParentQwtPlotNoReplot( plot->qwtPlot() );
|
||||
if ( plot ) curve->setParentQwtPlotNoReplot( plot->viewer() );
|
||||
|
||||
curve->setColor( m_color );
|
||||
m_curves.push_back( curve );
|
||||
@@ -635,7 +635,7 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector Y" );
|
||||
curveDataGroup->add( &m_yValuesSummaryCaseCollection );
|
||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||
curveDataGroup->add( &m_plotAxis );
|
||||
}
|
||||
|
||||
@@ -946,18 +946,18 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot && plot->qwtPlot() )
|
||||
if ( plot && plot->viewer() )
|
||||
{
|
||||
if ( m_yValuesSummaryCaseCollection() && isCurvesVisible() && m_colorMode == BY_ENSEMBLE_PARAM &&
|
||||
m_legendConfig->showLegend() )
|
||||
{
|
||||
plot->qwtPlot()->addOrUpdateEnsembleCurveSetLegend( this );
|
||||
plot->addOrUpdateEnsembleCurveSetLegend( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
plot->qwtPlot()->removeEnsembleCurveSetLegend( this );
|
||||
plot->removeEnsembleCurveSetLegend( this );
|
||||
}
|
||||
plot->qwtPlot()->replot();
|
||||
plot->viewer()->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,13 +1011,13 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
|
||||
}
|
||||
}
|
||||
|
||||
if ( plot->qwtPlot() ) m_qwtPlotCurveForLegendText->attach( plot->qwtPlot() );
|
||||
if ( plot->viewer() ) m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
||||
}
|
||||
|
||||
if ( plot->qwtPlot() )
|
||||
if ( plot->viewer() )
|
||||
{
|
||||
plot->qwtPlot()->updateLegend();
|
||||
plot->qwtPlot()->replot();
|
||||
plot->viewer()->updateLegend();
|
||||
plot->viewer()->scheduleReplot();
|
||||
plot->updateAxes();
|
||||
plot->updatePlotInfoLabel();
|
||||
}
|
||||
@@ -1079,7 +1079,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
for ( auto address : addresses )
|
||||
{
|
||||
auto curve = new RimSummaryCurve();
|
||||
curve->setParentQwtPlotNoReplot( plot->qwtPlot() );
|
||||
curve->setParentQwtPlotNoReplot( plot->viewer() );
|
||||
m_curves.push_back( curve );
|
||||
curve->setColor( m_statistics->color() );
|
||||
curve->setColor( m_statistics->color() );
|
||||
@@ -1103,9 +1103,9 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
curve->updateQwtPlotAxis();
|
||||
}
|
||||
|
||||
if ( plot->qwtPlot() )
|
||||
if ( plot->viewer() )
|
||||
{
|
||||
plot->qwtPlot()->updateLegend();
|
||||
plot->viewer()->updateLegend();
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
@@ -1163,7 +1163,7 @@ void RimEnsembleCurveSet::updateAllTextInPlot()
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( summaryPlot );
|
||||
if ( summaryPlot->qwtPlot() )
|
||||
if ( summaryPlot->viewer() )
|
||||
{
|
||||
summaryPlot->updatePlotTitle();
|
||||
}
|
||||
|
||||
@@ -637,10 +637,10 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
QString curveDataGroupName = "Summary Vector";
|
||||
if ( isCrossPlotCurve() ) curveDataGroupName += " Y";
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( curveDataGroupName, "Summary Vector Y" );
|
||||
curveDataGroup->add( &m_yValuesSummaryCase, {true, 3, 1} );
|
||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField, {true, 2, 1} );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
|
||||
curveDataGroup->add( &m_plotAxis, {true, 3, 1} );
|
||||
curveDataGroup->add( &m_yValuesSummaryCase, { true, 3, 1 } );
|
||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField, { true, 2, 1 } );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||
curveDataGroup->add( &m_plotAxis, { true, 3, 1 } );
|
||||
|
||||
if ( isCrossPlotCurve() )
|
||||
m_showErrorBars = false;
|
||||
@@ -651,9 +651,9 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
if ( isCrossPlotCurve() )
|
||||
{
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector X" );
|
||||
curveDataGroup->add( &m_xValuesSummaryCase, {true, 3, 1} );
|
||||
curveDataGroup->add( &m_xValuesSummaryAddressUiField, {true, 2, 1} );
|
||||
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, {false, 1, 0} );
|
||||
curveDataGroup->add( &m_xValuesSummaryCase, { true, 3, 1 } );
|
||||
curveDataGroup->add( &m_xValuesSummaryAddressUiField, { true, 2, 1 } );
|
||||
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
|
||||
@@ -309,7 +309,7 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
|
||||
parentPlot->updatePlotTitle();
|
||||
if ( parentPlot->qwtPlot() ) parentPlot->qwtPlot()->updateLegend();
|
||||
if ( parentPlot->viewer() ) parentPlot->viewer()->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,8 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
|
||||
#include "qwt_plot_textlabel.h"
|
||||
@@ -64,7 +65,7 @@ class QKeyEvent;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlot : public RimPlot, public RimRiuQwtPlotOwnerInterface
|
||||
class RimSummaryPlot : public RimPlotWindow, public RimPlotInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -74,6 +75,7 @@ public:
|
||||
|
||||
void setDescription( const QString& description );
|
||||
QString description() const;
|
||||
bool isChecked() const override;
|
||||
|
||||
void enableShowPlotTitle( bool enable );
|
||||
void enableAutoPlotTitle( bool enable );
|
||||
@@ -104,16 +106,14 @@ public:
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
void updateAxes();
|
||||
void zoomAll() override;
|
||||
|
||||
void updateZoomInQwt();
|
||||
|
||||
bool isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) const;
|
||||
|
||||
RimSummaryTimeAxisProperties* timeAxisProperties();
|
||||
time_t firstTimeStepOfFirstCurve();
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QWidget* viewWidget() override;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
|
||||
QString asciiDataForPlotExport( DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const;
|
||||
|
||||
@@ -122,11 +122,10 @@ public:
|
||||
std::vector<RimSummaryCurve*> summaryCurves() const;
|
||||
void deleteAllSummaryCurves();
|
||||
RimSummaryCurveCollection* summaryCurveCollection() const;
|
||||
RiuSummaryQwtPlot* qwtPlot() const;
|
||||
|
||||
std::vector<RimEnsembleCurveSet*> curveSets() const;
|
||||
|
||||
void updatePlotTitle();
|
||||
void updatePlotTitle() override;
|
||||
|
||||
const RimSummaryPlotNameHelper* activePlotTitleHelperAllCurves() const;
|
||||
void updateCurveNames();
|
||||
@@ -134,6 +133,8 @@ public:
|
||||
|
||||
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||
|
||||
void updateLayout() override;
|
||||
|
||||
void updateAll();
|
||||
void updateAllLegendItems();
|
||||
|
||||
@@ -163,14 +164,21 @@ public:
|
||||
virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const;
|
||||
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
public:
|
||||
// Rim2dPlotInterface overrides
|
||||
void updateAxisScaling() override;
|
||||
void updateAxisDisplay() override;
|
||||
void updateZoomWindowFromQwt() override;
|
||||
void selectAxisInPropertyEditor( int axis ) override;
|
||||
void setAutoZoomForAllAxes( bool enableAutoZoom ) override;
|
||||
caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
|
||||
void zoomAll() override;
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
|
||||
void createPlotWidget() override;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void addOrUpdateEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
|
||||
void removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
|
||||
|
||||
public:
|
||||
// RimViewWindow overrides
|
||||
@@ -208,15 +216,13 @@ private:
|
||||
bool hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
||||
|
||||
RimPlotAxisProperties* yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis leftOrRightPlotAxis ) const;
|
||||
void updateAxis( RiaDefines::PlotAxis plotAxis );
|
||||
void updateYAxis( RiaDefines::PlotAxis plotAxis );
|
||||
|
||||
void updateZoomForAxis( RiaDefines::PlotAxis plotAxis );
|
||||
|
||||
void updateTimeAxis();
|
||||
void updateBottomXAxis();
|
||||
|
||||
void updateAxisRangesFromQwt();
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
private:
|
||||
@@ -226,8 +232,7 @@ private:
|
||||
|
||||
caf::PdmField<int> m_legendFontSize;
|
||||
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
caf::PdmField<QString> m_userDefinedPlotTitle;
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
|
||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
||||
@@ -245,7 +250,7 @@ private:
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotFilterTextCurveSetEditor*> m_textCurveSetEditor;
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
QPointer<RiuSummaryQwtPlot> m_plotWidget;
|
||||
std::unique_ptr<QwtPlotTextLabel> m_plotInfoLabel;
|
||||
|
||||
bool m_isCrossPlot;
|
||||
|
||||
Reference in New Issue
Block a user