///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2021- 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RiuPlotCurve.h" #include "RiuQwtPlotCurveDefines.h" #include "cvfBoundingBox.h" #include #include #include class RiuQtChartsPlotWidget; class RiuPlotCurveSymbol; //================================================================================================== // //================================================================================================== class RiuQtChartsPlotCurve : public QObject, public RiuPlotCurve { Q_OBJECT public: explicit RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title = QString() ); ~RiuQtChartsPlotCurve() override; void setTitle( const QString& title ) override; void setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle, RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType, int curveThickness, const QColor& curveColor, const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) override; void setBrush( const QBrush& brush ) override; void setColor( const QColor& color ) override; void setLegendIconSize( const QSize& iconSize ) override; QSize legendIconSize() const override; QPixmap legendIcon( const QSizeF& size ) const override; void attachToPlot( RiuPlotWidget* plotWidget ) override; void showInPlot() override; void setZ( int z ) override; void updateErrorBarsAppearance( bool showErrorBars, const QColor& curveColor ) override; void clearErrorBars() override; int numSamples() const override; std::pair sample( int index ) const override; std::pair xDataRange() const override; std::pair yDataRange() const override; void detach() override; void setXAxis( RiuPlotAxis axis ) override; void setYAxis( RiuPlotAxis axis ) override; void setVisibleInLegend( bool isVisibleInLegend ) override; void setSymbol( RiuPlotCurveSymbol* symbol ) override; void updateLineAndAreaSeries(); RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; void setCurveFittingTolerance( double tolerance ) override; void updateScatterSeries(); public slots: void axisRangeChanged(); private: void setSamplesInPlot( const std::vector&, const std::vector& ) override; bool isQtChartObjectsPresent() const; QtCharts::QLineSeries* lineSeries() const; QtCharts::QScatterSeries* scatterSeries() const; QtCharts::QAreaSeries* areaSeries() const; cvf::BoundingBox computeBoundingBox() const; private: QtCharts::QLineSeries* m_lineSeries; QtCharts::QScatterSeries* m_scatterSeries; QtCharts::QAreaSeries* m_areaSeries; std::shared_ptr m_symbol; QPointer m_plotWidget; RiuPlotAxis m_axisX; RiuPlotAxis m_axisY; bool m_isVisibleInLegend; };