///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2023- 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 "RiuInterfaceToViewWindow.h" #include "RiuPlotItem.h" #include "RiuQwtPlotWidget.h" #include "cafFontTools.h" #include "cafPdmPointer.h" #include "cafSignal.h" #include "cvfScalarMapper.h" #include "qwt_plot.h" #include #include class RimViewWindow; class RimRegularLegendConfig; class RiuAbstractLegendFrame; class RiuMatrixPlotWidget : public QWidget, public RiuInterfaceToViewWindow, public caf::SignalEmitter { Q_OBJECT public: caf::Signal> matrixCellSelected; public: RiuMatrixPlotWidget( RimViewWindow* ownerViewWindow, RimRegularLegendConfig* legendConfig, QWidget* parent = nullptr ); ~RiuMatrixPlotWidget() override; QwtPlot* qwtPlot() const; void createPlot(); void clearPlotData(); void setColumnHeaders( const std::vector& columnHeaders ); void setRowValues( const QString& rowLabel, const std::vector& values ); void setPlotTitle( const QString& title ); void setColumnTitle( const QString& title ); void setRowTitle( const QString& title ); void setInvalidValueColor( const cvf::Color3ub& color ); void setUseInvalidValueColor( bool useInvalidValueColor ); void setInvalidValueRange( double min, double max ); void setShowValueLabel( bool showValueLabel ); void setPlotTitleFontSize( int fontSize ); void setPlotTitleEnabled( bool enabled ); void setLegendFontSize( int fontSize ); void setAxisTitleFontSize( int fontSize ); void setAxisLabelFontSize( int fontSize ); void setValueFontSize( int fontSize ); void scheduleReplot(); RimViewWindow* ownerViewWindow() const override; protected: void contextMenuEvent( QContextMenuEvent* ) override; private slots: void onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ); private: void updateAxes(); void createMatrixCells(); std::map createIndexLabelMap( const std::vector& labels ); private: QPointer m_plotWidget; QPointer m_legendFrame; caf::PdmPointer m_ownerViewWindow; // Only intended to be used by ownerViewWindow() caf::PdmPointer m_legendConfig; std::vector m_columnHeaders; std::vector m_rowHeaders; std::vector> m_rowValues; cvf::Color3ub m_invalidValueColor = cvf::Color3ub::WHITE; bool m_useInvalidValueColor = false; std::pair m_invalidValueRange = { 0.0, 0.0 }; bool m_showValueLabel = true; QString m_rowTitle; QString m_columnTitle; int m_axisTitleFontSize = 8; int m_axisLabelFontSize = 8; int m_valueFontSize = 8; };