From f1cb0167ef9333dacab8b8580a93bbcb7bf69d20 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 22 Mar 2014 17:30:03 +0000
Subject: [PATCH] MergePostProcessingFile now only changes the bounding box if
 no bounding box exists

---
 Common/OpenFile.cpp | 8 +++++---
 Common/OpenFile.h   | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 0600d1d189..5951889fdd 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -262,7 +262,8 @@ static int defineSolver(const std::string &name)
   return NUM_SOLVERS - 1;
 }
 
-int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTitle)
+int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTitle,
+              bool setBoundingBox)
 {
   if(GModel::current()->getName() == ""){
     GModel::current()->setFileName(fileName);
@@ -470,7 +471,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit
   }
 
   ComputeMaxEntityNum();
-  SetBoundingBox();
+  if(setBoundingBox) SetBoundingBox();
   CTX::instance()->geom.draw = 1;
   CTX::instance()->mesh.changed = ENT_ALL;
 
@@ -542,7 +543,8 @@ int MergePostProcessingFile(const std::string &fileName, bool showLastStep,
     GModel *m = new GModel();
     GModel::setCurrent(m);
   }
-  int ret = MergeFile(fileName, warnIfMissing);
+  int ret = MergeFile(fileName, warnIfMissing, true,
+                      old->bounds().empty() ? true : false);
   GModel::setCurrent(old);
   old->setVisibility(1);
 
diff --git a/Common/OpenFile.h b/Common/OpenFile.h
index 2997f0e82f..c27007cf5f 100644
--- a/Common/OpenFile.h
+++ b/Common/OpenFile.h
@@ -13,7 +13,7 @@ void ParseString(const std::string &str);
 void OpenProject(const std::string &filename, bool setWindowTitle=true);
 void OpenProjectMacFinder(const char *fileName);
 int MergeFile(const std::string &fileName, bool warnIfMissing=false,
-              bool setWindowTitle=true);
+              bool setWindowTitle=true, bool setBoundingBox=true);
 int MergePostProcessingFile(const std::string &fileName, bool showLastStep=false,
                             bool hideNewViews=false, bool warnIfMissing=false);
 void ClearProject();
-- 
GitLab