mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7346 Summary Plot: Improve default curve for observed data
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotFeatureImpl.h
|
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotFeatureImpl.h
|
||||||
@@ -47,6 +48,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h
|
|||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotFeatureImpl.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotFeatureImpl.cpp
|
||||||
|
|||||||
@@ -0,0 +1,192 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- Statoil 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 "RicNewDefaultSummaryPlotFeature.h"
|
||||||
|
|
||||||
|
#include "RiaPreferences.h"
|
||||||
|
#include "RiaSummaryTools.h"
|
||||||
|
|
||||||
|
#include "RicEditSummaryPlotFeature.h"
|
||||||
|
#include "RicNewSummaryCurveFeature.h"
|
||||||
|
#include "RicNewSummaryEnsembleCurveSetFeature.h"
|
||||||
|
#include "RicSummaryPlotEditorDialog.h"
|
||||||
|
#include "RicSummaryPlotEditorUi.h"
|
||||||
|
#include "RicSummaryPlotFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "RimCustomObjectiveFunctionCollection.h"
|
||||||
|
#include "RimEnsembleCurveFilter.h"
|
||||||
|
#include "RimEnsembleCurveFilterCollection.h"
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimRegularLegendConfig.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
|
#include "RimSummaryCurveFilter.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RiuPlotMainWindow.h"
|
||||||
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManagerTools.h"
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicNewDefaultSummaryPlotFeature, "RicNewDefaultSummaryPlotFeature" );
|
||||||
|
|
||||||
|
void extractPlotObjectsFromSelection( std::vector<RimSummaryCase*>* selectedIndividualSummaryCases,
|
||||||
|
std::vector<RimSummaryCaseCollection*>* selectedEnsembles )
|
||||||
|
{
|
||||||
|
CAF_ASSERT( selectedIndividualSummaryCases && selectedEnsembles );
|
||||||
|
|
||||||
|
// First try selected ensembles
|
||||||
|
caf::SelectionManager::instance()->objectsByTypeStrict( selectedEnsembles );
|
||||||
|
if ( !selectedEnsembles->empty() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Second try selected summary cases
|
||||||
|
caf::SelectionManager::instance()->objectsByTypeStrict( selectedIndividualSummaryCases );
|
||||||
|
if ( !selectedIndividualSummaryCases->empty() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RimSummaryPlotCollection* sumPlotColl =
|
||||||
|
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimSummaryPlotCollection>();
|
||||||
|
|
||||||
|
if ( sumPlotColl )
|
||||||
|
{
|
||||||
|
RimSummaryCase* firstIndividualSummaryCase = nullptr;
|
||||||
|
RimSummaryCaseCollection* firstEnsemble = nullptr;
|
||||||
|
|
||||||
|
auto sumCaseVector = RimProject::current()->allSummaryCases();
|
||||||
|
for ( RimSummaryCase* summaryCase : sumCaseVector )
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* parentEnsemble = nullptr;
|
||||||
|
summaryCase->firstAncestorOrThisOfType( parentEnsemble );
|
||||||
|
if ( !parentEnsemble && !firstIndividualSummaryCase )
|
||||||
|
{
|
||||||
|
firstIndividualSummaryCase = summaryCase;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if ( parentEnsemble && !firstEnsemble )
|
||||||
|
{
|
||||||
|
firstEnsemble = parentEnsemble;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( firstIndividualSummaryCase )
|
||||||
|
{
|
||||||
|
selectedIndividualSummaryCases->push_back( firstIndividualSummaryCase );
|
||||||
|
}
|
||||||
|
else if ( firstEnsemble )
|
||||||
|
{
|
||||||
|
selectedEnsembles->push_back( firstEnsemble );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( RimSummaryPlotCollection* plotCollection,
|
||||||
|
const std::vector<RimSummaryCase*>& summaryCases )
|
||||||
|
{
|
||||||
|
RimSummaryPlot* newPlot = plotCollection->createSummaryPlotWithAutoTitle();
|
||||||
|
|
||||||
|
for ( RimSummaryCase* sumCase : summaryCases )
|
||||||
|
{
|
||||||
|
RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( newPlot, sumCase );
|
||||||
|
}
|
||||||
|
|
||||||
|
newPlot->applyDefaultCurveAppearances();
|
||||||
|
newPlot->loadDataAndUpdate();
|
||||||
|
|
||||||
|
plotCollection->updateConnectedEditors();
|
||||||
|
|
||||||
|
RiuPlotMainWindowTools::setExpanded( newPlot );
|
||||||
|
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot );
|
||||||
|
return newPlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicNewDefaultSummaryPlotFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
||||||
|
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
||||||
|
|
||||||
|
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
||||||
|
|
||||||
|
RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr;
|
||||||
|
RimEnsembleCurveFilter* curveFilter = nullptr;
|
||||||
|
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||||
|
if ( selObj )
|
||||||
|
{
|
||||||
|
selObj->firstAncestorOrThisOfType( customObjFuncCollection );
|
||||||
|
selObj->firstAncestorOrThisOfType( curveFilter );
|
||||||
|
}
|
||||||
|
if ( customObjFuncCollection || curveFilter ) return false;
|
||||||
|
|
||||||
|
return !( selectedIndividualSummaryCases.empty() && selectedEnsembles.empty() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewDefaultSummaryPlotFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
||||||
|
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
||||||
|
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
||||||
|
|
||||||
|
if ( !selectedIndividualSummaryCases.empty() )
|
||||||
|
{
|
||||||
|
RimSummaryPlotCollection* sumPlotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection();
|
||||||
|
createFromSummaryCases( sumPlotColl, selectedIndividualSummaryCases );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CAF_ASSERT( !selectedEnsembles.empty() );
|
||||||
|
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( selectedEnsembles );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewDefaultSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
||||||
|
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
||||||
|
|
||||||
|
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
||||||
|
|
||||||
|
if ( !selectedIndividualSummaryCases.empty() )
|
||||||
|
{
|
||||||
|
actionToSetup->setText( "New Summary Plot" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actionToSetup->setText( "New Ensemble Summary Plot" );
|
||||||
|
}
|
||||||
|
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- Statoil 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 "RicfCommandObject.h"
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
class RimSummaryPlotCollection;
|
||||||
|
class RimSummaryCase;
|
||||||
|
class RimSummaryPlot;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicNewDefaultSummaryPlotFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static RimSummaryPlot* createFromSummaryCases( RimSummaryPlotCollection* plotCollection,
|
||||||
|
const std::vector<RimSummaryCase*>& summaryCases );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isCommandEnabled() override;
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include "RiaSummaryTools.h"
|
#include "RiaSummaryTools.h"
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimObservedDataCollection.h"
|
||||||
|
#include "RimObservedSummaryData.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
@@ -67,10 +69,6 @@ void RicNewSummaryCurveFeature::onActionTriggered( bool isChecked )
|
|||||||
{
|
{
|
||||||
defaultCase = plot->summaryCurves().back()->summaryCaseY();
|
defaultCase = plot->summaryCurves().back()->summaryCaseY();
|
||||||
}
|
}
|
||||||
else if ( project->activeOilField()->summaryCaseMainCollection()->summaryCaseCount() > 0 )
|
|
||||||
{
|
|
||||||
defaultCase = project->activeOilField()->summaryCaseMainCollection()->summaryCase( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !defaultCase )
|
if ( !defaultCase )
|
||||||
{
|
{
|
||||||
@@ -83,6 +81,16 @@ void RicNewSummaryCurveFeature::onActionTriggered( bool isChecked )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !defaultCase )
|
||||||
|
{
|
||||||
|
auto allSummaryCases = project->activeOilField()->observedDataCollection()->allObservedSummaryData();
|
||||||
|
|
||||||
|
if ( !allSummaryCases.empty() )
|
||||||
|
{
|
||||||
|
defaultCase = allSummaryCases.front();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||||
|
|
||||||
// Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered
|
// Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered
|
||||||
|
|||||||
@@ -147,154 +147,3 @@ void RicNewSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
|||||||
actionToSetup->setText( "Open Summary Plot Editor" );
|
actionToSetup->setText( "Open Summary Plot Editor" );
|
||||||
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
|
||||||
///
|
|
||||||
//==================================================================================================
|
|
||||||
|
|
||||||
#include "RicNewSummaryCurveFeature.h"
|
|
||||||
#include "RicSummaryPlotFeatureImpl.h"
|
|
||||||
#include "RimMainPlotCollection.h"
|
|
||||||
#include "RiuPlotMainWindowTools.h"
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicNewDefaultSummaryPlotFeature, "RicNewDefaultSummaryPlotFeature" );
|
|
||||||
|
|
||||||
void extractPlotObjectsFromSelection( std::vector<RimSummaryCase*>* selectedIndividualSummaryCases,
|
|
||||||
std::vector<RimSummaryCaseCollection*>* selectedEnsembles )
|
|
||||||
{
|
|
||||||
CAF_ASSERT( selectedIndividualSummaryCases && selectedEnsembles );
|
|
||||||
|
|
||||||
// First try selected ensembles
|
|
||||||
caf::SelectionManager::instance()->objectsByTypeStrict( selectedEnsembles );
|
|
||||||
if ( !selectedEnsembles->empty() )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Second try selected summary cases
|
|
||||||
caf::SelectionManager::instance()->objectsByTypeStrict( selectedIndividualSummaryCases );
|
|
||||||
if ( !selectedIndividualSummaryCases->empty() )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RimSummaryPlotCollection* sumPlotColl =
|
|
||||||
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimSummaryPlotCollection>();
|
|
||||||
|
|
||||||
if ( sumPlotColl )
|
|
||||||
{
|
|
||||||
RimSummaryCase* firstIndividualSummaryCase = nullptr;
|
|
||||||
RimSummaryCaseCollection* firstEnsemble = nullptr;
|
|
||||||
|
|
||||||
auto sumCaseVector = RimProject::current()->allSummaryCases();
|
|
||||||
for ( RimSummaryCase* summaryCase : sumCaseVector )
|
|
||||||
{
|
|
||||||
RimSummaryCaseCollection* parentEnsemble = nullptr;
|
|
||||||
summaryCase->firstAncestorOrThisOfType( parentEnsemble );
|
|
||||||
if ( !parentEnsemble && !firstIndividualSummaryCase )
|
|
||||||
{
|
|
||||||
firstIndividualSummaryCase = summaryCase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if ( parentEnsemble && !firstEnsemble )
|
|
||||||
{
|
|
||||||
firstEnsemble = parentEnsemble;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( firstIndividualSummaryCase )
|
|
||||||
{
|
|
||||||
selectedIndividualSummaryCases->push_back( firstIndividualSummaryCase );
|
|
||||||
}
|
|
||||||
else if ( firstEnsemble )
|
|
||||||
{
|
|
||||||
selectedEnsembles->push_back( firstEnsemble );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( RimSummaryPlotCollection* plotCollection,
|
|
||||||
const std::vector<RimSummaryCase*>& summaryCases )
|
|
||||||
{
|
|
||||||
RimSummaryPlot* newPlot = plotCollection->createSummaryPlotWithAutoTitle();
|
|
||||||
|
|
||||||
for ( RimSummaryCase* sumCase : summaryCases )
|
|
||||||
{
|
|
||||||
RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( newPlot, sumCase );
|
|
||||||
}
|
|
||||||
|
|
||||||
newPlot->applyDefaultCurveAppearances();
|
|
||||||
newPlot->loadDataAndUpdate();
|
|
||||||
|
|
||||||
plotCollection->updateConnectedEditors();
|
|
||||||
|
|
||||||
RiuPlotMainWindowTools::setExpanded( newPlot );
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot );
|
|
||||||
return newPlot;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RicNewDefaultSummaryPlotFeature::isCommandEnabled()
|
|
||||||
{
|
|
||||||
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
|
||||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
|
||||||
|
|
||||||
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
|
||||||
|
|
||||||
RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr;
|
|
||||||
RimEnsembleCurveFilter* curveFilter = nullptr;
|
|
||||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
|
||||||
if ( selObj )
|
|
||||||
{
|
|
||||||
selObj->firstAncestorOrThisOfType( customObjFuncCollection );
|
|
||||||
selObj->firstAncestorOrThisOfType( curveFilter );
|
|
||||||
}
|
|
||||||
if ( customObjFuncCollection || curveFilter ) return false;
|
|
||||||
|
|
||||||
return !( selectedIndividualSummaryCases.empty() && selectedEnsembles.empty() );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicNewDefaultSummaryPlotFeature::onActionTriggered( bool isChecked )
|
|
||||||
{
|
|
||||||
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
|
||||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
|
||||||
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
|
||||||
|
|
||||||
if ( !selectedIndividualSummaryCases.empty() )
|
|
||||||
{
|
|
||||||
RimSummaryPlotCollection* sumPlotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection();
|
|
||||||
createFromSummaryCases( sumPlotColl, selectedIndividualSummaryCases );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CAF_ASSERT( !selectedEnsembles.empty() );
|
|
||||||
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( selectedEnsembles );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicNewDefaultSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
|
||||||
{
|
|
||||||
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
|
||||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
|
||||||
|
|
||||||
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
|
||||||
|
|
||||||
if ( !selectedIndividualSummaryCases.empty() )
|
|
||||||
{
|
|
||||||
actionToSetup->setText( "New Summary Plot" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
actionToSetup->setText( "New Ensemble Summary Plot" );
|
|
||||||
}
|
|
||||||
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -22,11 +22,6 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
class RimSummaryPlotCollection;
|
|
||||||
class RimSummaryCase;
|
|
||||||
class RimSummaryCaseCollection;
|
|
||||||
class RimSummaryPlot;
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -40,21 +35,3 @@ protected:
|
|||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
|
||||||
///
|
|
||||||
//==================================================================================================
|
|
||||||
class RicNewDefaultSummaryPlotFeature : public caf::CmdFeature
|
|
||||||
{
|
|
||||||
CAF_CMD_HEADER_INIT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static RimSummaryPlot* createFromSummaryCases( RimSummaryPlotCollection* plotCollection,
|
|
||||||
const std::vector<RimSummaryCase*>& summaryCases );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Overrides
|
|
||||||
bool isCommandEnabled() override;
|
|
||||||
void onActionTriggered( bool isChecked ) override;
|
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -118,7 +118,9 @@ std::vector<RimSummaryCurve*> RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot(
|
|||||||
QString curvesTextFilter = RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter;
|
QString curvesTextFilter = RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter;
|
||||||
QStringList curveFilters = curvesTextFilter.split( ";", QString::SkipEmptyParts );
|
QStringList curveFilters = curvesTextFilter.split( ";", QString::SkipEmptyParts );
|
||||||
|
|
||||||
return addCurvesFromAddressFiltersToPlot( curveFilters, plot, summaryCase, false );
|
bool addHistoryCurve = false;
|
||||||
|
|
||||||
|
return addCurvesFromAddressFiltersToPlot( curveFilters, plot, summaryCase, addHistoryCurve );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -840,6 +842,13 @@ std::vector<RimSummaryCurve*> RicSummaryPlotFeatureImpl::addCurvesFromAddressFil
|
|||||||
curveAddressesToUse.insert( historyAddressesToUse.begin(), historyAddressesToUse.end() );
|
curveAddressesToUse.insert( historyAddressesToUse.begin(), historyAddressesToUse.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !curveFilters.isEmpty() && curveAddressesToUse.empty() && !addrs.empty() )
|
||||||
|
{
|
||||||
|
// The curve filter returns no match, use first available address
|
||||||
|
|
||||||
|
curveAddressesToUse.insert( *addrs.begin() );
|
||||||
|
}
|
||||||
|
|
||||||
for ( const auto& addr : curveAddressesToUse )
|
for ( const auto& addr : curveAddressesToUse )
|
||||||
{
|
{
|
||||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||||
|
|||||||
@@ -171,10 +171,10 @@ void RimSummaryCurve::setSummaryCaseY( RimSummaryCase* sumCase )
|
|||||||
m_qwtCurveErrorBars->setSamples( nullptr );
|
m_qwtCurveErrorBars->setSamples( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_isEnsembleCurve().isPartiallyTrue() )
|
bool isEnsembleCurve = false;
|
||||||
{
|
if ( sumCase && sumCase->ensemble() ) isEnsembleCurve = true;
|
||||||
setIsEnsembleCurve( sumCase->ensemble() );
|
|
||||||
}
|
setIsEnsembleCurve( isEnsembleCurve );
|
||||||
|
|
||||||
m_yValuesSummaryCase = sumCase;
|
m_yValuesSummaryCase = sumCase;
|
||||||
}
|
}
|
||||||
@@ -427,10 +427,10 @@ void RimSummaryCurve::setSummaryCaseX( RimSummaryCase* sumCase )
|
|||||||
{
|
{
|
||||||
m_xValuesSummaryCase = sumCase;
|
m_xValuesSummaryCase = sumCase;
|
||||||
|
|
||||||
if ( m_isEnsembleCurve().isPartiallyTrue() )
|
bool isEnsembleCurve = false;
|
||||||
{
|
if ( sumCase && sumCase->ensemble() ) isEnsembleCurve = true;
|
||||||
setIsEnsembleCurve( sumCase->ensemble() );
|
|
||||||
}
|
setIsEnsembleCurve( isEnsembleCurve );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -15,8 +15,10 @@
|
|||||||
// for more details.
|
// for more details.
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RimcSummaryPlotCollection.h"
|
#include "RimcSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h"
|
||||||
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
||||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user