From 33a8f773ae8ae220fe2933611e6c94e7f4138fa9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Dec 2018 12:47:07 +0100 Subject: [PATCH] #3827 Fishbone Laterals : Whole well is exported instead of lateral only --- .../RicExportFishbonesLateralsFeature.cpp | 2 +- .../RicExportSelectedWellPathsFeature.cpp | 52 ++++++++++++------- .../RicExportSelectedWellPathsFeature.h | 9 ++++ 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp index 728cf62b59..34222e8944 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicExportFishbonesLateralsFeature.cpp @@ -101,7 +101,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked) QString subIndexText = QString("%1").arg(sub.subIndex, 2, 10, QChar('0')); QString lateralName = QString("%1_%2_Sub%3_Lat%4").arg(wellPath->name()).arg(fishboneName).arg(subIndexText).arg(lateralIndex); - EXP::writeWellPathGeometryToStream(*stream, wellPath, lateralName, mdStepSize); + EXP::writeWellPathGeometryToStream(*stream, &geometry, lateralName, mdStepSize, false, 0.0, false); } } } diff --git a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp index 37086e16a8..9ad10316f7 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp @@ -75,6 +75,33 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStrea auto wellPathGeom = wellPath->wellPathGeometry(); if (!wellPathGeom) return; + bool useMdRkb = false; + double rkb = 0.0; + { + const RimModeledWellPath* modeledWellPath = dynamic_cast(wellPath); + if (modeledWellPath) + { + useMdRkb = true; + rkb = modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget(); + } + } + + writeWellPathGeometryToStream(stream, wellPathGeom, exportName, mdStepSize, useMdRkb, rkb, writeProjectInfo); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStream& stream, + const RigWellPath* wellPathGeom, + const QString& exportName, + double mdStepSize, + bool useMdRkb, + double rkbOffset, + bool writeProjectInfo) +{ + if (!wellPathGeom) return; + double currMd = wellPathGeom->measureDepths().front() - mdStepSize; double endMd = wellPathGeom->measureDepths().back(); @@ -88,27 +115,16 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStrea stream << endl; } - bool useMdRkb = false; - double rkb = 0.0; - { - const RimModeledWellPath* modeledWellPath = dynamic_cast(wellPath); - if (modeledWellPath) - { - useMdRkb = true; - rkb = modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget(); - } - } - stream << "WELLNAME: '" << caf::Utils::makeValidFileBasename(exportName) << "'" << endl; auto numberFormat = RifEclipseOutputTableDoubleFormatting(RIF_FLOAT, 2); formatter.header( - { - {"X", numberFormat, RIGHT}, - {"Y", numberFormat, RIGHT}, - {"TVDMSL", numberFormat, RIGHT}, - {useMdRkb ? "MDRKB" : "MDMSL", numberFormat, RIGHT} - }); + { + {"X", numberFormat, RIGHT}, + {"Y", numberFormat, RIGHT}, + {"TVDMSL", numberFormat, RIGHT}, + {useMdRkb ? "MDRKB" : "MDMSL", numberFormat, RIGHT} + }); while (currMd < endMd) { @@ -122,7 +138,7 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream(QTextStrea formatter.add(pt.x()); formatter.add(pt.y()); formatter.add(tvd); - formatter.add(currMd + rkb); + formatter.add(currMd + rkbOffset); formatter.rowCompleted(""); } formatter.tableCompleted("", false); diff --git a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h index 702e076fba..edf047d1d0 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h +++ b/ApplicationCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h @@ -51,12 +51,21 @@ class RicExportSelectedWellPathsFeature : public caf::CmdFeature static RicExportWellPathsUi* openDialog(); static QFilePtr openFileForExport(const QString& folderName, const QString& fileName); static QTextStreamPtr createOutputFileStream(QFile& file); + static void writeWellPathGeometryToStream(QTextStream& stream, const RimWellPath* wellPath, const QString& exportName, double mdStepSize, bool writeProjectInfo = true); + static void writeWellPathGeometryToStream(QTextStream& stream, + const RigWellPath* wellPath, + const QString& exportName, + double mdStepSize, + bool useMdRkb, + double rkbOffset, + bool writeProjectInfo); + private: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override;