mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Implementation of objective functions.
- Objective functions - Custom objective functions - Filters - Selection of multiple summary addresses
This commit is contained in:
committed by
Magne Sjaastad
parent
a26fb977e1
commit
f19ba71888
@@ -93,6 +93,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewVfpPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionWeightFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteCustomObjectiveFunctionFeature.h
|
||||
)
|
||||
|
||||
|
||||
@@ -190,6 +193,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewVfpPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionWeightFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteCustomObjectiveFunctionFeature.cpp
|
||||
)
|
||||
|
||||
if(Qt5Charts_FOUND)
|
||||
|
||||
@@ -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 "RicDeleteCustomObjectiveFunctionFeature.h"
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionCollection.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteCustomObjectiveFunctionFeature, "RicDeleteCustomObjectiveFunctionFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteCustomObjectiveFunctionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteCustomObjectiveFunctionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
std::vector<RimCustomObjectiveFunction*> func;
|
||||
selObj->allAncestorsOrThisOfType( func );
|
||||
std::vector<RimCustomObjectiveFunctionCollection*> coll;
|
||||
selObj->allAncestorsOrThisOfType( coll );
|
||||
|
||||
if ( func.size() == 1 && coll.size() == 1 )
|
||||
{
|
||||
coll[0]->removeObjectiveFunction( func[0] );
|
||||
coll[0]->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( coll.front() );
|
||||
}
|
||||
|
||||
selObj->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteCustomObjectiveFunctionFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete" );
|
||||
actionToSetup->setShortcut( QKeySequence( QKeySequence::Delete ) );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
|
||||
}
|
||||
@@ -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 RicDeleteCustomObjectiveFunctionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicDeleteCustomObjectiveFunctionWeightFeature.h"
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionWeight.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteCustomObjectiveFunctionWeightFeature, "RicDeleteCustomObjectiveFunctionWeightFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteCustomObjectiveFunctionWeightFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteCustomObjectiveFunctionWeightFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
std::vector<RimCustomObjectiveFunction*> func;
|
||||
selObj->descendantsIncludingThisOfType( func );
|
||||
std::vector<RimCustomObjectiveFunctionWeight*> weight;
|
||||
selObj->descendantsIncludingThisOfType( weight );
|
||||
|
||||
if ( func.size() == 1 && weight.size() == 1 )
|
||||
{
|
||||
func[0]->removeWeight( weight[0] );
|
||||
func[0]->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( func.front() );
|
||||
}
|
||||
|
||||
selObj->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteCustomObjectiveFunctionWeightFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
|
||||
}
|
||||
@@ -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 RicDeleteCustomObjectiveFunctionWeightFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicNewCustomObjectiveFunctionFeature.h"
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionCollection.h"
|
||||
#include "RimCustomObjectiveFunctionWeight.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewCustomObjectiveFunctionFeature, "RicNewCustomObjectiveFunctionFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewCustomObjectiveFunctionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCustomObjectiveFunctionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
std::vector<RimCustomObjectiveFunctionCollection*> coll;
|
||||
selObj->descendantsIncludingThisOfType( coll );
|
||||
|
||||
if ( coll.size() == 1 )
|
||||
{
|
||||
RimCustomObjectiveFunction* newFunc = coll[0]->addObjectiveFunction();
|
||||
RimCustomObjectiveFunctionWeight* newWeight = newFunc->addWeight();
|
||||
newWeight->setSummaryAddress( newWeight->parentCurveSet()->summaryAddress() );
|
||||
coll[0]->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newFunc );
|
||||
RiuPlotMainWindowTools::setExpanded( coll.front() );
|
||||
RiuPlotMainWindowTools::setExpanded( newFunc );
|
||||
}
|
||||
|
||||
selObj->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCustomObjectiveFunctionFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Custom Objective Function" );
|
||||
actionToSetup->setIcon( QIcon( ":/ObjectiveFunction.svg" ) );
|
||||
}
|
||||
@@ -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 RicNewCustomObjectiveFunctionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicNewCustomObjectiveFunctionWeightFeature.h"
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionWeight.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewCustomObjectiveFunctionWeightFeature, "RicNewCustomObjectiveFunctionWeightFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewCustomObjectiveFunctionWeightFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCustomObjectiveFunctionWeightFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
std::vector<RimCustomObjectiveFunction*> func;
|
||||
selObj->descendantsIncludingThisOfType( func );
|
||||
|
||||
if ( func.size() == 1 )
|
||||
{
|
||||
RimCustomObjectiveFunctionWeight* newWeight = func[0]->addWeight();
|
||||
if ( func[0]->weights().size() > 1 )
|
||||
{
|
||||
newWeight->setSummaryAddress( func[0]->weights()[0]->summaryAddresses().front() );
|
||||
}
|
||||
else
|
||||
{
|
||||
newWeight->setSummaryAddress( newWeight->parentCurveSet()->summaryAddress() );
|
||||
}
|
||||
func[0]->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newWeight );
|
||||
RiuPlotMainWindowTools::setExpanded( func.front() );
|
||||
}
|
||||
|
||||
selObj->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCustomObjectiveFunctionWeightFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Weight" );
|
||||
actionToSetup->setIcon( QIcon( ":/ObjectiveFunctionWeight.svg" ) );
|
||||
}
|
||||
@@ -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 RicNewCustomObjectiveFunctionWeightFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
@@ -35,10 +35,7 @@ CAF_CMD_SOURCE_INIT( RicNewEnsembleCurveFilterFeature, "RicNewEnsembleCurveFilte
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewEnsembleCurveFilterFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimEnsembleCurveFilterCollection*> filterColls =
|
||||
caf::selectedObjectsByType<RimEnsembleCurveFilterCollection*>();
|
||||
|
||||
return filterColls.size() == 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -46,15 +43,28 @@ bool RicNewEnsembleCurveFilterFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewEnsembleCurveFilterFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimEnsembleCurveFilterCollection*> filterColls =
|
||||
caf::selectedObjectsByType<RimEnsembleCurveFilterCollection*>();
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
std::vector<RimEnsembleCurveFilterCollection*> filterColls;
|
||||
selObj->descendantsIncludingThisOfType( filterColls );
|
||||
|
||||
if ( filterColls.size() == 1 )
|
||||
{
|
||||
filterColls[0]->addFilter();
|
||||
RimEnsembleCurveFilter* newFilter = filterColls[0]->addFilter();
|
||||
if ( filterColls[0]->filters().size() > 1 )
|
||||
{
|
||||
newFilter->setSummaryAddresses( filterColls[0]->filters()[0]->summaryAddresses() );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
addresses.push_back( newFilter->parentCurveSet()->summaryAddress() );
|
||||
newFilter->setSummaryAddresses( addresses );
|
||||
}
|
||||
filterColls[0]->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( filterColls.front() );
|
||||
}
|
||||
|
||||
selObj->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RicSummaryPlotEditorUi.h"
|
||||
#include "RicSummaryPlotFeatureImpl.h"
|
||||
|
||||
#include "RimCustomObjectiveFunctionCollection.h"
|
||||
#include "RimEnsembleCurveFilter.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
#include "RimProject.h"
|
||||
@@ -64,7 +65,10 @@ bool RicNewSummaryPlotFeature::isCommandEnabled()
|
||||
auto ensembleFilterColl = dynamic_cast<RimEnsembleCurveFilterCollection*>( selObj );
|
||||
auto legendConfig = dynamic_cast<RimRegularLegendConfig*>( selObj );
|
||||
|
||||
if ( ensembleFilter || ensembleFilterColl || legendConfig ) return false;
|
||||
RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr;
|
||||
selObj->firstAncestorOrThisOfType( customObjFuncCollection );
|
||||
|
||||
if ( ensembleFilter || ensembleFilterColl || legendConfig || customObjFuncCollection ) return false;
|
||||
if ( sumPlotColl ) return true;
|
||||
|
||||
// Multiple case selections
|
||||
@@ -239,9 +243,14 @@ bool RicNewDefaultSummaryPlotFeature::isCommandEnabled()
|
||||
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles );
|
||||
|
||||
return !( selectedIndividualSummaryCases.empty() && selectedEnsembles.empty() );
|
||||
RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr;
|
||||
selObj->firstAncestorOrThisOfType( customObjFuncCollection );
|
||||
|
||||
return selectedIndividualSummaryCases.empty() && selectedEnsembles.empty() && ( customObjFuncCollection == nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user