2018-05-11 08:32:44 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2025-03-17 15:07:58 +01:00
|
|
|
// Copyright (C) 2025 Equinor ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2018-05-11 08:32:44 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2018-05-11 08:32:44 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-05-11 08:32:44 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2025-03-17 15:07:58 +01:00
|
|
|
#include "RicCreateSummaryEnsembleFeature.h"
|
2018-05-11 08:32:44 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
#include "RicImportEnsembleFeature.h"
|
2018-05-11 08:32:44 +02:00
|
|
|
|
|
|
|
|
#include "RimSummaryCase.h"
|
|
|
|
|
|
2025-03-17 15:07:58 +01:00
|
|
|
#include "cafSelectionManager.h"
|
2018-05-11 08:32:44 +02:00
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
2025-03-17 15:07:58 +01:00
|
|
|
CAF_CMD_SOURCE_INIT( RicCreateSummaryEnsembleFeature, "RicCreateSummaryEnsembleFeature" );
|
2018-05-11 08:32:44 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-05-11 08:32:44 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2025-03-17 15:07:58 +01:00
|
|
|
bool RicCreateSummaryEnsembleFeature::isCommandEnabled() const
|
2018-05-11 08:32:44 +02:00
|
|
|
{
|
2025-04-08 12:53:14 +02:00
|
|
|
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
2025-03-17 15:07:58 +01:00
|
|
|
return !selection.empty();
|
2018-05-11 08:32:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-05-11 08:32:44 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2025-03-17 15:07:58 +01:00
|
|
|
void RicCreateSummaryEnsembleFeature::onActionTriggered( bool isChecked )
|
2018-05-11 08:32:44 +02:00
|
|
|
{
|
2025-04-08 12:53:14 +02:00
|
|
|
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
2025-03-17 15:07:58 +01:00
|
|
|
if ( selection.empty() ) return;
|
2018-05-11 08:32:44 +02:00
|
|
|
|
2025-03-17 15:07:58 +01:00
|
|
|
RicImportEnsembleFeature::createSummaryEnsemble( selection );
|
2018-05-11 08:32:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-05-11 08:32:44 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2025-03-17 15:07:58 +01:00
|
|
|
void RicCreateSummaryEnsembleFeature::setupActionLook( QAction* actionToSetup )
|
2018-05-11 08:32:44 +02:00
|
|
|
{
|
2025-03-17 15:07:58 +01:00
|
|
|
actionToSetup->setText( "Create Summary Ensemble" );
|
|
|
|
|
actionToSetup->setIcon( QIcon( ":/SummaryGroup16x16.png" ) );
|
2018-05-11 08:32:44 +02:00
|
|
|
}
|