///////////////////////////////////////////////////////////////////////////////// // // 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 "RiaDefines.h" #include "RimAbstractPlotCollection.h" #include "RimPlot.h" #include "RimPlotAxisPropertiesInterface.h" #include "RimPlotWindow.h" #include "RiuMultiPlotBook.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 RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection { CAF_PDM_HEADER_INIT; public: using ColumnCountEnum = caf::AppEnum; using RowCountEnum = caf::AppEnum; public: RimMultiPlot(); ~RimMultiPlot() override; RimMultiPlot& operator=( RimMultiPlot&& rhs ); QWidget* viewWidget() override; QString description() const override; QString projectFileVersionString() const; bool isMultiPlotTitleVisible() const; void setMultiPlotTitleVisible( bool visible ); QString multiPlotTitle() const; void setMultiPlotTitle( const QString& title ); void insertPlot( RimPlot* plot, size_t index ) override; void removePlot( RimPlot* plot ) override; void movePlotsToThis( const std::vector& plots, int insertAtPosition ); virtual void removePlotNoUpdate( RimPlot* plot ); virtual void updateAfterPlotRemove(); void deleteAllPlots() override; void updatePlots(); virtual void updatePlotWindowTitle(); size_t plotCount() const override; size_t plotIndex( const RimPlot* plot ) const; std::vector plots() const override; std::vector visiblePlots() const; void updatePlotOrderFromGridWidget(); void setAutoScaleXEnabled( bool enabled ); void setAutoScaleYEnabled( bool enabled ); void setColumnCount( RiaDefines::ColumnCount columnCount ); void setRowCount( RiaDefines::RowCount rowCount ); void setTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount ); int columnCount() const override; int rowsPerPage() const; void setShowPlotTitles( bool enable ); bool showPlotTitles() const; void zoomAll() override; QString asciiDataForPlotExport() const; bool previewModeEnabled() const; int subTitleFontSize() const; int axisTitleFontSize() const; int axisValueFontSize() const; virtual std::vector fieldsToShowInToolbar(); virtual std::vector fieldsToShowInLayoutToolbar(); bool isValid() 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 defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; void uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void onLoadDataAndUpdate() override; void initAfterRead() override; void applyPlotWindowTitleToWidgets(); void updateZoom(); void recreatePlotWidgets(); void onPlotAdditionOrRemoval(); bool isMouseCursorInsidePlot(); private: void cleanupBeforeClose(); void setupBeforeSave() override; void doUpdateLayout() override; void updateSubPlotNames(); void doRenderWindowContent( QPaintDevice* paintDevice ) override; void onPlotsReordered( const caf::SignalEmitter* emitter ); void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; static void setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount ); protected: caf::PdmField m_projectFileVersionString; caf::PdmField m_showPlotWindowTitle; caf::PdmField m_plotWindowTitle; caf::PdmField m_columnCount; caf::PdmField m_rowsPerPage; caf::PdmField m_showIndividualPlotTitles; caf::PdmField m_subTitleFontSize; caf::PdmField m_axisTitleFontSize; caf::PdmField m_axisValueFontSize; caf::PdmField m_pagePreviewMode; caf::PdmField m_majorTickmarkCount; friend class RiuMultiPlotBook; QPointer m_viewer; private: caf::PdmChildArrayField m_plots; bool m_isValid; };