Files
ResInsight/ApplicationLibCode/Commands/RicNewWellTargetMappingFeature.cpp
T
Magne Sjaastad 8fdaa83f15 RimReservoirGridEnsembleBase: Make optional methods non-pure virtual with default implementations
mainGrid(), unionOfActiveCells(), computeUnionOfActiveCells(), and statisticsCaseCollection() default to null/no-op. Remove redundant overrides from RimEclipseCaseEnsemble.
2026-03-03 07:35:48 +01:00

79 lines
3.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024 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 "RicNewWellTargetMappingFeature.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseEnsemble.h"
#include "RimReservoirGridEnsemble.h"
#include "RimWellTargetMapping.h"
#include "RiuMainWindow.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewWellTargetMappingFeature, "RicNewWellTargetMappingFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellTargetMappingFeature::onActionTriggered( bool isChecked )
{
if ( auto ensembles = caf::selectedObjectsByTypeStrict<RimEclipseCaseEnsemble*>(); !ensembles.empty() )
{
auto ensemble = ensembles.front();
auto wellTargetMapping = new RimWellTargetMapping();
ensemble->addWellTargetMapping( wellTargetMapping );
wellTargetMapping->setDefaults();
ensemble->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem( wellTargetMapping );
}
else if ( auto gridEnsembles = caf::selectedObjectsByTypeStrict<RimReservoirGridEnsemble*>(); !gridEnsembles.empty() )
{
auto ensemble = gridEnsembles.front();
auto wellTargetMapping = new RimWellTargetMapping();
ensemble->addWellTargetMapping( wellTargetMapping );
wellTargetMapping->setDefaults();
ensemble->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem( wellTargetMapping );
}
else if ( auto eclipseCases = caf::selectedObjectsByTypeStrict<RimEclipseCase*>(); !eclipseCases.empty() )
{
auto eclipseCase = eclipseCases.front();
auto wellTargetMapping = new RimWellTargetMapping();
eclipseCase->addWellTargetMapping( wellTargetMapping );
wellTargetMapping->setDefaults();
eclipseCase->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem( wellTargetMapping );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellTargetMappingFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create Well Target Mapping" );
actionToSetup->setIcon( QIcon( ":/WellTargets.png" ) );
}