From 2833da34a1163d68b5c61930b903fb4fc02c5214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 8 Jun 2017 12:59:12 +0200 Subject: [PATCH] #1560 Ensure eclipse case and well path uses same unit system when exporting --- ...RicWellPathExportCompletionDataFeature.cpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index 37188d5123..c27f9e2b1b 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -152,6 +152,28 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector return; } + { + bool unitSystemMismatch = false; + for (const RimWellPath* wellPath : wellPaths) + { + if (wellPath->unitSystem() == RimUnitSystem::UNITS_FIELD && exportSettings.caseToApply->eclipseCaseData()->unitsType() != RigEclipseCaseData::UNITS_FIELD) + { + unitSystemMismatch = true; + break; + } + else if (wellPath->unitSystem() == RimUnitSystem::UNITS_METRIC && exportSettings.caseToApply->eclipseCaseData()->unitsType() != RigEclipseCaseData::UNITS_METRIC) + { + unitSystemMismatch = true; + break; + } + } + if (unitSystemMismatch) + { + RiaLogging::error("Well path unit systems must match unit system of chosen eclipse case."); + return; + } + } + QTextStream stream(&exportFile); RifEclipseDataTableFormatter formatter(stream);