mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2167 statistics dialog. Include statistics snapshot under 'Snapshot all views to file'
This commit is contained in:
parent
6e67f71082
commit
7fa9b15716
@ -26,6 +26,7 @@
|
|||||||
#include "RimViewWindow.h"
|
#include "RimViewWindow.h"
|
||||||
#include "RimView.h"
|
#include "RimView.h"
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
|
#include "Rim3dOverlayInfoConfig.h"
|
||||||
|
|
||||||
#include "RicSnapshotViewToFileFeature.h"
|
#include "RicSnapshotViewToFileFeature.h"
|
||||||
#include "RicSnapshotFilenameGenerator.h"
|
#include "RicSnapshotFilenameGenerator.h"
|
||||||
@ -120,6 +121,11 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(QStrin
|
|||||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||||
|
|
||||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, riv);
|
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, riv);
|
||||||
|
|
||||||
|
// Statistics dialog
|
||||||
|
QImage img = riv->overlayInfoConfig()->statisticsDialogScreenShotImage();
|
||||||
|
absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName + "_Statistics", ".png");
|
||||||
|
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
@ -116,13 +116,22 @@ void RicGridStatisticsDialog::setLabel(const QString& labelText)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicGridStatisticsDialog::setCurrentRimView(RimView* rimView)
|
void RicGridStatisticsDialog::updateFromRimView(RimView* rimView)
|
||||||
{
|
{
|
||||||
m_currentRimView = rimView;
|
m_currentRimView = rimView;
|
||||||
setInfoText(m_currentRimView);
|
setInfoText(m_currentRimView);
|
||||||
setHistogramData(m_currentRimView);
|
setHistogramData(m_currentRimView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QImage RicGridStatisticsDialog::screenShotImage()
|
||||||
|
{
|
||||||
|
QPixmap shot = QPixmap::grabWidget(m_mainViewWidget, m_mainViewWidget->rect());
|
||||||
|
return shot.toImage();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -212,10 +221,10 @@ void RicGridStatisticsDialog::setHistogramData(RimView* view)
|
|||||||
void RicGridStatisticsDialog::createAndConnectToolbarActions()
|
void RicGridStatisticsDialog::createAndConnectToolbarActions()
|
||||||
{
|
{
|
||||||
QAction* scrShotToClipboardAction = m_toolBar->addAction(RicSnapshotViewToClipboardFeature::icon(), RicSnapshotViewToClipboardFeature::text());
|
QAction* scrShotToClipboardAction = m_toolBar->addAction(RicSnapshotViewToClipboardFeature::icon(), RicSnapshotViewToClipboardFeature::text());
|
||||||
connect(scrShotToClipboardAction, SIGNAL(triggered()), this, SLOT(screenShotToClipboard()));
|
connect(scrShotToClipboardAction, SIGNAL(triggered()), this, SLOT(slotScreenShotToClipboard()));
|
||||||
|
|
||||||
QAction* scrShotToFileAction = m_toolBar->addAction(RicSnapshotViewToFileFeature::icon(), RicSnapshotViewToFileFeature::text());
|
QAction* scrShotToFileAction = m_toolBar->addAction(RicSnapshotViewToFileFeature::icon(), RicSnapshotViewToFileFeature::text());
|
||||||
connect(scrShotToFileAction, SIGNAL(triggered()), this, SLOT(screenShotToFile()));
|
connect(scrShotToFileAction, SIGNAL(triggered()), this, SLOT(slotScreenShotToFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -296,18 +305,18 @@ void RicGridStatisticsDialog::slotDialogFinished()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicGridStatisticsDialog::screenShotToClipboard()
|
void RicGridStatisticsDialog::slotScreenShotToClipboard()
|
||||||
{
|
{
|
||||||
QPixmap shot = QPixmap::grabWidget(m_mainViewWidget, m_mainViewWidget->rect());
|
QImage snapshotImage = screenShotImage();
|
||||||
RicSnapshotViewToClipboardFeature::copyToClipboard(shot.toImage());
|
RicSnapshotViewToClipboardFeature::copyToClipboard(snapshotImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicGridStatisticsDialog::screenShotToFile()
|
void RicGridStatisticsDialog::slotScreenShotToFile()
|
||||||
{
|
{
|
||||||
QPixmap shot = QPixmap::grabWidget(m_mainViewWidget, m_mainViewWidget->rect());
|
QImage snapshotImage = screenShotImage();
|
||||||
QString defaultFileBaseName;
|
QString defaultFileBaseName;
|
||||||
if (m_currentRimView)
|
if (m_currentRimView)
|
||||||
{
|
{
|
||||||
@ -318,5 +327,5 @@ void RicGridStatisticsDialog::screenShotToFile()
|
|||||||
{
|
{
|
||||||
defaultFileBaseName = "Snapshot_Statistics";
|
defaultFileBaseName = "Snapshot_Statistics";
|
||||||
}
|
}
|
||||||
RicSnapshotViewToFileFeature::saveToFile(shot.toImage(), defaultFileBaseName);
|
RicSnapshotViewToFileFeature::saveToFile(snapshotImage, defaultFileBaseName);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@ public:
|
|||||||
~RicGridStatisticsDialog();
|
~RicGridStatisticsDialog();
|
||||||
|
|
||||||
void setLabel(const QString& labelText);
|
void setLabel(const QString& labelText);
|
||||||
void setCurrentRimView(RimView* rimView);
|
void updateFromRimView(RimView* rimView);
|
||||||
|
QImage screenShotImage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setInfoText(RimView* eclipseView);
|
void setInfoText(RimView* eclipseView);
|
||||||
@ -61,8 +62,8 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotDialogFinished();
|
void slotDialogFinished();
|
||||||
void screenShotToClipboard();
|
void slotScreenShotToClipboard();
|
||||||
void screenShotToFile();
|
void slotScreenShotToFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QToolBar* m_toolBar;
|
QToolBar* m_toolBar;
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "RiuViewer.h"
|
#include "RiuViewer.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
|
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -213,6 +214,27 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QImage Rim3dOverlayInfoConfig::statisticsDialogScreenShotImage()
|
||||||
|
{
|
||||||
|
bool isDialogOpen = m_gridStatisticsDialog->isVisible();
|
||||||
|
if (!isDialogOpen)
|
||||||
|
{
|
||||||
|
showStatisticsInfoDialog(false);
|
||||||
|
QApplication::processEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage img = m_gridStatisticsDialog->screenShotImage();
|
||||||
|
|
||||||
|
if (!isDialogOpen)
|
||||||
|
{
|
||||||
|
m_gridStatisticsDialog->close();
|
||||||
|
}
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -604,7 +626,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void Rim3dOverlayInfoConfig::showStatisticsInfoDialog()
|
void Rim3dOverlayInfoConfig::showStatisticsInfoDialog(bool raise)
|
||||||
{
|
{
|
||||||
if (m_viewDef)
|
if (m_viewDef)
|
||||||
{
|
{
|
||||||
@ -613,11 +635,12 @@ void Rim3dOverlayInfoConfig::showStatisticsInfoDialog()
|
|||||||
m_gridStatisticsDialog->show();
|
m_gridStatisticsDialog->show();
|
||||||
|
|
||||||
m_gridStatisticsDialog->setLabel("Grid statistics");
|
m_gridStatisticsDialog->setLabel("Grid statistics");
|
||||||
m_gridStatisticsDialog->setCurrentRimView(m_viewDef);
|
m_gridStatisticsDialog->updateFromRimView(m_viewDef);
|
||||||
//m_gridStatisticsDialog->setInfoText(m_viewDef);
|
|
||||||
//m_gridStatisticsDialog->setHistogramData(m_viewDef);
|
|
||||||
|
|
||||||
m_gridStatisticsDialog->raise();
|
if (raise)
|
||||||
|
{
|
||||||
|
m_gridStatisticsDialog->raise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,9 +681,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
|||||||
updateEclipse3DInfo(reservoirView);
|
updateEclipse3DInfo(reservoirView);
|
||||||
|
|
||||||
// Update statistics dialog
|
// Update statistics dialog
|
||||||
m_gridStatisticsDialog->setCurrentRimView(reservoirView);
|
m_gridStatisticsDialog->updateFromRimView(reservoirView);
|
||||||
//m_gridStatisticsDialog->setInfoText(reservoirView);
|
|
||||||
//m_gridStatisticsDialog->setHistogramData(reservoirView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||||
@ -671,9 +692,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
|||||||
updateGeoMech3DInfo(geoMechView);
|
updateGeoMech3DInfo(geoMechView);
|
||||||
|
|
||||||
// Update statistics dialog
|
// Update statistics dialog
|
||||||
m_gridStatisticsDialog->setCurrentRimView(geoMechView);
|
m_gridStatisticsDialog->updateFromRimView(geoMechView);
|
||||||
//m_gridStatisticsDialog->setInfoText(geoMechView);
|
|
||||||
//m_gridStatisticsDialog->setHistogramData(geoMechView);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,8 @@ public:
|
|||||||
QString caseInfoText();
|
QString caseInfoText();
|
||||||
QString resultInfoText(const HistogramData& histData);
|
QString resultInfoText(const HistogramData& histData);
|
||||||
|
|
||||||
void showStatisticsInfoDialog();
|
void showStatisticsInfoDialog(bool raise = true);
|
||||||
|
QImage statisticsDialogScreenShotImage();
|
||||||
|
|
||||||
enum StatisticsTimeRangeType
|
enum StatisticsTimeRangeType
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user