#8310 Summary Plot Manager : Add data source filtering

This commit is contained in:
Magne Sjaastad
2021-11-19 14:53:01 +01:00
parent c945166e81
commit 5fcb81980d
17 changed files with 611 additions and 123 deletions

View File

@@ -43,6 +43,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -90,6 +91,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@@ -0,0 +1,55 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicShowSummaryPlotManagerFeature.h"
#include "RiaGuiApplication.h"
#include "RiuPlotMainWindow.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicShowSummaryPlotManagerFeature, "RicShowSummaryPlotManagerFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowSummaryPlotManagerFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowSummaryPlotManagerFeature::onActionTriggered( bool isChecked )
{
RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow();
if ( mpw )
{
mpw->showAndSetKeyboardFocusToSummaryPlotManager();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowSummaryPlotManagerFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Show Summary Plot Manager" );
applyShortcutWithHintToAction( actionToSetup, QKeySequence( tr( "Ctrl+K" ) ) );
}

View File

@@ -0,0 +1,34 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicShowSummaryPlotManagerFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -26,6 +26,7 @@
#include "RiaImportEclipseCaseTools.h"
#include "RiaLogging.h"
#include "RiaPreferencesSummary.h"
#include "RiaSummaryStringTools.h"
#include "RicCreateSummaryCaseCollectionFeature.h"
#include "RicImportGeneralDataFeature.h"
@@ -351,10 +352,10 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
RimSummaryPlotCollection* sumPlotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection();
splitAddressFiltersInGridAndSummary( summaryCasesToUse[0],
allCurveAddressFilters,
&summaryAddressFilters,
&gridResultAddressFilters );
RiaSummaryStringTools::splitAddressFiltersInGridAndSummary( summaryCasesToUse[0],
allCurveAddressFilters,
&summaryAddressFilters,
&gridResultAddressFilters );
if ( summaryAddressFilters.size() )
{
@@ -702,42 +703,6 @@ std::vector<RimSummaryPlot*> RicSummaryPlotFeatureImpl::createMultipleSummaryPlo
return newSummaryPlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryPlotFeatureImpl::splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase,
const QStringList& addressFilters,
QStringList* summaryAddressFilters,
QStringList* gridResultAddressFilters )
{
if ( summaryCase )
{
const std::set<RifEclipseSummaryAddress>& addrs = summaryCase->summaryReader()->allResultAddresses();
QRegularExpression gridAddressPattern( "^[A-Z]+:[0-9]+,[0-9]+,[0-9]+$" );
for ( int filterIdx = 0; filterIdx < addressFilters.size(); ++filterIdx )
{
const QString& address = addressFilters[filterIdx];
if ( hasFilterAnyMatch( address, addrs ) )
{
summaryAddressFilters->push_back( address );
}
else
{
if ( gridAddressPattern.match( address ).hasMatch() )
{
gridResultAddressFilters->push_back( address );
}
else
{
RiaLogging::warning( "No summary or restart vectors matched \"" + address + "\"" );
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -765,20 +730,6 @@ std::set<RifEclipseSummaryAddress>
return filteredAdressesFromCases;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSummaryPlotFeatureImpl::hasFilterAnyMatch( const QString& curveFilter,
const std::set<RifEclipseSummaryAddress>& summaryAddresses )
{
for ( const auto& addr : summaryAddresses )
{
if ( addr.isUiTextMatchingFilterText( curveFilter ) ) return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -93,8 +93,6 @@ private:
static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& address );
static bool hasFilterAnyMatch( const QString& curveFilter, const std::set<RifEclipseSummaryAddress>& summaryAddresses );
static RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse );
static std::vector<RimSummaryCurve*> addCurvesFromAddressFiltersToPlot( const QStringList& curveFilters,
@@ -105,11 +103,6 @@ private:
static std::set<RifEclipseSummaryAddress>
applySummaryAddressFiltersToCases( const std::vector<RimSummaryCase*>& summaryCasesToUse,
const QStringList& summaryAddressFilters );
static void splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase,
const QStringList& addressFilters,
QStringList* summaryAddressFilters,
QStringList* gridResultAddressFilters );
};
#include "RigEclipseResultAddress.h"