2017-05-15 09:04:11 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-05-16 07:50:54 -05:00
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2018-01-31 01:41:23 -06:00
|
|
|
//
|
2017-05-15 09:04:11 -05: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.
|
2018-01-31 01:41:23 -06:00
|
|
|
//
|
2017-05-15 09:04:11 -05: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.
|
2018-01-31 01:41:23 -06:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-05-15 09:04:11 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicWellPathExportCompletionDataFeature.h"
|
2018-01-31 00:55:24 -06:00
|
|
|
#include "RicWellPathExportCompletionDataFeatureImpl.h"
|
2017-05-15 09:04:11 -05:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2017-06-28 03:13:59 -05:00
|
|
|
#include "RicExportFeatureImpl.h"
|
2018-11-09 01:51:30 -06:00
|
|
|
#include "ExportCommands/RicExportLgrFeature.h"
|
2017-06-28 03:13:59 -05:00
|
|
|
|
2017-12-19 06:27:18 -06:00
|
|
|
#include "RimDialogData.h"
|
2018-04-09 04:23:14 -05:00
|
|
|
#include "RimFishbonesMultipleSubs.h"
|
|
|
|
#include "RimPerforationInterval.h"
|
2017-06-28 03:13:59 -05:00
|
|
|
#include "RimProject.h"
|
2018-04-09 04:23:14 -05:00
|
|
|
#include "RimSimWellFracture.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimSimWellInView.h"
|
2018-01-31 01:41:23 -06:00
|
|
|
#include "RimSimWellInViewCollection.h"
|
2017-06-28 03:13:59 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
2018-04-09 04:23:14 -05:00
|
|
|
#include "RimWellPathFracture.h"
|
2017-06-07 09:04:34 -05:00
|
|
|
|
2018-02-27 09:37:06 -06:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2017-05-15 09:04:11 -05:00
|
|
|
|
|
|
|
#include "cafPdmUiPropertyViewDialog.h"
|
2017-06-28 03:13:59 -05:00
|
|
|
#include "cafSelectionManager.h"
|
2017-05-15 09:04:11 -05:00
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2017-05-16 07:50:54 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature");
|
2017-05-15 09:04:11 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-31 01:41:23 -06:00
|
|
|
///
|
2017-05-15 09:04:11 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-09 03:08:10 -05:00
|
|
|
void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(
|
|
|
|
const QString& dialogTitle,
|
|
|
|
const std::vector<RimWellPath*>& wellPaths,
|
|
|
|
const std::vector<RimSimWellInView*>& simWells)
|
2017-05-15 09:04:11 -05:00
|
|
|
{
|
2018-10-09 09:05:15 -05:00
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
RimProject* project = app->project();
|
|
|
|
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder("COMPLETIONS");
|
2017-05-15 09:04:11 -05:00
|
|
|
|
2018-04-06 07:09:40 -05:00
|
|
|
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
2017-06-12 05:03:42 -05:00
|
|
|
|
|
|
|
if (wellPaths.empty())
|
|
|
|
{
|
2017-12-19 06:27:18 -06:00
|
|
|
exportSettings->showForSimWells();
|
2017-06-12 05:03:42 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-12-19 06:27:18 -06:00
|
|
|
exportSettings->showForWellPath();
|
2017-06-12 05:03:42 -05:00
|
|
|
}
|
2017-12-22 06:50:49 -06:00
|
|
|
|
|
|
|
if (!exportSettings->caseToApply())
|
2017-05-19 04:09:36 -05:00
|
|
|
{
|
2017-12-22 06:50:49 -06:00
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
app->project()->allCases(cases);
|
|
|
|
for (auto c : cases)
|
2017-05-19 04:09:36 -05:00
|
|
|
{
|
2017-12-22 06:50:49 -06:00
|
|
|
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(c);
|
|
|
|
if (eclipseCase != nullptr)
|
|
|
|
{
|
|
|
|
exportSettings->caseToApply = eclipseCase;
|
|
|
|
break;
|
|
|
|
}
|
2017-05-19 04:09:36 -05:00
|
|
|
}
|
|
|
|
}
|
2017-05-15 09:04:11 -05:00
|
|
|
|
2018-01-31 01:41:23 -06:00
|
|
|
if (exportSettings->folder().isEmpty()) exportSettings->folder = defaultDir;
|
2017-05-15 09:04:11 -05:00
|
|
|
|
2018-04-09 04:23:14 -05:00
|
|
|
std::vector<RimSimWellFracture*> simWellFractures;
|
|
|
|
std::vector<RimWellPathFracture*> wellPathFractures;
|
|
|
|
std::vector<RimFishbonesMultipleSubs*> wellPathFishbones;
|
|
|
|
std::vector<RimPerforationInterval*> wellPathPerforations;
|
|
|
|
|
|
|
|
for (auto s : simWells)
|
|
|
|
{
|
|
|
|
s->descendantsIncludingThisOfType(simWellFractures);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto w : wellPaths)
|
|
|
|
{
|
|
|
|
w->descendantsIncludingThisOfType(wellPathFractures);
|
|
|
|
w->descendantsIncludingThisOfType(wellPathFishbones);
|
|
|
|
w->descendantsIncludingThisOfType(wellPathPerforations);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((!simWellFractures.empty()) || (!wellPathFractures.empty()))
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
exportSettings->showFractureInUi(true);
|
2018-04-09 04:23:14 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
exportSettings->showFractureInUi(false);
|
2018-04-09 04:23:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!wellPathFishbones.empty())
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
exportSettings->showFishbonesInUi(true);
|
2018-04-09 04:23:14 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
exportSettings->showFishbonesInUi(false);
|
2018-04-09 04:23:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!wellPathPerforations.empty())
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
exportSettings->showPerforationsInUi(true);
|
2018-04-09 04:23:14 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
exportSettings->showPerforationsInUi(false);
|
2018-04-09 04:23:14 -05:00
|
|
|
}
|
|
|
|
|
2018-04-09 03:08:10 -05:00
|
|
|
caf::PdmUiPropertyViewDialog propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), exportSettings, dialogTitle, "");
|
2017-06-28 03:13:59 -05:00
|
|
|
RicExportFeatureImpl::configureForExport(&propertyDialog);
|
|
|
|
|
2017-05-15 09:04:11 -05:00
|
|
|
if (propertyDialog.exec() == QDialog::Accepted)
|
|
|
|
{
|
2017-12-19 06:27:18 -06:00
|
|
|
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", exportSettings->folder);
|
2017-05-15 09:04:11 -05:00
|
|
|
|
2018-01-31 00:42:19 -06:00
|
|
|
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
2017-05-15 09:04:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-09 03:08:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicWellPathExportCompletionDataFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
|
|
|
|
|
|
|
if (wellPaths.empty())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
|
|
|
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
|
|
|
CVF_ASSERT(!wellPaths.empty());
|
|
|
|
|
|
|
|
std::vector<RimSimWellInView*> simWells;
|
|
|
|
QString dialogTitle = "Export Completion Data for Selected Well Paths";
|
|
|
|
|
|
|
|
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
|
|
|
|
}
|
|
|
|
|
2017-05-15 09:04:11 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-31 01:41:23 -06:00
|
|
|
///
|
2017-05-15 09:04:11 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicWellPathExportCompletionDataFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
2018-04-09 02:29:41 -05:00
|
|
|
actionToSetup->setText("Export Completion Data for Selected Well Paths");
|
2018-11-13 08:43:36 -06:00
|
|
|
actionToSetup->setIcon(QIcon(":/ExportCompletionsSymbol16x16.png"));
|
|
|
|
|
2017-05-15 09:04:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-31 01:41:23 -06:00
|
|
|
///
|
2017-05-15 09:04:11 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-29 08:52:35 -05:00
|
|
|
std::vector<RimWellPath*> RicWellPathExportCompletionDataFeature::selectedWellPaths()
|
|
|
|
{
|
|
|
|
std::vector<RimWellPath*> wellPaths;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
|
|
|
|
|
|
|
std::set<RimWellPath*> uniqueWellPaths(wellPaths.begin(), wellPaths.end());
|
|
|
|
wellPaths.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
|
|
|
|
|
2018-04-09 02:29:41 -05:00
|
|
|
return wellPaths;
|
2017-06-12 05:03:42 -05:00
|
|
|
}
|