2017-12-06 05:01:15 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017- 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 "RicReloadWellPathFormationNamesFeature.h"
|
|
|
|
|
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicReloadWellPathFormationNamesFeature, "RicReloadWellPathFormationNamesFeature" );
|
2017-12-06 05:01:15 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-06-26 07:28:46 -05:00
|
|
|
bool RicReloadWellPathFormationNamesFeature::isCommandEnabled() const
|
2017-12-06 05:01:15 -06:00
|
|
|
{
|
|
|
|
std::vector<RimWellPath*> wellPaths;
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
2017-12-06 05:01:15 -06:00
|
|
|
|
|
|
|
std::vector<RimWellPathCollection*> wellPathCollection;
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType( &wellPathCollection );
|
2017-12-06 05:01:15 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
return ( wellPaths.size() > 0 || wellPathCollection.size() > 0 );
|
2017-12-06 05:01:15 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicReloadWellPathFormationNamesFeature::onActionTriggered( bool isChecked )
|
2017-12-06 05:01:15 -06:00
|
|
|
{
|
|
|
|
std::vector<RimWellPath*> wellPaths;
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
2017-12-06 05:01:15 -06:00
|
|
|
|
|
|
|
std::vector<RimWellPathCollection*> wellPathCollections;
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType( &wellPathCollections );
|
2017-12-06 05:01:15 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( wellPaths.size() > 0 )
|
2017-12-06 05:01:15 -06:00
|
|
|
{
|
2023-05-12 14:41:34 -05:00
|
|
|
RimWellPathCollection* wellPathCollection = wellPaths[0]->firstAncestorOrThisOfTypeAsserted<RimWellPathCollection>();
|
2017-12-06 05:01:15 -06:00
|
|
|
wellPathCollection->reloadAllWellPathFormations();
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( wellPathCollections.size() > 0 )
|
2017-12-06 05:01:15 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
wellPathCollections[0]->reloadAllWellPathFormations();
|
2017-12-06 05:01:15 -06:00
|
|
|
}
|
|
|
|
|
2022-08-19 07:30:25 -05:00
|
|
|
RimMainPlotCollection::current()->updatePlotsWithFormations();
|
2017-12-06 05:01:15 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicReloadWellPathFormationNamesFeature::setupActionLook( QAction* actionToSetup )
|
2017-12-06 05:01:15 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Reload All Well Picks" );
|
2020-10-06 10:12:58 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/Refresh.svg" ) );
|
2017-12-06 05:01:15 -06:00
|
|
|
}
|