2019-10-11 08:54:19 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RimPlotWindow.h"
|
2019-11-13 05:22:50 -06:00
|
|
|
#include "RiuMultiPlotWindow.h"
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
#include "cafAppEnum.h"
|
|
|
|
#include "cafPdmChildArrayField.h"
|
|
|
|
#include "cafPdmChildField.h"
|
|
|
|
#include "cafPdmField.h"
|
|
|
|
#include "cafPdmFieldHandle.h"
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QString>
|
|
|
|
|
2019-10-31 07:48:40 -05:00
|
|
|
#include <vector>
|
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
class RimPlotInterface;
|
|
|
|
|
2019-11-13 05:22:50 -06:00
|
|
|
class RimMultiPlot : public RimPlotWindow
|
2019-10-11 08:54:19 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ColumnCount
|
|
|
|
{
|
|
|
|
COLUMNS_1 = 1,
|
|
|
|
COLUMNS_2 = 2,
|
|
|
|
COLUMNS_3 = 3,
|
|
|
|
COLUMNS_4 = 4,
|
|
|
|
COLUMNS_UNLIMITED = 1000,
|
|
|
|
};
|
|
|
|
typedef caf::AppEnum<ColumnCount> ColumnCountEnum;
|
|
|
|
|
|
|
|
public:
|
2019-11-13 05:22:50 -06:00
|
|
|
RimMultiPlot();
|
|
|
|
~RimMultiPlot() override;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2019-11-13 05:22:50 -06:00
|
|
|
RimMultiPlot& operator=( RimMultiPlot&& rhs );
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
QWidget* viewWidget() override;
|
|
|
|
|
2019-11-13 04:44:54 -06:00
|
|
|
bool isMultiPlotTitleVisible() const;
|
|
|
|
void setMultiPlotTitleVisible( bool visible );
|
|
|
|
QString multiPlotTitle() const;
|
|
|
|
void setMultiPlotTitle( const QString& title );
|
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
void addPlot( RimPlotInterface* plot );
|
|
|
|
void insertPlot( RimPlotInterface* plot, size_t index );
|
|
|
|
void removePlot( RimPlotInterface* plot );
|
2019-10-31 07:48:40 -05:00
|
|
|
void movePlotsToThis( const std::vector<RimPlotInterface*>& plots, RimPlotInterface* plotToInsertAfter );
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
size_t plotCount() const;
|
|
|
|
size_t plotIndex( const RimPlotInterface* plot ) const;
|
|
|
|
RimPlotInterface* plotByIndex( size_t index ) const;
|
|
|
|
|
|
|
|
std::vector<RimPlotInterface*> plots() const;
|
|
|
|
std::vector<RimPlotInterface*> visiblePlots() const;
|
|
|
|
|
2019-10-24 07:01:16 -05:00
|
|
|
void updateLayout() override;
|
|
|
|
virtual void updatePlotNames();
|
|
|
|
void updatePlotOrderFromGridWidget();
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
virtual void setAutoScaleXEnabled( bool enabled );
|
|
|
|
virtual void setAutoScaleYEnabled( bool enabled );
|
|
|
|
|
|
|
|
int columnCount() const;
|
|
|
|
caf::PdmFieldHandle* columnCountField();
|
2019-10-31 07:48:40 -05:00
|
|
|
bool showPlotTitles() const;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
void zoomAll() override;
|
|
|
|
|
|
|
|
QString asciiDataForPlotExport() const;
|
|
|
|
|
|
|
|
virtual void onPlotAdditionOrRemoval();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QImage snapshotWindowContent() override;
|
|
|
|
|
|
|
|
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
|
|
|
void deleteViewWidget() override;
|
|
|
|
|
2019-11-13 04:44:54 -06:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
|
2019-10-31 07:48:40 -05:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue ) override;
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
|
|
|
|
void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly ) override;
|
|
|
|
void onLoadDataAndUpdate() override;
|
|
|
|
void initAfterRead() override;
|
|
|
|
|
2019-11-13 04:44:54 -06:00
|
|
|
void updatePlotTitleInWidgets();
|
2019-10-11 08:54:19 -05:00
|
|
|
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:
|
2019-11-07 01:48:11 -06:00
|
|
|
void cleanupBeforeClose();
|
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
static RimPlotInterface* toPlotInterfaceAsserted( caf::PdmObject* pdmObject );
|
|
|
|
static const RimPlotInterface* toPlotInterfaceAsserted( const caf::PdmObject* pdmObject );
|
|
|
|
static caf::PdmObject* toPdmObjectAsserted( RimPlotInterface* plotInterface );
|
|
|
|
static const caf::PdmObject* toPdmObjectAsserted( const RimPlotInterface* plotInterface );
|
|
|
|
|
|
|
|
protected:
|
2019-11-13 04:44:54 -06:00
|
|
|
caf::PdmField<bool> m_showPlotWindowTitle;
|
|
|
|
caf::PdmField<QString> m_plotWindowTitle;
|
2019-10-11 08:54:19 -05:00
|
|
|
caf::PdmField<ColumnCountEnum> m_columnCountEnum;
|
2019-10-31 07:48:40 -05:00
|
|
|
caf::PdmField<bool> m_showIndividualPlotTitles;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2019-11-13 05:22:50 -06:00
|
|
|
friend class RiuMultiPlotWindow;
|
|
|
|
QPointer<RiuMultiPlotWindow> m_viewer;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
caf::PdmChildArrayField<caf::PdmObject*> m_plots;
|
|
|
|
};
|