#3427 Export fishbones laterals. Use export well paths impl

This commit is contained in:
Bjørn Erik Jensen
2018-10-03 09:38:54 +02:00
parent 2b1c6e9706
commit 0c0ecc7d56
4 changed files with 112 additions and 74 deletions

View File

@@ -27,18 +27,15 @@
#include "RimWellPath.h"
#include "RimProject.h"
#include "RimSummaryCaseMainCollection.h"
#include "RimDialogData.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
#include "cafPdmUiPropertyViewDialog.h"
#include <QAction>
#include <QFileInfo>
#include <QFileDialog>
#include <QMessageBox>
#include <cafUtils.h>
#include <memory>
@@ -51,30 +48,39 @@ CAF_CMD_SOURCE_INIT(RicExportSelectedWellPathsFeature, "RicExportSelectedWellPat
//--------------------------------------------------------------------------------------------------
void RicExportSelectedWellPathsFeature::exportWellPath(const RimWellPath* wellPath, double mdStepSize, const QString& folder)
{
auto geom = wellPath->wellPathGeometry();
double currMd = geom->measureDepths().front() - mdStepSize;
double endMd = geom->measureDepths().back();
auto fileName = wellPath->name() + ".dev";
auto filePtr = openFileForExport(folder, fileName);
QTextStream stream(filePtr.get());
stream.setRealNumberNotation(QTextStream::FixedNotation);
auto stream = createOutputFileStream(*filePtr);
stream << "WELLNAME: '" << wellPath->name() << "'" << endl;
writeWellPathGeometryToStream(*stream, wellPath->wellPathGeometry(), wellPath->name(), mdStepSize);
filePtr->close();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStream& stream,
const RigWellPath* geometry,
const QString& wellName,
double mdStepSize)
{
double currMd = geometry->measureDepths().front() - mdStepSize;
double endMd = geometry->measureDepths().back();
stream << "WELLNAME: '" << caf::Utils::makeValidFileBasename(wellName) << "'" << endl;
while (currMd < endMd)
{
currMd += mdStepSize;
if (currMd > endMd) currMd = endMd;
auto pt = geom->interpolatedPointAlongWellPath(currMd);
auto pt = geometry->interpolatedPointAlongWellPath(currMd);
double tvd = -pt.z();
// Write to file
stream << pt.x() << " " << pt.y() << " " << tvd << " " << currMd << endl;
}
filePtr->close();
stream << -999 << endl << endl;
}
//--------------------------------------------------------------------------------------------------
@@ -100,6 +106,17 @@ QFilePtr RicExportSelectedWellPathsFeature::openFileForExport(const QString& fol
return exportFile;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QTextStreamPtr RicExportSelectedWellPathsFeature::createOutputFileStream(QFile& file)
{
auto stream = QTextStreamPtr(new QTextStream(&file));
stream->setRealNumberNotation(QTextStream::FixedNotation);
stream->setRealNumberPrecision(2);
return stream;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -164,7 +181,7 @@ RicExportWellPathsUi* RicExportSelectedWellPathsFeature::openDialog()
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
QString startPath = app->lastUsedDialogDirectory("WELL_LOGS_DIR");
QString startPath = app->lastUsedDialogDirectory("WELL_PATH_EXPORT_DIR");
if (startPath.isEmpty())
{
QFileInfo fi(proj->fileName());
@@ -172,7 +189,10 @@ RicExportWellPathsUi* RicExportSelectedWellPathsFeature::openDialog()
}
RicExportWellPathsUi* featureUi = app->project()->dialogData()->wellPathsExportData();
featureUi->setExportFolder(startPath);
if (featureUi->exportFolder().isEmpty())
{
featureUi->setExportFolder(startPath);
}
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, featureUi, "Export Well Paths", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
propertyDialog.resize(QSize(600, 60));
@@ -180,7 +200,7 @@ RicExportWellPathsUi* RicExportSelectedWellPathsFeature::openDialog()
if (propertyDialog.exec() == QDialog::Accepted && !featureUi->exportFolder().isEmpty())
{
auto dialogData = app->project()->dialogData()->wellPathsExportData();
app->setLastUsedDialogDirectory("WELL_LOGS_DIR", dialogData->exportFolder());
app->setLastUsedDialogDirectory("WELL_PATH_EXPORT_DIR", dialogData->exportFolder());
return dialogData;
}
return nullptr;