mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#2102 Statistics dialog. Dialog contents updates as 3D view is modified
This commit is contained in:
parent
4b48da4250
commit
24843f55b6
@ -24,7 +24,6 @@
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuGridStatisticsHistogramWidget.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
@ -49,7 +48,6 @@ RicGridStatisticsDialog::RicGridStatisticsDialog(QWidget* parent)
|
||||
// Create widgets
|
||||
m_label = new QLabel();
|
||||
m_textEdit = new QTextEdit();
|
||||
//m_histogram = new RiuGridStatisticsHistogramWidget(this);
|
||||
m_historgramPlot = new QwtPlot();
|
||||
m_aggregatedPlot = new QwtPlot();
|
||||
m_buttons = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
@ -107,6 +105,9 @@ void RicGridStatisticsDialog::setInfoText(RimEclipseView* eclipseView)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridStatisticsDialog::setHistogramData(RimEclipseView* eclipseView)
|
||||
{
|
||||
deletePlotItems(m_historgramPlot);
|
||||
deletePlotItems(m_aggregatedPlot);
|
||||
|
||||
Rim3dOverlayInfoConfig* overlayInfo = eclipseView->overlayInfoConfig();
|
||||
if (eclipseView && overlayInfo)
|
||||
{
|
||||
@ -140,19 +141,40 @@ void RicGridStatisticsDialog::setHistogramData(RimEclipseView* eclipseView)
|
||||
m_historgramPlot->setAxisScale(QwtPlot::xBottom, histogramData.min, histogramData.max);
|
||||
m_aggregatedPlot->setAxisScale(QwtPlot::xBottom, histogramData.min, histogramData.max);
|
||||
|
||||
// Samples
|
||||
hist->setSamples(histSamples);
|
||||
aggr->setSamples(aggrSamples);
|
||||
hist->attach(m_historgramPlot);
|
||||
aggr->attach(m_aggregatedPlot);
|
||||
|
||||
// Markers
|
||||
setMarkers(histogramData, m_historgramPlot);
|
||||
setMarkers(histogramData, m_aggregatedPlot);
|
||||
|
||||
// Refresh plot
|
||||
m_historgramPlot->replot();
|
||||
m_aggregatedPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridStatisticsDialog::deletePlotItems(QwtPlot* plot)
|
||||
{
|
||||
auto itemList = plot->itemList();
|
||||
for (auto item : itemList)
|
||||
{
|
||||
if (dynamic_cast<QwtPlotMarker*>(item)
|
||||
|| dynamic_cast<QwtPlotCurve*>(item)
|
||||
|| dynamic_cast<QwtPlotHistogram*>(item))
|
||||
{
|
||||
item->detach();
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -189,10 +211,5 @@ QwtPlotMarker* RicGridStatisticsDialog::createVerticalPlotMarker(const QColor& c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridStatisticsDialog::slotDialogFinished()
|
||||
{
|
||||
//RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
//if (plotwindow)
|
||||
//{
|
||||
// plotwindow->cleanUpTemporaryWidgets();
|
||||
//}
|
||||
close();
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
class QDialogButtonBox;
|
||||
class RiuGridStatisticsHistogramWidget;
|
||||
class QwtPlot;
|
||||
class QwtPlotMarker;
|
||||
class RimEclipseView;
|
||||
@ -47,6 +46,7 @@ public:
|
||||
void setHistogramData(RimEclipseView* eclipseView);
|
||||
|
||||
private:
|
||||
void deletePlotItems(QwtPlot* plot);
|
||||
static void setMarkers(const Rim3dOverlayInfoConfig::HistogramData& histData, QwtPlot* plot);
|
||||
static QwtPlotMarker* createVerticalPlotMarker(const QColor& color, double xValue);
|
||||
|
||||
@ -56,7 +56,6 @@ private slots:
|
||||
private:
|
||||
QLabel* m_label;
|
||||
QTextEdit* m_textEdit;
|
||||
RiuGridStatisticsHistogramWidget* m_histogram;
|
||||
QwtPlot* m_historgramPlot;
|
||||
QwtPlot* m_aggregatedPlot;
|
||||
QDialogButtonBox* m_buttons;
|
||||
|
@ -32,25 +32,6 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowGridStatisticsFeature, "RicShowGridStatisticsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog()
|
||||
//{
|
||||
// static RicSummaryCurveCalculatorDialog* singleton = new RicSummaryCurveCalculatorDialog(nullptr);
|
||||
//
|
||||
// return singleton;
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//void RicShowSummaryCurveCalculatorFeature::hideCurveCalculatorDialog()
|
||||
//{
|
||||
// auto dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog();
|
||||
//
|
||||
// dialog->hide();
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -65,19 +46,12 @@ bool RicShowGridStatisticsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowGridStatisticsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RicGridStatisticsDialog* dialog = new RicGridStatisticsDialog(nullptr);
|
||||
dialog->setLabel("Grid statistics");
|
||||
|
||||
auto eclipseView = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseView*>();
|
||||
|
||||
if (eclipseView)
|
||||
if (eclipseView && eclipseView->overlayInfoConfig())
|
||||
{
|
||||
dialog->setInfoText(eclipseView);
|
||||
dialog->setHistogramData(eclipseView);
|
||||
eclipseView->overlayInfoConfig()->showStatisticsInfoDialog();
|
||||
}
|
||||
|
||||
dialog->show();
|
||||
dialog->raise();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -29,10 +29,6 @@ class RicShowGridStatisticsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
//static RicSummaryCurveCalculatorDialog* curveCalculatorDialog();
|
||||
//static void hideCurveCalculatorDialog();
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
|
||||
#include "RicGridStatisticsDialog.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseNativeVisibleCellsStatCalc.h"
|
||||
@ -102,6 +104,8 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
|
||||
//m_statisticsCellRange.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_isVisCellStatUpToDate = false;
|
||||
|
||||
m_gridStatisticsDialog = std::unique_ptr<RicGridStatisticsDialog>(new RicGridStatisticsDialog(nullptr));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -366,6 +370,24 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
|
||||
return infoText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::showStatisticsInfoDialog()
|
||||
{
|
||||
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||
|
||||
if (eclipseView)
|
||||
{
|
||||
m_gridStatisticsDialog->setLabel("Grid statistics");
|
||||
m_gridStatisticsDialog->setInfoText(eclipseView);
|
||||
m_gridStatisticsDialog->setHistogramData(eclipseView);
|
||||
m_gridStatisticsDialog->resize(600, 800);
|
||||
m_gridStatisticsDialog->show();
|
||||
m_gridStatisticsDialog->raise();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -398,7 +420,14 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
}
|
||||
|
||||
RimEclipseView * reservoirView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||
if (reservoirView) updateEclipse3DInfo(reservoirView);
|
||||
if (reservoirView)
|
||||
{
|
||||
updateEclipse3DInfo(reservoirView);
|
||||
|
||||
// Update statistics dialog
|
||||
m_gridStatisticsDialog->setInfoText(reservoirView);
|
||||
m_gridStatisticsDialog->setHistogramData(reservoirView);
|
||||
}
|
||||
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||
if (geoMechView) updateGeoMech3DInfo(geoMechView);
|
||||
}
|
||||
|
@ -28,11 +28,13 @@
|
||||
|
||||
#include "cvfVector2.h"
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
class RimEclipseView;
|
||||
class RimGeoMechView;
|
||||
class RimView;
|
||||
class RigStatisticsDataCache;
|
||||
class RicGridStatisticsDialog;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -70,6 +72,8 @@ public:
|
||||
QString caseInfoText(RimEclipseView* eclipseView);
|
||||
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView);
|
||||
|
||||
void showStatisticsInfoDialog();
|
||||
|
||||
enum StatisticsTimeRangeType
|
||||
{
|
||||
ALL_TIMESTEPS,
|
||||
@ -110,4 +114,6 @@ private:
|
||||
bool hasInvalidStatisticsCombination();
|
||||
bool m_isVisCellStatUpToDate;
|
||||
cvf::ref<RigStatisticsDataCache> m_visibleCellStatistics;
|
||||
|
||||
std::unique_ptr<RicGridStatisticsDialog> m_gridStatisticsDialog;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user