mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5706 Initial analysis plot filtering objects. Shell only
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewAnalysisPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPlotDataFilterFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewAnalysisPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPlotDataFilterFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicNewPlotDataFilterFeature.h"
|
||||
|
||||
#include "RimAnalysisPlot.h"
|
||||
#include "RimAnalysisPlotCollection.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
#include "RimPlotDataFilterItem.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewPlotDataFilterFeature, "RicNewPlotDataFilterFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPlotDataFilterFeature::isCommandEnabled()
|
||||
{
|
||||
RimAnalysisPlot* analysisPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimAnalysisPlot>();
|
||||
|
||||
if ( analysisPlot ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPlotDataFilterFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimAnalysisPlot* analysisPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimAnalysisPlot>();
|
||||
|
||||
if ( !analysisPlot ) return;
|
||||
|
||||
RimPlotDataFilterItem* newFilter = analysisPlot->plotDataFilterCollection()->addFilter();
|
||||
|
||||
analysisPlot->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded( newFilter );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newFilter );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPlotDataFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Plot Data Filter" );
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryCurveFilter16x16.png" ) );
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPlotDataFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@@ -3,12 +3,16 @@ set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotDataEntry.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotDataFilterCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotDataFilterItem.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotDataEntry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnalysisPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotDataFilterCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotDataFilterItem.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "RimDerivedSummaryCase.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
@@ -130,9 +131,9 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
CAF_PDM_InitField( &m_selectVariablesButtonField, "BrowseButton", false, "...", "", "", "" );
|
||||
caf::PdmUiActionPushButtonEditor::configureEditorForField( &m_selectVariablesButtonField );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_data, "AnalysisPlotData", "", "", "", "" );
|
||||
m_data.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_data.uiCapability()->setUiTreeHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_analysisPlotDataSelection, "AnalysisPlotData", "", "", "", "" );
|
||||
m_analysisPlotDataSelection.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_analysisPlotDataSelection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
// Time Step Selection
|
||||
|
||||
@@ -192,6 +193,10 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
m_valueAxisProperties = new RimPlotAxisProperties;
|
||||
m_valueAxisProperties->setNameAndAxis( "Value-Axis", QwtPlot::yLeft );
|
||||
m_valueAxisProperties->enableRangeSettings( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection", "", "", "" );
|
||||
m_plotDataFilterCollection.uiCapability()->setUiTreeHidden( true );
|
||||
m_plotDataFilterCollection = new RimPlotDataFilterCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -210,6 +215,39 @@ void RimAnalysisPlot::updateCaseNameHasChanged()
|
||||
{
|
||||
this->onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
|
||||
{
|
||||
return m_plotDataFilterCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses()
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
|
||||
RimCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
|
||||
for ( RimSummaryCase* sumCase : analyserOfSelectedCurveDefs->m_singleSummaryCases )
|
||||
{
|
||||
const std::set<RifEclipseSummaryAddress>& caseAddrs = sumCase->summaryReader()->allResultAddresses();
|
||||
addresses.insert( caseAddrs.begin(), caseAddrs.end() );
|
||||
}
|
||||
|
||||
for ( RimSummaryCaseCollection* caseColl : analyserOfSelectedCurveDefs->m_ensembles )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> ensAddrs = caseColl->ensembleSummaryAddresses();
|
||||
addresses.insert( ensAddrs.begin(), ensAddrs.end() );
|
||||
}
|
||||
|
||||
return addresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -233,12 +271,12 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
if ( dlg.exec() == QDialog::Accepted )
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
|
||||
m_data.deleteAllChildObjects();
|
||||
m_analysisPlotDataSelection.deleteAllChildObjects();
|
||||
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
|
||||
{
|
||||
auto plotEntry = new RimAnalysisPlotDataEntry();
|
||||
plotEntry->setFromCurveDefinition( vectorDef );
|
||||
m_data.push_back( plotEntry );
|
||||
m_analysisPlotDataSelection.push_back( plotEntry );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,7 +787,7 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
|
||||
if ( m_referenceCase ) referenceCaseReader = m_referenceCase->summaryReader();
|
||||
|
||||
for ( const RimAnalysisPlotDataEntry* dataEntry : m_data )
|
||||
for ( const RimAnalysisPlotDataEntry* dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
RiaSummaryCurveDefinition orgBarDataEntry = dataEntry->curveDefinition();
|
||||
|
||||
@@ -962,10 +1000,24 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitions()
|
||||
RimCurveDefinitionAnalyser* RimAnalysisPlot::getOrCreateSelectedCurveDefAnalyser()
|
||||
{
|
||||
if ( !m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
m_analyserOfSelectedCurveDefs =
|
||||
std::unique_ptr<RimCurveDefinitionAnalyser>( new RimCurveDefinitionAnalyser( this->curveDefinitions() ) );
|
||||
}
|
||||
|
||||
return m_analyserOfSelectedCurveDefs.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitions() const
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||
for ( auto dataEntry : m_data )
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
curveDefs.push_back( dataEntry->curveDefinition() );
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ class RimAnalysisPlotDataEntry;
|
||||
class RimCurveDefinitionAnalyser;
|
||||
class RimPlotAxisPropertiesInterface;
|
||||
class RimPlotAxisProperties;
|
||||
class RimPlotDataFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -48,6 +49,10 @@ public:
|
||||
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
RimPlotDataFilterCollection* plotDataFilterCollection() const;
|
||||
|
||||
std::set<RifEclipseSummaryAddress> unfilteredAddresses();
|
||||
|
||||
public: // Internal. Public needed for AppEnum setup
|
||||
enum BarOrientation
|
||||
{
|
||||
@@ -125,7 +130,8 @@ private:
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void updatePlotTitle();
|
||||
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions();
|
||||
RimCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
@@ -140,7 +146,7 @@ private:
|
||||
caf::PdmField<QString> m_selectedVarsUiField;
|
||||
caf::PdmField<bool> m_selectVariablesButtonField;
|
||||
|
||||
caf::PdmChildArrayField<RimAnalysisPlotDataEntry*> m_data;
|
||||
caf::PdmChildArrayField<RimAnalysisPlotDataEntry*> m_analysisPlotDataSelection;
|
||||
|
||||
caf::PdmField<QDateTime> m_addTimestepUiField;
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
@@ -171,4 +177,5 @@ private:
|
||||
caf::PdmField<bool> m_useQuantityInBarText;
|
||||
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_valueAxisProperties;
|
||||
caf::PdmChildField<RimPlotDataFilterCollection*> m_plotDataFilterCollection;
|
||||
};
|
||||
|
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
#include "RimPlotDataFilterItem.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPlotDataFilterCollection, "PlotDataFilterCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterCollection::RimPlotDataFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Data Filters", ":/SummaryCurveFilter16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_isActive, "IsActive", true, "IsActive", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filters, "PlotDataFiltersField", "", "", "", "" );
|
||||
m_filters.uiCapability()->setUiTreeHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterItem* RimPlotDataFilterCollection::addFilter()
|
||||
{
|
||||
auto newFilter = new RimPlotDataFilterItem();
|
||||
m_filters.push_back( newFilter );
|
||||
return newFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter )
|
||||
{
|
||||
m_filters.removeChildObject( filter );
|
||||
delete filter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotDataFilterItem*> RimPlotDataFilterCollection::filters() const
|
||||
{
|
||||
return m_filters.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotDataFilterCollection::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotDataFilterCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimPlotDataFilterItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPlotDataFilterCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotDataFilterCollection();
|
||||
|
||||
RimPlotDataFilterItem* addFilter();
|
||||
void removeFilter( RimPlotDataFilterItem* filter );
|
||||
std::vector<RimPlotDataFilterItem*> filters() const;
|
||||
bool isActive() const;
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildArrayField<RimPlotDataFilterItem*> m_filters;
|
||||
};
|
@@ -0,0 +1,214 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlotDataFilterItem.h"
|
||||
|
||||
#include "RimAnalysisPlot.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "cafPdmUiActionPushButtonEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimPlotDataFilterItem::FilterTarget>::setUp()
|
||||
{
|
||||
addItem( RimPlotDataFilterItem::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" );
|
||||
addItem( RimPlotDataFilterItem::SUMMARY_CASE, "SUMMARY_CASE", "Summary Case" );
|
||||
addItem( RimPlotDataFilterItem::ENSEMBLE_CASE, "ENSEMBLE_CASE", "Summary Case by Ensemble Parameter" );
|
||||
|
||||
setDefault( RimPlotDataFilterItem::SUMMARY_CASE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimPlotDataFilterItem::FilterOperation>::setUp()
|
||||
{
|
||||
addItem( RimPlotDataFilterItem::RANGE, "RANGE", "Range" );
|
||||
addItem( RimPlotDataFilterItem::TOP_N, "TOP_N", "Top N" );
|
||||
addItem( RimPlotDataFilterItem::MIN_N, "MIN_N", "Min N" );
|
||||
|
||||
setDefault( RimPlotDataFilterItem::RANGE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimPlotDataFilterItem::TimeStepSourceType>::setUp()
|
||||
{
|
||||
addItem( RimPlotDataFilterItem::PLOT_SOURCE_TIMESTEPS, "PLOT_SOURCE_TIMESTEPS", "Plot Source" );
|
||||
addItem( RimPlotDataFilterItem::LAST_TIMESTEP, "LAST_TIMESTEP", "Last" );
|
||||
addItem( RimPlotDataFilterItem::LAST_TIMESTEP_WITH_HISTORY, "LAST_TIMESTEP_WITH_HISTORY", "Last With History" );
|
||||
addItem( RimPlotDataFilterItem::FIRST_TIMESTEP, "FIRST_TIMESTEP", "First" );
|
||||
addItem( RimPlotDataFilterItem::ALL_TIMESTEPS, "ALL_TIMESTEPS", "All" );
|
||||
addItem( RimPlotDataFilterItem::SELECT_TIMESTEPS, "SELECT_TIMESTEPS", "By Selection" );
|
||||
addItem( RimPlotDataFilterItem::SELECT_TIMESTEP_RANGE, "SELECT_TIMESTEP_RANGE", "By Range" );
|
||||
|
||||
setDefault( RimPlotDataFilterItem::PLOT_SOURCE_TIMESTEPS );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPlotDataFilterItem, "PlotDataFilterItem" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterItem::RimPlotDataFilterItem()
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Data Filter", ":/EnsembleCurveSet16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterTarget, "FilterTarget", "Filter Type", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterAddress, "FilterAddressField", "Filter Address", "", "", "" );
|
||||
m_filterAddress.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_filterEnsembleParameter, "QuantityText", QString( "" ), "Quantity", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterQuantityUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" );
|
||||
m_filterQuantityUiField.xmlCapability()->disableIO();
|
||||
m_filterQuantityUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_filterQuantitySelectButton, "SelectAddress", false, "...", "", "", "" );
|
||||
caf::PdmUiActionPushButtonEditor::configureEditorForField( &m_filterQuantitySelectButton );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterOperation, "FilterOperation", "Operation", "", "", "" );
|
||||
CAF_PDM_InitField( &m_useAbsoluteValue, "UseAbsoluteValue", true, "Use Abs(value)", "", "", "" );
|
||||
CAF_PDM_InitField( &m_minTopN, "MinTopN", 20, "N", "", "", "" );
|
||||
CAF_PDM_InitField( &m_max, "Max", 0.0, "Max", "", "", "" );
|
||||
CAF_PDM_InitField( &m_min, "Min", 0.0, "Min", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleParameterValueCategories,
|
||||
"EnsembleParameterValueCategories",
|
||||
"Categories",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_consideredTimestepsType, "ConsideredTimestepsType", "Timesteps to Consider", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_explicitlySelectedTimeSteps, "ExplicitlySelectedTimeSteps", "TimeSteps", "", "", "" );
|
||||
m_explicitlySelectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterItem::~RimPlotDataFilterItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimPlotDataFilterItem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
RimAnalysisPlot* parentPlot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
|
||||
if ( fieldNeedingOptions == &m_filterQuantityUiField )
|
||||
{
|
||||
if ( m_filterTarget != ENSEMBLE_CASE )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> allAddresses = parentPlot->unfilteredAddresses();
|
||||
|
||||
for ( auto& address : allAddresses )
|
||||
{
|
||||
if ( address.isErrorResult() ) continue;
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( QString::fromStdString( address.uiText() ),
|
||||
QVariant::fromValue( address ) ) );
|
||||
}
|
||||
|
||||
options.push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(),
|
||||
QVariant::fromValue( RifEclipseSummaryAddress() ) ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_filterEnsembleParameter )
|
||||
{
|
||||
// if ( m_filterTarget() == ENSEMBLE_CASE )
|
||||
// {
|
||||
// std::set<EnsembleParameter> ensembleParams = parentPlot->ensembleParameters();
|
||||
// for ( const EnsembleParameter& ensParam : ensembleParams )
|
||||
// {
|
||||
// options.push_back( caf::PdmOptionItemInfo( ensParam.uiName(), ensParam.name ) );
|
||||
// }
|
||||
//
|
||||
// options.push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(),
|
||||
// QVariant::fromValue( RifEclipseSummaryAddress() ) ) );
|
||||
// }
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotDataFilterItem::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_filterTarget, {true, 5, 1} );
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE )
|
||||
{
|
||||
uiOrdering.add( &m_filterEnsembleParameter, {true, 5, 1} );
|
||||
}
|
||||
else
|
||||
{
|
||||
uiOrdering.add( &m_filterQuantityUiField, {true, 5, 1} );
|
||||
// uiOrdering.add( &m_filterQuantitySelectButton, {false, 1, 0} );
|
||||
}
|
||||
|
||||
uiOrdering.add( &m_filterOperation, {true, 3, 1} );
|
||||
uiOrdering.add( &m_useAbsoluteValue, {false} );
|
||||
|
||||
if ( m_filterOperation() == RANGE )
|
||||
{
|
||||
uiOrdering.add( &m_max );
|
||||
uiOrdering.add( &m_min );
|
||||
}
|
||||
else if ( m_filterOperation == TOP_N || m_filterOperation == MIN_N )
|
||||
{
|
||||
uiOrdering.add( &m_minTopN );
|
||||
}
|
||||
|
||||
if ( m_filterTarget() == ENSEMBLE_CASE && false ) // Ensemble Quantity is a category value
|
||||
{
|
||||
uiOrdering.add( &m_ensembleParameterValueCategories );
|
||||
}
|
||||
|
||||
if ( m_filterTarget() != ENSEMBLE_CASE ) // Ensemble Quantity is a category value
|
||||
{
|
||||
uiOrdering.add( &m_consideredTimestepsType );
|
||||
if ( m_consideredTimestepsType == SELECT_TIMESTEPS || m_consideredTimestepsType == SELECT_TIMESTEP_RANGE )
|
||||
{
|
||||
uiOrdering.add( &m_explicitlySelectedTimeSteps );
|
||||
}
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafAppEnum.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifEclipseSummaryAddressQMetaType.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
class RiuSummaryQwtPlot;
|
||||
class RiuGroupedBarChartBuilder;
|
||||
|
||||
class RimAnalysisPlotDataEntry;
|
||||
class RimCurveDefinitionAnalyser;
|
||||
class RimPlotAxisPropertiesInterface;
|
||||
class RimPlotAxisProperties;
|
||||
|
||||
class RimSummaryAddress;
|
||||
|
||||
// Filter of type :
|
||||
// Only [Cases/SummaryItem/Case by ensemble param] where the [Quantity]
|
||||
// is [within range/top N/min N]
|
||||
// considering the [Plot Source/Last/First/Last with History/all] timestep(s) [range/1,2..]
|
||||
|
||||
class RimPlotDataFilterItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotDataFilterItem();
|
||||
~RimPlotDataFilterItem() override;
|
||||
|
||||
private:
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
// Filter target
|
||||
enum FilterTarget
|
||||
{
|
||||
SUMMARY_ITEM,
|
||||
SUMMARY_CASE,
|
||||
ENSEMBLE_CASE
|
||||
};
|
||||
friend caf::AppEnum<FilterTarget>;
|
||||
caf::PdmField<caf::AppEnum<FilterTarget>> m_filterTarget;
|
||||
|
||||
// Quantity
|
||||
|
||||
// Complete address or quantity name only
|
||||
caf::PdmChildField<RimSummaryAddress*> m_filterAddress;
|
||||
caf::PdmField<QString> m_filterEnsembleParameter;
|
||||
caf::PdmField<RifEclipseSummaryAddress> m_filterQuantityUiField;
|
||||
caf::PdmField<bool> m_filterQuantitySelectButton;
|
||||
|
||||
// Operation and parameters
|
||||
|
||||
enum FilterOperation
|
||||
{
|
||||
TOP_N,
|
||||
MIN_N,
|
||||
RANGE
|
||||
};
|
||||
friend caf::AppEnum<FilterOperation>;
|
||||
|
||||
caf::PdmField<caf::AppEnum<FilterOperation>> m_filterOperation;
|
||||
caf::PdmField<bool> m_useAbsoluteValue;
|
||||
caf::PdmField<int> m_minTopN;
|
||||
caf::PdmField<double> m_max;
|
||||
caf::PdmField<double> m_min;
|
||||
|
||||
caf::PdmField<std::vector<QString>> m_ensembleParameterValueCategories;
|
||||
|
||||
// Considered Timesteps
|
||||
|
||||
enum TimeStepSourceType
|
||||
{
|
||||
PLOT_SOURCE_TIMESTEPS,
|
||||
LAST_TIMESTEP,
|
||||
FIRST_TIMESTEP,
|
||||
LAST_TIMESTEP_WITH_HISTORY,
|
||||
ALL_TIMESTEPS,
|
||||
SELECT_TIMESTEPS,
|
||||
SELECT_TIMESTEP_RANGE
|
||||
};
|
||||
friend caf::AppEnum<TimeStepSourceType>;
|
||||
|
||||
caf::PdmField<caf::AppEnum<TimeStepSourceType>> m_consideredTimestepsType;
|
||||
caf::PdmField<std::vector<QDateTime>> m_explicitlySelectedTimeSteps;
|
||||
|
||||
protected:
|
||||
};
|
@@ -150,6 +150,8 @@
|
||||
|
||||
#include "RimAnalysisPlot.h"
|
||||
#include "RimAnalysisPlotCollection.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
#include "RimPlotDataFilterItem.h"
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -520,6 +522,15 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
else if ( dynamic_cast<RimAnalysisPlot*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewAnalysisPlotFeature";
|
||||
menuBuilder << "RicNewPlotDataFilterFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimPlotDataFilterCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewPlotDataFilterFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimPlotDataFilterItem*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewPlotDataFilterFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimSummaryCrossPlotCollection*>( firstUiItem ) )
|
||||
{
|
||||
|
Reference in New Issue
Block a user