mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5539 Initial AnalysisPlot objects and barchart builder
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotDataEntry.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotDataEntry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND QT_MOC_HEADERS
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\AnalysisPlots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,385 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimAnalysisPlot.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RimAnalysisPlotDataEntry.h"
|
||||
#include "RiuGroupedBarChartBuilder.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "qwt_column_symbol.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_painter.h"
|
||||
#include "qwt_plot_barchart.h"
|
||||
#include "qwt_scale_draw.h"
|
||||
|
||||
#include <limits>
|
||||
#include <map>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimAnalysisPlot::SortGroupType>::setUp()
|
||||
{
|
||||
addItem( RimAnalysisPlot::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" );
|
||||
addItem( RimAnalysisPlot::CASE, "CASE", "Case" );
|
||||
addItem( RimAnalysisPlot::ENSEMBLE, "ENSEMBLE", "Ensemble" );
|
||||
addItem( RimAnalysisPlot::VALUE, "VALUE", "Value" );
|
||||
addItem( RimAnalysisPlot::ABS_VALUE, "ABS_VALUE", "abs(Value)" );
|
||||
addItem( RimAnalysisPlot::OTHER_VALUE, "OTHER_VALUE", "Other Value" );
|
||||
addItem( RimAnalysisPlot::ABS_OTHER_VALUE, "ABS_OTHER_VALUE", "abs(Other Value)" );
|
||||
addItem( RimAnalysisPlot::TIME_STEP, "TIME_STEP", "Time Step" );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimAnalysisPlot, "AnalysisPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlot::RimAnalysisPlot()
|
||||
: RimPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Analysis Plot", ":/Histogram16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "" );
|
||||
m_showPlotTitle.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_data, "AnalysisPlotData", "", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sortGroupSortingOrder, "sortingOrder", "Sort Order", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_sortGroupsToGroup, "grouping", "Grouping", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sortGroupForLegend, "groupForLegend", "Legend Using", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlot::~RimAnalysisPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::cleanupBeforeClose()
|
||||
{
|
||||
detachAllCurves();
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setParent( nullptr );
|
||||
delete m_plotWidget;
|
||||
m_plotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnalysisPlot::showPlotTitle() const
|
||||
{
|
||||
return m_showPlotTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::setShowPlotTitle( bool showTitle )
|
||||
{
|
||||
m_showPlotTitle = showTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::detachAllCurves() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::reattachAllCurves() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::updateAxes() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimAnalysisPlot::viewWidget()
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimAnalysisPlot::viewer()
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimAnalysisPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::updateLegend() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnalysisPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnalysisPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false */ )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::setAutoScaleXEnabled( bool enabled ) {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::setAutoScaleYEnabled( bool enabled ) {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::zoomAll() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::updateZoomInQwt() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::updateZoomFromQwt() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimAnalysisPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onAxisSelected( int axis, bool toggle ) {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::deleteViewWidget()
|
||||
{
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimAnalysisPlot::description() const
|
||||
{
|
||||
return m_description();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::updateCaseNameHasChanged()
|
||||
{
|
||||
// Todo
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimAnalysisPlot::doCreatePlotViewWidget( QWidget* mainWindowParent /*= nullptr */ )
|
||||
{
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
this->connect( m_plotWidget, SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) );
|
||||
|
||||
// updatePlotTitle();
|
||||
}
|
||||
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::doUpdateLayout() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::doRemoveFromCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimAnalysisPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
QPixmap pix = m_plotWidget->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnalysisPlot::userDescriptionField()
|
||||
{
|
||||
return &m_description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= "" */ ) {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
RiuGroupedBarChartBuilder chartBuilder( Qt::Horizontal );
|
||||
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "W1", "", std::numeric_limits<double>::infinity(), "R1", 0.5 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "W1", "", std::numeric_limits<double>::infinity(), "R2", 0.55 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "W3", "", std::numeric_limits<double>::infinity(), "R1", 0.7 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "W3", "", std::numeric_limits<double>::infinity(), "R2", 0.75 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "W2", "", std::numeric_limits<double>::infinity(), "R1", 1.05 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "W2", "", std::numeric_limits<double>::infinity(), "R2", 1.0 );
|
||||
|
||||
chartBuilder.addBarEntry( "T2", "W1", "", std::numeric_limits<double>::infinity(), "R1", 1.5 );
|
||||
chartBuilder.addBarEntry( "T2", "W1", "", std::numeric_limits<double>::infinity(), "R2", 1.5 );
|
||||
chartBuilder.addBarEntry( "T2", "W2", "", std::numeric_limits<double>::infinity(), "R1", 2.0 );
|
||||
chartBuilder.addBarEntry( "T2", "W2", "", std::numeric_limits<double>::infinity(), "R2", 2.0 );
|
||||
|
||||
chartBuilder.addBarEntry( "T3", "W1", "1", std::numeric_limits<double>::infinity(), "R1", 1.5 );
|
||||
chartBuilder.addBarEntry( "T3", "W1", "2", std::numeric_limits<double>::infinity(), "R2", 1.5 );
|
||||
chartBuilder.addBarEntry( "T3", "W2", "3", std::numeric_limits<double>::infinity(), "R1", 2.0 );
|
||||
chartBuilder.addBarEntry( "T3", "W2", "4", std::numeric_limits<double>::infinity(), "R1", 2.0 );
|
||||
chartBuilder.addBarEntry( "T3", "W2", "5", std::numeric_limits<double>::infinity(), "R1", 2.0 );
|
||||
|
||||
chartBuilder.addBarEntry( "T4", "W1", "1", std::numeric_limits<double>::infinity(), "R1", 1.5 );
|
||||
chartBuilder.addBarEntry( "T4", "W1", "2", std::numeric_limits<double>::infinity(), "R2", 1.5 );
|
||||
chartBuilder.addBarEntry( "T4", "W2", "3", std::numeric_limits<double>::infinity(), "R1", 2.0 );
|
||||
chartBuilder.addBarEntry( "T4", "W2", "4", std::numeric_limits<double>::infinity(), "R2", 2.0 );
|
||||
chartBuilder.addBarEntry( "T4", "W1", "1", std::numeric_limits<double>::infinity(), "R1", 1.6 );
|
||||
chartBuilder.addBarEntry( "T4", "W1", "2", std::numeric_limits<double>::infinity(), "R2", 1.6 );
|
||||
chartBuilder.addBarEntry( "T4", "W2", "3", std::numeric_limits<double>::infinity(), "R1", 2.6 );
|
||||
chartBuilder.addBarEntry( "T4", "W2", "4", std::numeric_limits<double>::infinity(), "R2", -0.3 );
|
||||
|
||||
chartBuilder.addBarEntry( "T5", "", "G1", 1.5, "R3", 1.5 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G2", 1.5, "R3", 1.5 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G3", 2.0, "R3", 2.0 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G4", 2.0, "R3", 2.0 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G5", 1.6, "R3", 1.6 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G6", 1.6, "R3", 1.6 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G7", 2.6, "R3", 2.6 );
|
||||
chartBuilder.addBarEntry( "T5", "", "G8", -0.3, "R3", -0.3 );
|
||||
|
||||
chartBuilder.addBarEntry( "", "", "", 1.2, "", 1.2 );
|
||||
chartBuilder.addBarEntry( "", "", "", 1.5, "", 1.5 );
|
||||
chartBuilder.addBarEntry( "", "", "", 2.3, "", 2.3 );
|
||||
chartBuilder.addBarEntry( "", "", "", 2.0, "", 2.0 );
|
||||
chartBuilder.addBarEntry( "", "", "", 1.6, "", 1.6 );
|
||||
chartBuilder.addBarEntry( "", "", "", 2.4, "", -2.4 );
|
||||
|
||||
chartBuilder.addBarChartToPlot( m_plotWidget );
|
||||
|
||||
if ( m_showPlotLegends && m_plotWidget->legend() == nullptr )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->insertLegend( nullptr );
|
||||
}
|
||||
|
||||
// m_plotWidget->setLegendFontSize( m_legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
||||
this->updateAxes();
|
||||
}
|
||||
124
ApplicationCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h
Normal file
124
ApplicationCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RimPlot.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimAnalysisPlotDataEntry;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnalysisPlot : public RimPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimAnalysisPlot();
|
||||
~RimAnalysisPlot() override;
|
||||
|
||||
bool showPlotTitle() const;
|
||||
void setShowPlotTitle( bool showTitle );
|
||||
|
||||
void detachAllCurves() override;
|
||||
void reattachAllCurves() override;
|
||||
|
||||
void updateAxes() override;
|
||||
QWidget* viewWidget() override;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
void updateLegend() override;
|
||||
|
||||
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
||||
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange = false ) override;
|
||||
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
|
||||
void zoomAll() override;
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
// RimViewWindow overrides
|
||||
void deleteViewWidget() override;
|
||||
|
||||
enum SortGroupType
|
||||
{
|
||||
SUMMARY_ITEM,
|
||||
CASE,
|
||||
ENSEMBLE,
|
||||
VALUE,
|
||||
ABS_VALUE,
|
||||
OTHER_VALUE,
|
||||
ABS_OTHER_VALUE,
|
||||
TIME_STEP,
|
||||
};
|
||||
|
||||
QString description() const override;
|
||||
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
void cleanupBeforeClose();
|
||||
|
||||
void doUpdateLayout() override;
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
caf::PdmField<QString> m_description;
|
||||
|
||||
caf::PdmChildArrayField<RimAnalysisPlotDataEntry*> m_data;
|
||||
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmField<std::vector<caf::AppEnum<SortGroupType>>> m_sortGroupSortingOrder;
|
||||
caf::PdmField<std::vector<caf::AppEnum<SortGroupType>>> m_sortGroupsToGroup;
|
||||
|
||||
caf::PdmField<caf::AppEnum<SortGroupType>> m_sortGroupForLegend;
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimAnalysisPlotCollection.h"
|
||||
|
||||
#include "RimAnalysisPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimAnalysisPlotCollection, "AnalysisPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlotCollection::RimAnalysisPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Analysis Plots", ":/Histograms16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_analysisPlots, "AnalysisPlots", "Analysis Plots", "", "", "" );
|
||||
m_analysisPlots.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlotCollection::~RimAnalysisPlotCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot()
|
||||
{
|
||||
RimAnalysisPlot* plot = new RimAnalysisPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::updateSummaryNameHasChanged()
|
||||
{
|
||||
for ( RimAnalysisPlot* plot : m_analysisPlots )
|
||||
{
|
||||
plot->updateCaseNameHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::removeSummaryPlot( RimAnalysisPlot* analysisPlot )
|
||||
{
|
||||
m_analysisPlots.removeChildObject( analysisPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::deleteAllChildObjects()
|
||||
{
|
||||
m_analysisPlots.deleteAllChildObjects();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimAnalysisPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnalysisPlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimAnalysisPlotCollection();
|
||||
~RimAnalysisPlotCollection() override;
|
||||
|
||||
RimAnalysisPlot* createAnalysisPlot();
|
||||
void updateSummaryNameHasChanged();
|
||||
void removeSummaryPlot( RimAnalysisPlot* analysisPlot );
|
||||
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimAnalysisPlot*> m_analysisPlots;
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimAnalysisPlotDataEntry.h"
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimAnalysisPlotDataEntry, "AnalysisPlotDataEntry" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlotDataEntry::RimAnalysisPlotDataEntry()
|
||||
{
|
||||
CAF_PDM_InitObject( "Data Entry", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryCase, "SummaryCase", "Case", "", "", "" );
|
||||
m_summaryCase.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_summaryCase.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address", "", "", "" );
|
||||
m_summaryAddress.uiCapability()->setUiHidden( true );
|
||||
m_summaryAddress.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_summaryAddress = new RimSummaryAddress;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlotDataEntry::~RimAnalysisPlotDataEntry() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotDataEntry::setSummaryCase( RimSummaryCase* sumCase )
|
||||
{
|
||||
m_summaryCase = sumCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimAnalysisPlotDataEntry::summaryCase() const
|
||||
{
|
||||
return m_summaryCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotDataEntry::setSummaryAddress( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
m_summaryAddress->setAddress( address );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RimAnalysisPlotDataEntry::summaryAddress() const
|
||||
{
|
||||
return m_summaryAddress->address();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RifEclipseSummaryAddress.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimSummaryCase;
|
||||
class RimSummaryAddress;
|
||||
|
||||
class RimAnalysisPlotDataEntry : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimAnalysisPlotDataEntry();
|
||||
~RimAnalysisPlotDataEntry() override;
|
||||
|
||||
void setSummaryCase( RimSummaryCase* sumCase );
|
||||
RimSummaryCase* summaryCase() const;
|
||||
|
||||
void setSummaryAddress( const RifEclipseSummaryAddress& address );
|
||||
RifEclipseSummaryAddress summaryAddress() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||
caf::PdmChildField<RimSummaryAddress*> m_summaryAddress;
|
||||
};
|
||||
Reference in New Issue
Block a user