Remove obsolete code

This commit is contained in:
Magne Sjaastad 2021-05-11 07:25:46 +02:00
parent 1daa598770
commit 282c6f3586
9 changed files with 0 additions and 559 deletions

View File

@ -1,9 +1,6 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportWellPaths.h
${CMAKE_CURRENT_LIST_DIR}/RicImportGroupedWellPaths.h
${CMAKE_CURRENT_LIST_DIR}/RicToggleWellPathGrouping.h
${CMAKE_CURRENT_LIST_DIR}/RicAutomaticWellPathGrouping.h
${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowWellPlanFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathListTargetFeature.h
@ -33,9 +30,6 @@ ${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportWellPaths.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportGroupedWellPaths.cpp
${CMAKE_CURRENT_LIST_DIR}/RicToggleWellPathGrouping.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAutomaticWellPathGrouping.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowWellPlanFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathListTargetFeature.cpp

View File

@ -1,142 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicAutomaticWellPathGrouping.h"
#include "RiaPreferences.h"
#include "RigWellPath.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathGroup.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QRegExp>
RICF_SOURCE_INIT( RicAutomaticWellPathGrouping, "RicAutomaticWellPathGroupingFeature", "autoGroupWellPaths" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicAutomaticWellPathGrouping::RicAutomaticWellPathGrouping()
{
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPaths, "wellPaths", "", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicAutomaticWellPathGrouping::execute()
{
caf::PdmScriptResponse response;
auto wellPaths = m_wellPaths.ptrReferencedObjects();
if ( wellPaths.empty() )
{
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_WARNING, "No well paths provided" );
}
RimProject* project = RimProject::current();
if ( project )
{
project->scheduleCreateDisplayModelAndRedrawAllViews();
RimOilField* oilField = project->activeOilField();
if ( oilField )
{
// oilField->wellPathCollection->groupWellPaths( wellPaths, true );
oilField->wellPathCollection->rebuildWellPathNodes();
return caf::PdmScriptResponse();
}
}
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "No project open" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAutomaticWellPathGrouping::isCommandEnabled()
{
return !selectedWellPaths().empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAutomaticWellPathGrouping::onActionTriggered( bool isChecked )
{
m_wellPaths.setValue( selectedWellPaths() );
execute();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAutomaticWellPathGrouping::setupActionLook( QAction* actionToSetup )
{
auto wellPathCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellPathCollection>();
if ( wellPathCollection )
{
actionToSetup->setText( "Automatically Create Multi-Lateral Wells" );
actionToSetup->setIcon( QIcon( ":/WellPathGroup.svg" ) );
}
else
{
actionToSetup->setText( "Automatically Create Multi-Lateral Wells from Selected Paths" );
actionToSetup->setIcon( QIcon( ":/WellPathGroup.svg" ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RicAutomaticWellPathGrouping::selectedWellPaths()
{
std::vector<RimWellPath*> wellPaths;
auto wellPathCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellPathCollection>();
if ( wellPathCollection )
{
wellPaths = wellPathCollection->allWellPaths();
}
else
{
caf::SelectionManager::instance()->objectsByTypeStrict( &wellPaths );
}
QString multiLateralWellPathPattern = RiaPreferences::current()->multiLateralWellNamePattern();
QRegExp re( multiLateralWellPathPattern, Qt::CaseInsensitive, QRegExp::Wildcard );
std::vector<RimWellPath*> multiLateralWellPaths;
for ( auto wellPath : wellPaths )
{
if ( re.exactMatch( wellPath->name() ) )
{
multiLateralWellPaths.push_back( wellPath );
}
}
return multiLateralWellPaths;
}

View File

@ -1,52 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "CommandFileInterface/Core/RicfCommandObject.h"
#include "cafCmdFeature.h"
#include "cafPdmField.h"
#include "cafPdmPtrArrayField.h"
#include <vector>
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicAutomaticWellPathGrouping : public caf::CmdFeature, public RicfCommandObject
{
RICF_HEADER_INIT;
public:
RicAutomaticWellPathGrouping();
caf::PdmScriptResponse execute() override;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static std::vector<RimWellPath*> selectedWellPaths();
protected:
caf::PdmPtrArrayField<RimWellPath*> m_wellPaths;
};

View File

@ -1,68 +0,0 @@
#include "RicImportGroupedWellPaths.h"
#include "RiaApplication.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RimFileWellPath.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"
#include "cafPdmFieldScriptingCapability.h"
#include <QAction>
#include <QDir>
RICF_SOURCE_INIT( RicImportGroupedWellPaths, "RicImportGroupedWellPathsFeature", "importGroupedWellPaths" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicImportGroupedWellPaths::RicImportGroupedWellPaths()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportGroupedWellPaths::onActionTriggered( bool isChecked )
{
RiaApplication* app = RiaApplication::instance();
QString lastUsedGridFolder = app->lastUsedDialogDirectory( "BINARY_GRID" );
QString defaultDir = app->lastUsedDialogDirectoryWithFallback( "WELLPATH_DIR", lastUsedGridFolder );
QString nameList = QString( "Well Paths (%1);;All Files (*.*)" ).arg( wellPathNameFilters().join( " " ) );
QStringList wellPathFilePaths = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Well Paths",
defaultDir,
nameList );
if ( !wellPathFilePaths.empty() )
{
m_importGrouped = true;
m_wellPathFiles.v() = std::vector<QString>( wellPathFilePaths.begin(), wellPathFilePaths.end() );
caf::PdmScriptResponse response = execute();
QStringList messages = response.messages();
if ( !messages.empty() )
{
QString displayMessage = QString( "Problem loading well path files:\n%2" ).arg( messages.join( "\n" ) );
RiaLogging::errorInMessageBox( Riu3DMainWindowTools::mainWindowWidget(), "Well Path Loading", displayMessage );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportGroupedWellPaths::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Import &Grouped Well Paths from File" );
actionToSetup->setIcon( QIcon( ":/WellPathGroup.svg" ) );
}

View File

@ -1,38 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicImportWellPaths.h"
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicImportGroupedWellPaths : public RicImportWellPaths
{
RICF_HEADER_INIT;
public:
RicImportGroupedWellPaths();
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -1,182 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicToggleWellPathGrouping.h"
#include "RigWellPath.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathGroup.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafSelectionManager.h"
#include <QAction>
RICF_SOURCE_INIT( RicToggleWellPathGrouping, "RicToggleWellPathGroupingFeature", "groupWellPaths" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicToggleWellPathGrouping::RicToggleWellPathGrouping()
{
CAF_PDM_InitScriptableField( &m_groupWellPaths, "group", false, "", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPaths, "wellPaths", "", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicToggleWellPathGrouping::execute()
{
caf::PdmScriptResponse response;
auto wellPaths = m_wellPaths.ptrReferencedObjects();
if ( wellPaths.empty() )
{
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_WARNING, "No well paths provided" );
}
RimProject* project = RimProject::current();
if ( project )
{
project->scheduleCreateDisplayModelAndRedrawAllViews();
RimOilField* oilField = project->activeOilField();
if ( oilField )
{
if ( m_groupWellPaths() )
{
// oilField->wellPathCollection->groupWellPaths( wellPaths );
return caf::PdmScriptResponse();
}
else
{
// oilField->wellPathCollection->ungroupWellPaths( wellPaths );
return caf::PdmScriptResponse();
}
}
}
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "No project open" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicToggleWellPathGrouping::isCommandEnabled()
{
auto wellPaths = selectedWellPaths();
if ( wellPaths.size() > 1u && containsUngroupedWellPathsWithCommonGeometry( wellPaths ) )
{
return true;
}
else if ( !wellPaths.empty() && containsGroupedWellPaths( wellPaths ) )
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicToggleWellPathGrouping::onActionTriggered( bool isChecked )
{
auto wellPaths = selectedWellPaths();
if ( containsUngroupedWellPathsWithCommonGeometry( wellPaths ) )
{
m_groupWellPaths = true;
}
else if ( containsGroupedWellPaths( wellPaths ) )
{
m_groupWellPaths = false;
}
else
{
return;
}
m_wellPaths.setValue( wellPaths );
execute();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicToggleWellPathGrouping::setupActionLook( QAction* actionToSetup )
{
auto wellPaths = selectedWellPaths();
if ( containsUngroupedWellPathsWithCommonGeometry( wellPaths ) )
{
actionToSetup->setText( "Create Multi-Lateral Wells from Selected Well Paths" );
actionToSetup->setIcon( QIcon( ":/WellPathGroup.svg" ) );
}
else if ( containsGroupedWellPaths( wellPaths ) )
{
actionToSetup->setText( "Detach Selected Well Paths from Multi-Lateral Wells" );
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RicToggleWellPathGrouping::selectedWellPaths()
{
std::vector<RimWellPath*> wellPaths;
caf::SelectionManager::instance()->objectsByTypeStrict( &wellPaths );
return wellPaths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicToggleWellPathGrouping::containsGroupedWellPaths( const std::vector<RimWellPath*>& wellPaths )
{
return std::any_of( wellPaths.begin(), wellPaths.end(), []( RimWellPath* wellPath ) {
RimWellPathGroup* group = nullptr;
wellPath->firstAncestorOrThisOfType( group );
return group != nullptr;
} );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicToggleWellPathGrouping::containsUngroupedWellPathsWithCommonGeometry( const std::vector<RimWellPath*>& wellPaths )
{
std::vector<const RigWellPath*> geometries;
for ( auto wellPath : wellPaths )
{
RimWellPathGroup* group = nullptr;
wellPath->firstAncestorOrThisOfType( group );
if ( !group )
{
geometries.push_back( wellPath->wellPathGeometry() );
}
}
if ( geometries.empty() ) return false;
cvf::ref<RigWellPath> commonGeometry = RigWellPath::commonGeometry( geometries );
return commonGeometry.notNull() && !commonGeometry->wellPathPoints().empty();
}

View File

@ -1,55 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "CommandFileInterface/Core/RicfCommandObject.h"
#include "cafCmdFeature.h"
#include "cafPdmField.h"
#include "cafPdmPtrArrayField.h"
#include <vector>
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicToggleWellPathGrouping : public caf::CmdFeature, public RicfCommandObject
{
RICF_HEADER_INIT;
public:
RicToggleWellPathGrouping();
caf::PdmScriptResponse execute() override;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static std::vector<RimWellPath*> selectedWellPaths();
static bool containsGroupedWellPaths( const std::vector<RimWellPath*>& wellPaths );
static bool containsUngroupedWellPathsWithCommonGeometry( const std::vector<RimWellPath*>& wellPaths );
protected:
caf::PdmField<bool> m_groupWellPaths;
caf::PdmPtrArrayField<RimWellPath*> m_wellPaths;
};

View File

@ -329,7 +329,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder.addSeparator();
menuBuilder.subMenuStart( "Import" );
menuBuilder << "RicWellPathsImportFileFeature";
menuBuilder << "RicImportGroupedWellPathsFeature";
menuBuilder << "RicWellPathsImportSsihubFeature";
menuBuilder << "RicWellPathFormationsImportFileFeature";
menuBuilder << "RicWellLogsImportFileFeature";
@ -456,7 +455,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
else if ( dynamic_cast<RimWellLogFile*>( firstUiItem ) )
{
menuBuilder << "RicWellPathsImportFileFeature";
menuBuilder << "RicImportGroupedWellPathsFeature";
menuBuilder << "RicWellLogsImportFileFeature";
menuBuilder << "Separator";
@ -1197,18 +1195,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicSearchHelpFeature";
}
if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicToggleWellPathGroupingFeature" )->canFeatureBeExecuted() )
{
menuBuilder << "Separator";
menuBuilder << "RicToggleWellPathGroupingFeature";
}
if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicAutomaticWellPathGroupingFeature" )->canFeatureBeExecuted() )
{
menuBuilder << "Separator";
menuBuilder << "RicAutomaticWellPathGroupingFeature";
}
if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteItemFeature" )->canFeatureBeExecuted() )
{
menuBuilder << "Separator";
@ -1331,7 +1317,6 @@ int RimContextCommandBuilder::appendImportMenu( caf::CmdFeatureMenuBuilder& menu
{
QStringList candidates;
candidates << "RicWellPathsImportFileFeature";
candidates << "RicImportGroupedWellPathsFeature";
candidates << "RicWellPathFormationsImportFileFeature";
candidates << "RicWellLogsImportFileFeature";
candidates << "RicReloadWellPathFormationNamesFeature";

View File

@ -453,7 +453,6 @@ void RiuMainWindow::createMenus()
importMenu->addSeparator();
QMenu* importWellMenu = importMenu->addMenu( QIcon( ":/Well.svg" ), "Well Data" );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicImportGroupedWellPathsFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathsImportSsihubFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellLogsImportFileFeature" ) );
importWellMenu->addAction( cmdFeatureMgr->action( "RicWellPathFormationsImportFileFeature" ) );