mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6941 Move HistogramData into separate file for easier reuse.
This commit is contained in:
parent
c21f243895
commit
772e9cf02d
@ -172,7 +172,7 @@ void RicGridStatisticsDialog::setHistogramData( RimGridView* view )
|
||||
aggr->setStyle( QwtPlotCurve::Steps );
|
||||
aggr->setCurveAttribute( QwtPlotCurve::Inverted );
|
||||
|
||||
Rim3dOverlayInfoConfig::HistogramData histogramData = overlayInfo->histogramData();
|
||||
RimHistogramData histogramData = overlayInfo->histogramData();
|
||||
|
||||
if ( histogramData.isHistogramVectorValid() )
|
||||
{
|
||||
@ -257,7 +257,7 @@ void RicGridStatisticsDialog::deletePlotItems( QwtPlot* plot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridStatisticsDialog::setMarkers( const Rim3dOverlayInfoConfig::HistogramData& histData, QwtPlot* plot )
|
||||
void RicGridStatisticsDialog::setMarkers( const RimHistogramData& histData, QwtPlot* plot )
|
||||
{
|
||||
QwtPlotMarker* marker;
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <QDialog>
|
||||
@ -33,6 +31,7 @@ class QMainWindow;
|
||||
class QToolBar;
|
||||
class RimEclipseView;
|
||||
class RimGridView;
|
||||
class RimHistogramData;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -57,7 +56,7 @@ private:
|
||||
private:
|
||||
void createAndConnectToolbarActions();
|
||||
void deletePlotItems( QwtPlot* plot );
|
||||
static void setMarkers( const Rim3dOverlayInfoConfig::HistogramData& histData, QwtPlot* plot );
|
||||
static void setMarkers( const RimHistogramData& histData, QwtPlot* plot );
|
||||
static QwtPlotMarker* createVerticalPlotMarker( const QColor& color, double xValue );
|
||||
void adjustTextEditHeightToContent();
|
||||
|
||||
|
@ -38,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimCalcScript.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimExportInputPropertySettings.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimBinaryExportSettings.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/Rim3dOverlayInfoConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimHistogramData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTensorResults.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.h
|
||||
@ -196,6 +197,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimCalcScript.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimExportInputPropertySettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimBinaryExportSettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/Rim3dOverlayInfoConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimHistogramData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTensorResults.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.cpp
|
||||
|
@ -178,7 +178,7 @@ void Rim3dOverlayInfoConfig::setPosition( cvf::Vec2ui position )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
|
||||
RimHistogramData Rim3dOverlayInfoConfig::histogramData()
|
||||
{
|
||||
auto eclipseView = dynamic_cast<RimEclipseView*>( m_viewDef.p() );
|
||||
auto geoMechView = dynamic_cast<RimGeoMechView*>( m_viewDef.p() );
|
||||
@ -193,31 +193,7 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
|
||||
return histogramData( eclipseView );
|
||||
else if ( geoMechView )
|
||||
return histogramData( geoMechView );
|
||||
return HistogramData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dOverlayInfoConfig::HistogramData::isMinMaxValid() const
|
||||
{
|
||||
return isValid( min ) && isValid( max );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dOverlayInfoConfig::HistogramData::isValid( double parameter ) const
|
||||
{
|
||||
return parameter != HUGE_VAL && parameter != -HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dOverlayInfoConfig::HistogramData::isHistogramVectorValid() const
|
||||
{
|
||||
return histogram && histogram->size() > 0 && isMinMaxValid();
|
||||
return RimHistogramData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -249,7 +225,7 @@ QString Rim3dOverlayInfoConfig::caseInfoText()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString Rim3dOverlayInfoConfig::resultInfoText( const HistogramData& histData )
|
||||
QString Rim3dOverlayInfoConfig::resultInfoText( const RimHistogramData& histData )
|
||||
{
|
||||
auto eclipseView = dynamic_cast<RimEclipseView*>( m_viewDef.p() );
|
||||
auto geoMechView = dynamic_cast<RimGeoMechView*>( m_viewDef.p() );
|
||||
@ -327,9 +303,9 @@ bool Rim3dOverlayInfoConfig::showVersionInfo() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( RimEclipseContourMapView* contourMap )
|
||||
RimHistogramData Rim3dOverlayInfoConfig::histogramData( RimEclipseContourMapView* contourMap )
|
||||
{
|
||||
HistogramData histData;
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( contourMap )
|
||||
{
|
||||
@ -349,9 +325,9 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( Rim
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( RimGeoMechContourMapView* contourMap )
|
||||
RimHistogramData Rim3dOverlayInfoConfig::histogramData( RimGeoMechContourMapView* contourMap )
|
||||
{
|
||||
HistogramData histData;
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( contourMap )
|
||||
{
|
||||
@ -371,9 +347,9 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( Rim
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( RimEclipseView* eclipseView )
|
||||
RimHistogramData Rim3dOverlayInfoConfig::histogramData( RimEclipseView* eclipseView )
|
||||
{
|
||||
HistogramData histData;
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( eclipseView )
|
||||
{
|
||||
@ -511,9 +487,9 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( Rim
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData( RimGeoMechView* geoMechView )
|
||||
RimHistogramData Rim3dOverlayInfoConfig::histogramData( RimGeoMechView* geoMechView )
|
||||
{
|
||||
HistogramData histData;
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( geoMechView )
|
||||
{
|
||||
@ -693,9 +669,9 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimGeoMechView* geoMechView )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString Rim3dOverlayInfoConfig::resultInfoText( const HistogramData& histData,
|
||||
RimEclipseView* eclipseView,
|
||||
bool showVolumeWeightedMean )
|
||||
QString Rim3dOverlayInfoConfig::resultInfoText( const RimHistogramData& histData,
|
||||
RimEclipseView* eclipseView,
|
||||
bool showVolumeWeightedMean )
|
||||
{
|
||||
QString infoText;
|
||||
|
||||
@ -842,7 +818,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const HistogramData& histData,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString Rim3dOverlayInfoConfig::resultInfoText( const HistogramData& histData, RimGeoMechView* geoMechView )
|
||||
QString Rim3dOverlayInfoConfig::resultInfoText( const RimHistogramData& histData, RimGeoMechView* geoMechView )
|
||||
{
|
||||
QString infoText;
|
||||
|
||||
@ -1129,7 +1105,7 @@ void Rim3dOverlayInfoConfig::setReservoirView( RimGridView* ownerReservoirView )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::updateEclipse3DInfo( RimEclipseView* eclipseView )
|
||||
{
|
||||
HistogramData histData;
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( m_showHistogram() || m_showResultInfo() )
|
||||
{
|
||||
@ -1171,7 +1147,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo( RimEclipseView* eclipseView )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo( RimGeoMechView* geoMechView )
|
||||
{
|
||||
HistogramData histData;
|
||||
RimHistogramData histData;
|
||||
|
||||
if ( m_showResultInfo() || m_showHistogram() )
|
||||
{
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimHistogramData.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -47,37 +49,6 @@ class Rim3dOverlayInfoConfig : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
class HistogramData
|
||||
{
|
||||
public:
|
||||
HistogramData()
|
||||
: min( HUGE_VAL )
|
||||
, max( HUGE_VAL )
|
||||
, p10( HUGE_VAL )
|
||||
, p90( HUGE_VAL )
|
||||
, mean( HUGE_VAL )
|
||||
, weightedMean( HUGE_VAL )
|
||||
, sum( 0.0 )
|
||||
, histogram( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
double min;
|
||||
double max;
|
||||
double p10;
|
||||
double p90;
|
||||
double mean;
|
||||
double sum;
|
||||
double weightedMean;
|
||||
const std::vector<size_t>* histogram;
|
||||
|
||||
bool isMinMaxValid() const;
|
||||
bool isHistogramVectorValid() const;
|
||||
|
||||
private:
|
||||
bool isValid( double parameter ) const;
|
||||
};
|
||||
|
||||
public:
|
||||
Rim3dOverlayInfoConfig();
|
||||
~Rim3dOverlayInfoConfig() override;
|
||||
@ -88,10 +59,10 @@ public:
|
||||
|
||||
void setPosition( cvf::Vec2ui position );
|
||||
|
||||
HistogramData histogramData();
|
||||
QString timeStepText();
|
||||
QString caseInfoText();
|
||||
QString resultInfoText( const HistogramData& histData );
|
||||
RimHistogramData histogramData();
|
||||
QString timeStepText();
|
||||
QString caseInfoText();
|
||||
QString resultInfoText( const RimHistogramData& histData );
|
||||
|
||||
RicGridStatisticsDialog* getOrCreateGridStatisticsDialog();
|
||||
void showStatisticsInfoDialog( bool raise = true );
|
||||
@ -125,14 +96,14 @@ private:
|
||||
void update3DInfoIn2dViews() const;
|
||||
QString timeStepText( RimEclipseView* eclipseView );
|
||||
QString timeStepText( RimGeoMechView* geoMechView );
|
||||
HistogramData histogramData( RimEclipseContourMapView* contourMap );
|
||||
HistogramData histogramData( RimGeoMechContourMapView* contourMap );
|
||||
HistogramData histogramData( RimEclipseView* eclipseView );
|
||||
HistogramData histogramData( RimGeoMechView* geoMechView );
|
||||
RimHistogramData histogramData( RimEclipseContourMapView* contourMap );
|
||||
RimHistogramData histogramData( RimGeoMechContourMapView* contourMap );
|
||||
RimHistogramData histogramData( RimEclipseView* eclipseView );
|
||||
RimHistogramData histogramData( RimGeoMechView* geoMechView );
|
||||
QString caseInfoText( RimEclipseView* eclipseView );
|
||||
QString caseInfoText( RimGeoMechView* geoMechView );
|
||||
QString resultInfoText( const HistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean );
|
||||
QString resultInfoText( const HistogramData& histData, RimGeoMechView* geoMechView );
|
||||
QString resultInfoText( const RimHistogramData& histData, RimEclipseView* eclipseView, bool showVolumeWeightedMean );
|
||||
QString resultInfoText( const RimHistogramData& histData, RimGeoMechView* geoMechView );
|
||||
|
||||
void updateVisCellStatsIfNeeded();
|
||||
void displayPropertyFilteredStatisticsMessage( bool showSwitchToCurrentTimestep );
|
||||
|
60
ApplicationCode/ProjectDataModel/RimHistogramData.cpp
Normal file
60
ApplicationCode/ProjectDataModel/RimHistogramData.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimHistogramData.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimHistogramData::RimHistogramData()
|
||||
: min( HUGE_VAL )
|
||||
, max( HUGE_VAL )
|
||||
, p10( HUGE_VAL )
|
||||
, p90( HUGE_VAL )
|
||||
, mean( HUGE_VAL )
|
||||
, weightedMean( HUGE_VAL )
|
||||
, sum( 0.0 )
|
||||
, histogram( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimHistogramData::isMinMaxValid() const
|
||||
{
|
||||
return isValid( min ) && isValid( max );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimHistogramData::isValid( double parameter ) const
|
||||
{
|
||||
return parameter != HUGE_VAL && parameter != -HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimHistogramData::isHistogramVectorValid() const
|
||||
{
|
||||
return histogram && histogram->size() > 0 && isMinMaxValid();
|
||||
}
|
46
ApplicationCode/ProjectDataModel/RimHistogramData.h
Normal file
46
ApplicationCode/ProjectDataModel/RimHistogramData.h
Normal file
@ -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 <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimHistogramData
|
||||
{
|
||||
public:
|
||||
RimHistogramData();
|
||||
|
||||
double min;
|
||||
double max;
|
||||
double p10;
|
||||
double p90;
|
||||
double mean;
|
||||
double sum;
|
||||
double weightedMean;
|
||||
const std::vector<size_t>* histogram;
|
||||
|
||||
bool isMinMaxValid() const;
|
||||
bool isHistogramVectorValid() const;
|
||||
|
||||
private:
|
||||
bool isValid( double parameter ) const;
|
||||
};
|
Loading…
Reference in New Issue
Block a user