///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2019- 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 "RimPlotWindow.h" #include "RiuMultiPlotInterface.h" #include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmFieldHandle.h" #include "cafPdmObject.h" #include #include #include class RimPlot; class RimMultiPlotWindow : public RimPlotWindow { CAF_PDM_HEADER_INIT; public: enum ColumnCount { COLUMNS_1 = 1, COLUMNS_2 = 2, COLUMNS_3 = 3, COLUMNS_4 = 4, COLUMNS_UNLIMITED = 1000, }; using ColumnCountEnum = caf::AppEnum; enum RowCount { ROWS_1 = 1, ROWS_2 = 2, ROWS_3 = 3, ROWS_4 = 4, }; using RowCountEnum = caf::AppEnum; public: RimMultiPlotWindow( bool hidePlotsInTreeView = false ); ~RimMultiPlotWindow() override; RimMultiPlotWindow& operator=( RimMultiPlotWindow&& rhs ); QWidget* viewWidget() override; QString description() const override; bool isMultiPlotTitleVisible() const; void setMultiPlotTitleVisible( bool visible ); QString multiPlotTitle() const; void setMultiPlotTitle( const QString& title ); void addPlot( RimPlot* plot ); void insertPlot( RimPlot* plot, size_t index ); void removePlot( RimPlot* plot ); void movePlotsToThis( const std::vector& plots, RimPlot* plotToInsertAfter ); size_t plotCount() const; size_t plotIndex( const RimPlot* plot ) const; RimPlot* plotByIndex( size_t index ) const; std::vector plots() const; std::vector visiblePlots() const; void updatePlotOrderFromGridWidget(); void setAutoScaleXEnabled( bool enabled ); void setAutoScaleYEnabled( bool enabled ); int columnCount() const; int rowsPerPage() const; caf::PdmFieldHandle* columnCountField(); caf::PdmFieldHandle* rowsPerPageField(); bool showPlotTitles() const; void zoomAll() override; QString asciiDataForPlotExport() const; virtual void onPlotAdditionOrRemoval(); void setAcceptDrops( bool acceptDrops ); bool acceptDrops() const; bool previewModeEnabled() const; protected: QImage snapshotWindowContent() override; QWidget* createViewWidget( QWidget* mainWindowParent ) override; void deleteViewWidget() override; caf::PdmFieldHandle* userDescriptionField() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; void onLoadDataAndUpdate() override; void initAfterRead() override; void applyPlotWindowTitleToWidgets(); void updatePlots(); virtual void updateZoom(); void recreatePlotWidgets(); bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override; bool applyFontSize( RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false ) override; private: void cleanupBeforeClose(); void doUpdateLayout() override; virtual void updateSubPlotNames(); virtual void updatePlotWindowTitle(); virtual void doSetAutoScaleYEnabled( bool enabled ); void doRenderWindowContent( QPaintDevice* paintDevice ) override; protected: caf::PdmField m_showPlotWindowTitle; caf::PdmField m_plotWindowTitle; caf::PdmField m_columnCount; caf::PdmField m_rowsPerPage; caf::PdmField m_showIndividualPlotTitles; friend class RiuMultiPlotInterface; QPointer m_viewer; private: caf::PdmChildArrayField m_plots; bool m_acceptDrops; };