2015-10-15 04:27:12 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// 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 "RicExportToLasFileFeature.h"
|
|
|
|
|
2017-06-28 03:13:59 -05:00
|
|
|
#include "RicExportFeatureImpl.h"
|
2016-09-19 04:17:36 -05:00
|
|
|
#include "RicExportToLasFileResampleUi.h"
|
2017-02-24 07:14:29 -06:00
|
|
|
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2016-09-16 05:46:25 -05:00
|
|
|
#include "RigLasFileExporter.h"
|
2017-02-24 07:14:29 -06:00
|
|
|
#include "RigWellLogCurveData.h"
|
2015-10-15 04:27:12 -05:00
|
|
|
|
2017-02-24 07:14:29 -06:00
|
|
|
#include "RimWellLogCurve.h"
|
2016-12-17 09:29:36 -06:00
|
|
|
|
2016-09-19 04:17:36 -05:00
|
|
|
#include "cafPdmUiPropertyViewDialog.h"
|
2015-10-15 04:27:12 -05:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicExportToLasFileFeature, "RicExportToLasFileFeature");
|
|
|
|
|
2016-09-16 05:46:25 -05:00
|
|
|
|
|
|
|
|
2015-10-15 04:27:12 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicExportToLasFileFeature::isCommandEnabled()
|
|
|
|
{
|
2017-02-07 02:34:11 -06:00
|
|
|
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
|
2017-10-10 04:18:35 -05:00
|
|
|
if (RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()) return false;
|
2017-02-07 02:34:11 -06:00
|
|
|
|
2016-12-17 09:29:36 -06:00
|
|
|
return RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().size() > 0;
|
2015-10-15 04:27:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
2017-04-20 03:38:58 -05:00
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
2017-02-07 02:34:11 -06:00
|
|
|
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
|
|
|
|
|
2016-12-17 09:29:36 -06:00
|
|
|
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
2016-09-16 05:46:25 -05:00
|
|
|
if (curves.size() == 0) return;
|
2015-10-15 07:39:53 -05:00
|
|
|
|
2018-10-09 09:05:15 -05:00
|
|
|
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder("WELL_LOGS_DIR");
|
2016-09-19 04:17:36 -05:00
|
|
|
|
2016-10-14 06:30:04 -05:00
|
|
|
RigLasFileExporter lasExporter(curves);
|
2016-09-19 04:17:36 -05:00
|
|
|
RicExportToLasFileResampleUi featureUi;
|
|
|
|
featureUi.exportFolder = defaultDir;
|
2016-10-14 06:30:04 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
std::vector<QString> wellNames;
|
|
|
|
std::vector<double> rkbDiffs;
|
|
|
|
lasExporter.wellPathsAndRkbDiff(&wellNames, &rkbDiffs);
|
|
|
|
featureUi.setRkbDiffs(wellNames, rkbDiffs);
|
|
|
|
}
|
|
|
|
|
2018-02-18 11:56:43 -06:00
|
|
|
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Export Curve Data to LAS file(s)", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
2017-06-28 03:13:59 -05:00
|
|
|
RicExportFeatureImpl::configureForExport(&propertyDialog);
|
2018-06-22 08:17:09 -05:00
|
|
|
propertyDialog.resize(QSize(400, 330));
|
2016-09-19 04:17:36 -05:00
|
|
|
|
|
|
|
if (propertyDialog.exec() == QDialog::Accepted &&
|
|
|
|
!featureUi.exportFolder().isEmpty())
|
2016-09-16 05:46:25 -05:00
|
|
|
{
|
2016-09-19 04:17:36 -05:00
|
|
|
if (featureUi.activateResample)
|
|
|
|
{
|
|
|
|
lasExporter.setResamplingInterval(featureUi.resampleInterval());
|
|
|
|
}
|
|
|
|
|
2016-10-14 06:30:04 -05:00
|
|
|
if (featureUi.exportTvdrkb)
|
|
|
|
{
|
|
|
|
std::vector<QString> wellNames;
|
|
|
|
std::vector<double> rkbDiffs;
|
|
|
|
lasExporter.wellPathsAndRkbDiff(&wellNames, &rkbDiffs);
|
|
|
|
|
|
|
|
std::vector<double> userDefRkbDiff;
|
|
|
|
featureUi.tvdrkbDiffForWellPaths(&userDefRkbDiff);
|
|
|
|
lasExporter.setRkbDiffs(wellNames, userDefRkbDiff);
|
|
|
|
}
|
|
|
|
|
2016-09-19 04:17:36 -05:00
|
|
|
lasExporter.writeToFolder(featureUi.exportFolder());
|
2016-09-14 02:44:32 -05:00
|
|
|
|
2016-09-16 05:46:25 -05:00
|
|
|
// Remember the path to next time
|
2016-09-21 02:46:17 -05:00
|
|
|
RiaApplication::instance()->setLastUsedDialogDirectory("WELL_LOGS_DIR", featureUi.exportFolder());
|
2015-10-15 04:27:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicExportToLasFileFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
2016-09-21 06:04:34 -05:00
|
|
|
actionToSetup->setText("Export To LAS Files...");
|
2015-10-15 04:27:12 -05:00
|
|
|
}
|
|
|
|
|