mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-26 21:27:15 -05:00
Remove GridStatisticsPlot and EnsembleFractureStatisticsPlot.
This commit is contained in:
@@ -1860,5 +1860,7 @@ RiaKeyValueStore<char>* RiaApplication::keyValueStore() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmDeprecation> RiaApplication::defaultDeprecations()
|
||||
{
|
||||
// Deprecations can be used for adding info messages when pdm fields have been removed.
|
||||
// To extend the concept to pdm objects more work is needed.
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -254,27 +254,5 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCornerPointCase.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
list(
|
||||
APPEND
|
||||
SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlot.h
|
||||
)
|
||||
|
||||
list(
|
||||
APPEND
|
||||
SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleFractureStatisticsPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridStatisticsPlot.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- 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 "RimEnsembleFractureStatisticsPlot.h"
|
||||
|
||||
#include "RigEnsembleFractureStatisticsCalculator.h"
|
||||
#include "RimEnsembleFractureStatistics.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RigHistogramData.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatisticsPlot, "EnsembleFractureStatisticsPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleFractureStatisticsPlot::RimEnsembleFractureStatisticsPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Ensemble Fracture Statistics Plot", "", "", "A Plot of Ensemble Fracture Statistics" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatistics, "EnsembleFractureStatistics", "Ensemble Fracture Statistics" );
|
||||
m_ensembleFractureStatistics.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_property, "Property", "Property" );
|
||||
|
||||
m_plotLegendsHorizontal.uiCapability()->setUiHidden( true );
|
||||
|
||||
setDefaults();
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleFractureStatisticsPlot::~RimEnsembleFractureStatisticsPlot()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFractureStatisticsPlot::setDefaults()
|
||||
{
|
||||
auto esfItems = RimProject::current()->descendantsIncludingThisOfType<RimEnsembleFractureStatistics>();
|
||||
if ( !esfItems.empty() ) m_ensembleFractureStatistics = esfItems.front();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFractureStatisticsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimStatisticsPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
loadDataAndUpdate();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFractureStatisticsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_ensembleFractureStatistics );
|
||||
uiOrdering.add( &m_property );
|
||||
|
||||
bool showNumHistogramBins = true;
|
||||
RimStatisticsPlot::uiOrderingForHistogram( uiConfigName, uiOrdering, showNumHistogramBins );
|
||||
|
||||
uiOrderingForLegendsAndFonts( uiConfigName, uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEnsembleFractureStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimStatisticsPlot::calculateValueOptions( fieldNeedingOptions );
|
||||
|
||||
if ( fieldNeedingOptions == &m_ensembleFractureStatistics )
|
||||
{
|
||||
std::vector<RimEnsembleFractureStatistics*> esfItems =
|
||||
RimProject::current()->descendantsIncludingThisOfType<RimEnsembleFractureStatistics>();
|
||||
for ( auto item : esfItems )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( item->name(), item ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEnsembleFractureStatisticsPlot::hasStatisticsData() const
|
||||
{
|
||||
return ( m_viewer && m_ensembleFractureStatistics );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigHistogramData RimEnsembleFractureStatisticsPlot::createStatisticsData() const
|
||||
{
|
||||
RigHistogramData histogramData =
|
||||
RigEnsembleFractureStatisticsCalculator::createStatisticsData( m_ensembleFractureStatistics(), m_property(), m_numHistogramBins() );
|
||||
|
||||
return histogramData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEnsembleFractureStatisticsPlot::createAutoName() const
|
||||
{
|
||||
if ( m_ensembleFractureStatistics() == nullptr )
|
||||
{
|
||||
return "Undefined";
|
||||
}
|
||||
|
||||
QStringList nameTags;
|
||||
nameTags += m_ensembleFractureStatistics()->name();
|
||||
nameTags += caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::uiText( m_property() );
|
||||
|
||||
return nameTags.join( ", " );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEnsembleFractureStatisticsPlot::createXAxisTitle() const
|
||||
{
|
||||
if ( m_ensembleFractureStatistics() == nullptr ) return "";
|
||||
|
||||
return caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::uiText( m_property() );
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- 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 "RigEnsembleFractureStatisticsCalculator.h"
|
||||
|
||||
#include "RimStatisticsPlot.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEnsembleFractureStatistics;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEnsembleFractureStatisticsPlot : public RimStatisticsPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEnsembleFractureStatisticsPlot();
|
||||
~RimEnsembleFractureStatisticsPlot() override;
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
QString createAutoName() const override;
|
||||
QString createXAxisTitle() const override;
|
||||
|
||||
void setDefaults();
|
||||
bool hasStatisticsData() const override;
|
||||
RigHistogramData createStatisticsData() const override;
|
||||
|
||||
protected:
|
||||
caf::PdmPtrField<RimEnsembleFractureStatistics*> m_ensembleFractureStatistics;
|
||||
caf::PdmField<caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>> m_property;
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- 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 "RimEnsembleFractureStatisticsPlotCollection.h"
|
||||
|
||||
#include "RimEnsembleFractureStatisticsPlot.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatisticsPlotCollection, "EnsembleFractureStatisticsPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleFractureStatisticsPlotCollection::RimEnsembleFractureStatisticsPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Ensemble Fracture Statistics Plots", ":/WellLogPlots16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlots, "EnsembleFractureStatisticsPlots", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFractureStatisticsPlotCollection::loadDataAndUpdateAllPlots()
|
||||
{
|
||||
for ( const auto& w : m_ensembleFractureStatisticsPlots() )
|
||||
{
|
||||
w->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEnsembleFractureStatisticsPlotCollection::plotCount() const
|
||||
{
|
||||
return m_ensembleFractureStatisticsPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFractureStatisticsPlotCollection::addEnsembleFractureStatisticsPlot( RimEnsembleFractureStatisticsPlot* newPlot )
|
||||
{
|
||||
m_ensembleFractureStatisticsPlots.push_back( newPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEnsembleFractureStatisticsPlot*> RimEnsembleFractureStatisticsPlotCollection::ensembleFractureStatisticsPlots() const
|
||||
{
|
||||
return m_ensembleFractureStatisticsPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleFractureStatisticsPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_ensembleFractureStatisticsPlots.deleteChildren();
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- 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 "RimAbstractPlotCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimEnsembleFractureStatisticsPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEnsembleFractureStatisticsPlotCollection : public caf::PdmObject, public RimPlotCollection
|
||||
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEnsembleFractureStatisticsPlotCollection();
|
||||
|
||||
void addEnsembleFractureStatisticsPlot( RimEnsembleFractureStatisticsPlot* newPlot );
|
||||
|
||||
std::vector<RimEnsembleFractureStatisticsPlot*> ensembleFractureStatisticsPlots() const;
|
||||
|
||||
size_t plotCount() const override;
|
||||
void loadDataAndUpdateAllPlots() override;
|
||||
|
||||
void deleteAllPlots() override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimEnsembleFractureStatisticsPlot*> m_ensembleFractureStatisticsPlots;
|
||||
};
|
||||
@@ -1,335 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimGridStatisticsPlot.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimHistogramCalculator.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RigHistogramData.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridStatisticsPlot, "GridStatisticsPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridStatisticsPlot::RimGridStatisticsPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Grid Statistics Plot", ":/statistics.png", "", "A Plot of Grid Statistics" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" );
|
||||
m_case.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "Time Step" );
|
||||
m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "VisibleCellView", "Filter by 3d View Visibility" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_property, "Property", "Property" );
|
||||
m_property = new RimEclipseResultDefinition( caf::PdmUiItemInfo::TOP );
|
||||
m_property.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_property->setTernaryEnabled( false );
|
||||
|
||||
m_plotLegendsHorizontal.uiCapability()->setUiHidden( true );
|
||||
|
||||
setDefaults();
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridStatisticsPlot::~RimGridStatisticsPlot()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::setDefaults()
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
if ( project )
|
||||
{
|
||||
if ( !project->eclipseCases().empty() )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = project->eclipseCases().front();
|
||||
m_case = eclipseCase;
|
||||
m_property->setEclipseCase( eclipseCase );
|
||||
|
||||
m_property->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
m_property->setResultVariable( "PORO" );
|
||||
|
||||
if ( eclipseCase && !eclipseCase->reservoirViews().empty() )
|
||||
{
|
||||
m_cellFilterView.setValue( eclipseCase->reservoirViews().front() );
|
||||
}
|
||||
|
||||
m_numHistogramBins = 15;
|
||||
m_tickNumberFormat = RiaNumberFormat::NumberFormatType::FIXED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::setPropertiesFromView( RimEclipseView* view )
|
||||
{
|
||||
CAF_ASSERT( view );
|
||||
|
||||
m_case = view->ownerCase();
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
|
||||
if ( eclipseCase ) m_property->setEclipseCase( eclipseCase );
|
||||
|
||||
const RimEclipseResultDefinition* resDef = dynamic_cast<const RimEclipseResultDefinition*>( view->cellResult() );
|
||||
if ( resDef ) m_property->simpleCopy( resDef );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimStatisticsPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_case )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
m_property->setEclipseCase( eclipseCase );
|
||||
m_property->updateConnectedEditors();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_case );
|
||||
if ( m_case )
|
||||
{
|
||||
uiOrdering.add( &m_timeStep );
|
||||
uiOrdering.add( &m_cellFilterView );
|
||||
caf::PdmUiGroup* propertyGroup = uiOrdering.addNewGroup( "Property" );
|
||||
m_property->uiOrdering( uiConfigName, *propertyGroup );
|
||||
}
|
||||
|
||||
const bool showNumHistogramBins = true;
|
||||
RimStatisticsPlot::uiOrderingForHistogram( uiConfigName, uiOrdering, showNumHistogramBins );
|
||||
RimStatisticsPlot::uiOrderingForLegendsAndFonts( uiConfigName, uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimGridStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimStatisticsPlot::calculateValueOptions( fieldNeedingOptions );
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimTools::eclipseCaseOptionItems( &options );
|
||||
if ( options.empty() )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_timeStep )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "All Time Steps", -1 ) );
|
||||
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_cellFilterView )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews() )
|
||||
{
|
||||
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
|
||||
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::initAfterRead()
|
||||
{
|
||||
RimStatisticsPlot::initAfterRead();
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
m_property->setEclipseCase( eclipseCase );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlot::cellFilterViewUpdated()
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridStatisticsPlot::hasStatisticsData() const
|
||||
{
|
||||
return ( m_viewer && m_case() && m_property() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigHistogramData RimGridStatisticsPlot::createStatisticsData() const
|
||||
{
|
||||
std::unique_ptr<RimHistogramCalculator> histogramCalculator;
|
||||
histogramCalculator = std::make_unique<RimHistogramCalculator>();
|
||||
histogramCalculator->setNumBins( static_cast<size_t>( m_numHistogramBins() ) );
|
||||
|
||||
RigHistogramData histogramData;
|
||||
|
||||
RimHistogramCalculator::StatisticsCellRangeType cellRange = RimHistogramCalculator::StatisticsCellRangeType::ALL_CELLS;
|
||||
|
||||
RimHistogramCalculator::StatisticsTimeRangeType timeRange = RimHistogramCalculator::StatisticsTimeRangeType::ALL_TIMESTEPS;
|
||||
int timeStep = 0;
|
||||
if ( m_timeStep() != -1 && !m_property()->hasStaticResult() )
|
||||
{
|
||||
timeStep = m_timeStep();
|
||||
timeRange = RimHistogramCalculator::StatisticsTimeRangeType::CURRENT_TIMESTEP;
|
||||
}
|
||||
|
||||
if ( m_cellFilterView.value() )
|
||||
{
|
||||
// Filter by visible cells of the view
|
||||
cellRange = RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS;
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( m_cellFilterView.value() );
|
||||
histogramData = histogramCalculator->histogramData( eclipseView, m_property.value(), cellRange, timeRange, timeStep );
|
||||
}
|
||||
else
|
||||
{
|
||||
RimEclipseView* eclipseView = nullptr;
|
||||
histogramData = histogramCalculator->histogramData( eclipseView, m_property.value(), cellRange, timeRange, timeStep );
|
||||
}
|
||||
|
||||
return histogramData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridStatisticsPlot::createAutoName() const
|
||||
{
|
||||
if ( m_case() == nullptr )
|
||||
{
|
||||
return "Undefined";
|
||||
}
|
||||
|
||||
QStringList nameTags;
|
||||
nameTags += m_property()->resultVariable();
|
||||
nameTags += m_case()->caseUserDescription();
|
||||
|
||||
QString timeStepStr = timeStepString();
|
||||
if ( !timeStepStr.isEmpty() )
|
||||
{
|
||||
nameTags += timeStepStr;
|
||||
}
|
||||
|
||||
return nameTags.join( ", " );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridStatisticsPlot::timeStepString() const
|
||||
{
|
||||
if ( m_case() && m_property->hasDynamicResult() )
|
||||
{
|
||||
if ( m_timeStep == -1 )
|
||||
{
|
||||
return "All Time Steps";
|
||||
}
|
||||
return m_case->timeStepStrings()[m_timeStep];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridStatisticsPlot::createXAxisTitle() const
|
||||
{
|
||||
if ( m_case() == nullptr ) return "";
|
||||
|
||||
QStringList nameTags;
|
||||
nameTags += m_property()->resultVariable();
|
||||
|
||||
QString timeStepStr = timeStepString();
|
||||
if ( !timeStepStr.isEmpty() )
|
||||
{
|
||||
nameTags += timeStepStr;
|
||||
}
|
||||
|
||||
return nameTags.join( ", " );
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiaDefines.h"
|
||||
|
||||
#include "RimStatisticsPlot.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimCase;
|
||||
class RimPlot;
|
||||
class RimGridView;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimEclipseView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridStatisticsPlot : public RimStatisticsPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridStatisticsPlot();
|
||||
~RimGridStatisticsPlot() override;
|
||||
|
||||
void cellFilterViewUpdated();
|
||||
|
||||
void setPropertiesFromView( RimEclipseView* view );
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void initAfterRead() override;
|
||||
|
||||
QString createAutoName() const override;
|
||||
QString timeStepString() const;
|
||||
|
||||
QString createXAxisTitle() const override;
|
||||
|
||||
void setDefaults();
|
||||
bool hasStatisticsData() const override;
|
||||
RigHistogramData createStatisticsData() const override;
|
||||
|
||||
protected:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
caf::PdmPtrField<RimGridView*> m_cellFilterView;
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_property;
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimGridStatisticsPlotCollection.h"
|
||||
|
||||
#include "RimGridStatisticsPlot.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridStatisticsPlotCollection, "GridStatisticsPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridStatisticsPlotCollection::RimGridStatisticsPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Grid Statistics Plots", ":/WellLogPlots16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlots, "GridStatisticsPlots", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlotCollection::loadDataAndUpdateAllPlots()
|
||||
{
|
||||
for ( const auto& w : m_gridStatisticsPlots() )
|
||||
{
|
||||
w->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimGridStatisticsPlotCollection::plotCount() const
|
||||
{
|
||||
return m_gridStatisticsPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlotCollection::addGridStatisticsPlot( RimGridStatisticsPlot* newPlot )
|
||||
{
|
||||
m_gridStatisticsPlots.push_back( newPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridStatisticsPlot*> RimGridStatisticsPlotCollection::gridStatisticsPlots() const
|
||||
{
|
||||
return m_gridStatisticsPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridStatisticsPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_gridStatisticsPlots.deleteChildren();
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimAbstractPlotCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimGridStatisticsPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridStatisticsPlotCollection : public caf::PdmObject, public RimPlotCollection
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridStatisticsPlotCollection();
|
||||
|
||||
void addGridStatisticsPlot( RimGridStatisticsPlot* newPlot );
|
||||
|
||||
std::vector<RimGridStatisticsPlot*> gridStatisticsPlots() const;
|
||||
|
||||
void loadDataAndUpdateAllPlots() override;
|
||||
|
||||
void deleteAllPlots() override;
|
||||
|
||||
size_t plotCount() const override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimGridStatisticsPlot*> m_gridStatisticsPlots;
|
||||
};
|
||||
@@ -59,13 +59,6 @@
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "VerticalFlowPerformance/RimVfpPlotCollection.h"
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
#include "RimEnsembleFractureStatisticsPlot.h"
|
||||
#include "RimEnsembleFractureStatisticsPlotCollection.h"
|
||||
#include "RimGridStatisticsPlot.h"
|
||||
#include "RimGridStatisticsPlotCollection.h"
|
||||
#endif
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuProjectPropertyView.h"
|
||||
|
||||
@@ -129,12 +122,6 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
m_vfpPlotCollection = new RimVfpPlotCollection();
|
||||
m_histogramMultiPlotCollection = new RimHistogramMultiPlotCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlotCollection_OBSOLETE, "GridStatisticsPlotCollection", "" );
|
||||
m_gridStatisticsPlotCollection_OBSOLETE = new RimGridStatisticsPlotCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlotCollection_OBSOLETE, "EnsembleFractureStatisticsPlotCollection", "" );
|
||||
m_ensembleFractureStatisticsPlotCollection_OBSOLETE = new RimEnsembleFractureStatisticsPlotCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection_OBSOLETE, "SummaryPlotCollection", "Summary Plots" );
|
||||
m_summaryPlotCollection_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
m_summaryPlotCollection_OBSOLETE = new RimSummaryPlotCollection();
|
||||
@@ -334,24 +321,6 @@ RimHistogramMultiPlotCollection* RimMainPlotCollection::histogramMultiPlotCollec
|
||||
return m_histogramMultiPlotCollection();
|
||||
}
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridStatisticsPlotCollection* RimMainPlotCollection::gridStatisticsPlotCollection() const
|
||||
{
|
||||
return m_gridStatisticsPlotCollection_OBSOLETE();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleFractureStatisticsPlotCollection* RimMainPlotCollection::ensembleFractureStatisticsPlotCollection() const
|
||||
{
|
||||
return m_ensembleFractureStatisticsPlotCollection_OBSOLETE();
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -505,11 +474,6 @@ std::vector<RimPlotCollection*> RimMainPlotCollection::allPlotCollections() cons
|
||||
plotCollections.push_back( multiPlotCollection() );
|
||||
plotCollections.push_back( histogramMultiPlotCollection() );
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
plotCollections.push_back( gridStatisticsPlotCollection() );
|
||||
plotCollections.push_back( ensembleFractureStatisticsPlotCollection() );
|
||||
#endif
|
||||
|
||||
return plotCollections;
|
||||
}
|
||||
|
||||
@@ -527,11 +491,6 @@ std::vector<RimPlotCollection*> RimMainPlotCollection::plotCollectionsWithFormat
|
||||
plotCollections.push_back( multiPlotCollection() );
|
||||
plotCollections.push_back( stimPlanModelPlotCollection() );
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
plotCollections.push_back( gridStatisticsPlotCollection() );
|
||||
plotCollections.push_back( ensembleFractureStatisticsPlotCollection() );
|
||||
#endif
|
||||
|
||||
return plotCollections;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,6 @@ class RimVfpPlotCollection;
|
||||
class RimPlotCollection;
|
||||
class RimHistogramMultiPlotCollection;
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
class RimGridStatisticsPlotCollection;
|
||||
class RimEnsembleFractureStatisticsPlotCollection;
|
||||
#endif
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@@ -81,11 +76,6 @@ public:
|
||||
RimVfpPlotCollection* vfpPlotCollection() const;
|
||||
RimHistogramMultiPlotCollection* histogramMultiPlotCollection() const;
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
RimGridStatisticsPlotCollection* gridStatisticsPlotCollection() const;
|
||||
RimEnsembleFractureStatisticsPlotCollection* ensembleFractureStatisticsPlotCollection() const;
|
||||
#endif
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
void updateCurrentTimeStepInPlots();
|
||||
void updatePlotsWithFormations();
|
||||
@@ -126,9 +116,6 @@ private:
|
||||
caf::PdmChildField<RimVfpPlotCollection*> m_vfpPlotCollection;
|
||||
caf::PdmChildField<RimHistogramMultiPlotCollection*> m_histogramMultiPlotCollection;
|
||||
|
||||
caf::PdmChildField<RimGridStatisticsPlotCollection*> m_gridStatisticsPlotCollection_OBSOLETE;
|
||||
caf::PdmChildField<RimEnsembleFractureStatisticsPlotCollection*> m_ensembleFractureStatisticsPlotCollection_OBSOLETE;
|
||||
|
||||
caf::PdmField<bool> m_show;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection_OBSOLETE;
|
||||
|
||||
@@ -1,505 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimStatisticsPlot.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "RigHistogramData.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QtCharts/QBarSeries>
|
||||
#include <QtCharts/QBarSet>
|
||||
#include <QtCharts/QCategoryAxis>
|
||||
#include <QtCharts/QLegendMarker>
|
||||
#include <QtCharts/QLineSeries>
|
||||
#include <QtCharts/QValueAxis>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimStatisticsPlot::HistogramFrequencyType>::setUp()
|
||||
{
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::ABSOLUTE_FREQUENCY, "ABSOLUTE_FREQUENCY", "Absolute Frequency" );
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::RELATIVE_FREQUENCY, "RELATIVE_FREQUENCY", "Relative Frequency" );
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::RELATIVE_FREQUENCY_PERCENT, "RELATIVE_FREQUENCY_PERCENT", "Relative Frequency [%]" );
|
||||
setDefault( RimStatisticsPlot::HistogramFrequencyType::RELATIVE_FREQUENCY_PERCENT );
|
||||
}
|
||||
template <>
|
||||
void caf::AppEnum<RimStatisticsPlot::GraphType>::setUp()
|
||||
|
||||
{
|
||||
addItem( RimStatisticsPlot::GraphType::BAR_GRAPH, "BAR_GRAPH", "Bar Graph" );
|
||||
addItem( RimStatisticsPlot::GraphType::LINE_GRAPH, "LINE_GRAPH", "Line Graph" );
|
||||
setDefault( RimStatisticsPlot::GraphType::BAR_GRAPH );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimStatisticsPlot, "StatisticsPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStatisticsPlot::RimStatisticsPlot()
|
||||
{
|
||||
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" );
|
||||
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitField( &m_numHistogramBins, "NumHistogramBins", 50, "Number of Bins" );
|
||||
m_numHistogramBins.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_histogramBarColor, "HistogramBarColor", cvf::Color3f( cvf::Color3f::SKY_BLUE ), "Color" );
|
||||
|
||||
CAF_PDM_InitField( &m_histogramGapWidth, "HistogramGapWidth", 0.0, "Gap Width [%]" );
|
||||
m_histogramGapWidth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_histogramFrequencyType, "HistogramFrequencyType", "Frequency" );
|
||||
|
||||
CAF_PDM_InitField( &m_precision, "Precision", 4, "Significant Digits", "", "The number of significant digits displayed in the legend numbers", "" );
|
||||
CAF_PDM_InitField( &m_tickNumberFormat,
|
||||
"TickNumberFormat",
|
||||
caf::AppEnum<RiaNumberFormat::NumberFormatType>( RiaNumberFormat::NumberFormatType::AUTO ),
|
||||
"Number format" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_graphType, "GraphType", "Graph Type" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size" );
|
||||
m_axisValueFontSize = caf::FontTools::RelativeSize::Small;
|
||||
m_axisTitleFontSize = caf::FontTools::RelativeSize::Medium;
|
||||
|
||||
m_plotLegendsHorizontal.uiCapability()->setUiHidden( true );
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStatisticsPlot::~RimStatisticsPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimStatisticsPlot::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimStatisticsPlot::createPlotWidget( QWidget* mainWindowParent /*= nullptr */ )
|
||||
{
|
||||
return createViewWidget( mainWindowParent );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimStatisticsPlot::description() const
|
||||
{
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::zoomAll()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimStatisticsPlot::axisTitleFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisTitleFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimStatisticsPlot::axisValueFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisValueFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimStatisticsPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
QPixmap pix = m_viewer->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimStatisticsPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_viewer = new RiuQtChartView( this, mainWindowParent );
|
||||
m_viewer->setRenderHint( QPainter::Antialiasing );
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::deleteViewWidget()
|
||||
{
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_axisTitleFontSize || changedField == &m_axisValueFontSize )
|
||||
{
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::onPlotAdditionOrRemoval()
|
||||
{
|
||||
updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
QPainter painter( paintDevice );
|
||||
m_viewer->render( &painter );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::doUpdateLayout()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::cleanupBeforeClose()
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setParent( nullptr );
|
||||
delete m_viewer;
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>( attribute );
|
||||
if ( field == &m_numHistogramBins && lineEditorAttr != nullptr )
|
||||
{
|
||||
// Limit histogram bins to positive value
|
||||
QIntValidator* validator = new QIntValidator( 2, 10000, nullptr );
|
||||
lineEditorAttr->validator = validator;
|
||||
}
|
||||
|
||||
caf::PdmUiDoubleSliderEditorAttribute* sliderAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
if ( field == &m_histogramGapWidth && sliderAttr != nullptr )
|
||||
{
|
||||
sliderAttr->m_minimum = 0.0;
|
||||
sliderAttr->m_maximum = 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions );
|
||||
|
||||
if ( !options.empty() ) return options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_axisTitleFontSize || fieldNeedingOptions == &m_axisValueFontSize )
|
||||
{
|
||||
options = caf::FontTools::relativeSizeValueOptions( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::uiOrderingForHistogram( QString uiConfigName, caf::PdmUiOrdering& uiOrdering, bool showHistogramBins )
|
||||
{
|
||||
caf::PdmUiGroup* histogramGroup = uiOrdering.addNewGroup( "Histogram" );
|
||||
if ( showHistogramBins ) histogramGroup->add( &m_numHistogramBins );
|
||||
histogramGroup->add( &m_histogramBarColor );
|
||||
histogramGroup->add( &m_graphType );
|
||||
if ( m_graphType == GraphType::BAR_GRAPH ) histogramGroup->add( &m_histogramGapWidth );
|
||||
histogramGroup->add( &m_histogramFrequencyType );
|
||||
histogramGroup->add( &m_precision );
|
||||
histogramGroup->add( &m_tickNumberFormat );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::uiOrderingForLegendsAndFonts( QString uiConfigName, caf::PdmUiOrdering& uiOrdering, bool showLegendPosition )
|
||||
{
|
||||
RimPlotWindow::uiOrderingForLegendsAndFonts( uiConfigName, uiOrdering, showLegendPosition );
|
||||
|
||||
auto* fontGroup = uiOrdering.findGroup( "Fonts" );
|
||||
fontGroup->add( &m_axisTitleFontSize );
|
||||
fontGroup->add( &m_axisValueFontSize );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
performAutoNameUpdate();
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::updatePlots()
|
||||
{
|
||||
if ( !hasStatisticsData() ) return;
|
||||
|
||||
RigHistogramData histogramData = createStatisticsData();
|
||||
|
||||
if ( !histogramData.isHistogramVectorValid() ) return;
|
||||
|
||||
QBarSet* set0 = new QBarSet( m_plotWindowTitle );
|
||||
double minValue = std::numeric_limits<double>::max();
|
||||
double maxValue = -std::numeric_limits<double>::max();
|
||||
|
||||
QColor color = RiaColorTools::toQColor( m_histogramBarColor );
|
||||
|
||||
// Make border same color as bar when user wants max bar width
|
||||
if ( m_histogramGapWidth() == 0.0 )
|
||||
{
|
||||
set0->setBorderColor( color );
|
||||
}
|
||||
|
||||
double sumElements = 0.0;
|
||||
for ( double value : histogramData.histogram )
|
||||
sumElements += value;
|
||||
|
||||
QLineSeries* lineSeries = new QLineSeries();
|
||||
lineSeries->setName( m_plotWindowTitle );
|
||||
|
||||
QPen pen( color );
|
||||
pen.setWidth( 2 );
|
||||
lineSeries->setPen( pen );
|
||||
|
||||
double binSize = ( histogramData.max - histogramData.min ) / histogramData.histogram.size();
|
||||
double binCenter = histogramData.min;
|
||||
for ( double value : histogramData.histogram )
|
||||
{
|
||||
if ( m_histogramFrequencyType() == HistogramFrequencyType::RELATIVE_FREQUENCY ) value /= sumElements;
|
||||
if ( m_histogramFrequencyType() == HistogramFrequencyType::RELATIVE_FREQUENCY_PERCENT ) value = value / sumElements * 100.0;
|
||||
*set0 << value;
|
||||
*lineSeries << QPointF( binCenter, value );
|
||||
binCenter += binSize;
|
||||
|
||||
minValue = std::min( minValue, value );
|
||||
maxValue = std::max( maxValue, value );
|
||||
}
|
||||
set0->setColor( color );
|
||||
lineSeries->setColor( color );
|
||||
|
||||
QBarSeries* series = new QBarSeries();
|
||||
series->setBarWidth( ( 100.0 - m_histogramGapWidth() ) / 100.0 );
|
||||
series->append( set0 );
|
||||
|
||||
QChart* chart = new QChart();
|
||||
if ( m_graphType == GraphType::BAR_GRAPH ) chart->addSeries( series );
|
||||
if ( m_graphType == GraphType::LINE_GRAPH ) chart->addSeries( lineSeries );
|
||||
chart->setTitle( uiName() );
|
||||
|
||||
// Axis
|
||||
double xAxisSize = histogramData.max - histogramData.min;
|
||||
double xAxisExtension = xAxisSize * 0.02;
|
||||
|
||||
QValueAxis* axisX = new QValueAxis();
|
||||
axisX->setRange( histogramData.min - xAxisExtension, histogramData.max + xAxisExtension );
|
||||
axisX->setLabelFormat( RiaNumberFormat::sprintfFormat( m_tickNumberFormat(), m_precision ) );
|
||||
axisX->setTitleText( createXAxisTitle() );
|
||||
chart->addAxis( axisX, Qt::AlignBottom );
|
||||
|
||||
QValueAxis* axisY = new QValueAxis();
|
||||
axisY->setRange( minValue, maxValue );
|
||||
axisY->setLabelFormat( RiaNumberFormat::sprintfFormat( m_tickNumberFormat(), m_precision ) );
|
||||
axisY->setTitleText( createYAxisTitle() );
|
||||
chart->addAxis( axisY, Qt::AlignLeft );
|
||||
|
||||
// Scaling to match font sizes in Qwt
|
||||
const double fontScalingToMatchQwt = 1.5;
|
||||
|
||||
// Create vertical lines for statistics data
|
||||
std::vector<std::pair<QString, double>> statisticsData = { { "P90", histogramData.p90 },
|
||||
{ "Mean", histogramData.mean },
|
||||
{ "P10", histogramData.p10 } };
|
||||
|
||||
for ( const auto& [name, value] : statisticsData )
|
||||
{
|
||||
if ( std::isinf( value ) ) continue;
|
||||
|
||||
QLineSeries* series = new QLineSeries();
|
||||
chart->addSeries( series );
|
||||
series->append( value, minValue );
|
||||
series->append( value, maxValue );
|
||||
series->attachAxis( axisX );
|
||||
series->attachAxis( axisY );
|
||||
series->setName( QString( "%1 (%2)" ).arg( name ).arg( value ) );
|
||||
|
||||
// Dummy point for label at top of vertical statistics value line
|
||||
QLineSeries* labelSeries = new QLineSeries();
|
||||
chart->addSeries( labelSeries );
|
||||
labelSeries->append( value, maxValue );
|
||||
labelSeries->attachAxis( axisX );
|
||||
labelSeries->attachAxis( axisY );
|
||||
labelSeries->setPointLabelsVisible( true );
|
||||
labelSeries->setPointLabelsClipping( false );
|
||||
labelSeries->setPointLabelsFormat( QString( "%1 - @xPoint" ).arg( name ) );
|
||||
|
||||
// Set font of label equal axis value font
|
||||
QFont labelFont = QFont();
|
||||
labelFont.setPointSize( fontScalingToMatchQwt * axisValueFontSize() );
|
||||
labelSeries->setPointLabelsFont( labelFont );
|
||||
|
||||
// Remove legend for dummy point
|
||||
QList<QLegendMarker*> labelMarker = chart->legend()->markers( labelSeries );
|
||||
if ( !labelMarker.empty() ) labelMarker.back()->setVisible( false );
|
||||
}
|
||||
|
||||
// Set axis value font
|
||||
QFont axisYValueFont = axisY->labelsFont();
|
||||
axisYValueFont.setPointSize( fontScalingToMatchQwt * axisValueFontSize() );
|
||||
axisY->setLabelsFont( axisYValueFont );
|
||||
QFont axisXValueFont = axisX->labelsFont();
|
||||
axisXValueFont.setPointSize( fontScalingToMatchQwt * axisValueFontSize() );
|
||||
axisX->setLabelsFont( axisXValueFont );
|
||||
|
||||
// Set axis title font
|
||||
QFont axisYTitleFont = axisY->titleFont();
|
||||
axisYTitleFont.setPointSize( fontScalingToMatchQwt * axisTitleFontSize() );
|
||||
axisY->setTitleFont( axisYTitleFont );
|
||||
QFont axisXTitleFont = axisX->titleFont();
|
||||
axisXTitleFont.setPointSize( fontScalingToMatchQwt * axisTitleFontSize() );
|
||||
axisX->setTitleFont( axisXTitleFont );
|
||||
|
||||
// Set plot title font
|
||||
QFont titleFont = chart->titleFont();
|
||||
titleFont.setPointSize( fontScalingToMatchQwt * titleFontSize() );
|
||||
chart->setTitleFont( titleFont );
|
||||
|
||||
// Set legend font
|
||||
QLegend* legend = chart->legend();
|
||||
if ( legend )
|
||||
{
|
||||
QFont legendFont = legend->font();
|
||||
legendFont.setPointSize( fontScalingToMatchQwt * legendFontSize() );
|
||||
legend->setFont( legendFont );
|
||||
legend->setVisible( legendsVisible() );
|
||||
}
|
||||
|
||||
m_viewer->setChart( chart );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimStatisticsPlot::userDescriptionField()
|
||||
{
|
||||
return &m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsPlot::performAutoNameUpdate()
|
||||
{
|
||||
QString name = createAutoName();
|
||||
m_plotWindowTitle = name;
|
||||
setUiName( name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimStatisticsPlot::createYAxisTitle() const
|
||||
{
|
||||
return caf::AppEnum<RimStatisticsPlot::HistogramFrequencyType>::uiText( m_histogramFrequencyType() );
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiaDefines.h"
|
||||
#include "RiaNumberFormat.h"
|
||||
|
||||
#include "RigHistogramData.h"
|
||||
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "RiuQtChartView.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimStatisticsPlot : public RimPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class HistogramFrequencyType
|
||||
{
|
||||
ABSOLUTE_FREQUENCY,
|
||||
RELATIVE_FREQUENCY,
|
||||
RELATIVE_FREQUENCY_PERCENT
|
||||
};
|
||||
|
||||
enum class GraphType
|
||||
{
|
||||
BAR_GRAPH,
|
||||
LINE_GRAPH
|
||||
};
|
||||
|
||||
RimStatisticsPlot();
|
||||
~RimStatisticsPlot() override;
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
|
||||
QString description() const override;
|
||||
|
||||
void zoomAll() override;
|
||||
|
||||
int axisTitleFontSize() const;
|
||||
int axisValueFontSize() const;
|
||||
|
||||
protected:
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void uiOrderingForHistogram( QString uiConfigName, caf::PdmUiOrdering& uiOrdering, bool showHistogramBins );
|
||||
void uiOrderingForLegendsAndFonts( QString uiConfigName, caf::PdmUiOrdering& uiOrdering, bool showLegendPosition = false );
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
void updatePlots();
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
virtual bool hasStatisticsData() const = 0;
|
||||
virtual RigHistogramData createStatisticsData() const = 0;
|
||||
virtual QString createAutoName() const = 0;
|
||||
|
||||
virtual QString createXAxisTitle() const = 0;
|
||||
virtual QString createYAxisTitle() const;
|
||||
|
||||
void performAutoNameUpdate();
|
||||
|
||||
private:
|
||||
void cleanupBeforeClose();
|
||||
void onPlotAdditionOrRemoval();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void doUpdateLayout() override;
|
||||
|
||||
protected:
|
||||
QPointer<RiuQtChartView> m_viewer;
|
||||
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmField<int> m_numHistogramBins;
|
||||
caf::PdmField<cvf::Color3f> m_histogramBarColor;
|
||||
caf::PdmField<double> m_histogramGapWidth;
|
||||
caf::PdmField<caf::AppEnum<HistogramFrequencyType>> m_histogramFrequencyType;
|
||||
caf::PdmField<int> m_precision;
|
||||
caf::PdmField<caf::AppEnum<RiaNumberFormat::NumberFormatType>> m_tickNumberFormat;
|
||||
caf::PdmField<caf::AppEnum<GraphType>> m_graphType;
|
||||
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisValueFontSize;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisTitleFontSize;
|
||||
};
|
||||
Reference in New Issue
Block a user