From 145be6052fb92cf37e46f1e10eaa10a60cf0b465 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Thu, 27 Feb 2003 00:21:22 +0000 Subject: [PATCH] Slightly change the way we compute the bounding box during OpenFile (not MergeFile), so that opening a file containing both a geometry/mesh and a view works as expected. --- Parser/OpenFile.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index ede8369cd8..e2403dd129 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.39 2003-02-12 20:27:14 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.40 2003-02-27 00:21:22 geuzaine Exp $ // // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // @@ -130,13 +130,19 @@ int MergeProblem(char *name){ void MergeProblemWithBoundingBox(char *name){ int nb = List_Nbr(CTX.post.list); int status = ParseFile(name,0); - if(List_Nbr(CTX.post.list) > nb) + if(List_Nbr(CTX.post.list) > nb){ + // if we merged a view, use it CalculateMinMax(NULL, ((Post_View*)List_Pointer (CTX.post.list,List_Nbr(CTX.post.list)-1))->BBox); - else if(!status) + } + else if(!status) { + // else, if we did not read a mesh, use the geomnetry CalculateMinMax(THEM->Points,NULL); - else + } + else{ + // else, use the mesh CalculateMinMax(THEM->Vertices,NULL); + } } void OpenProblem(char *name){ @@ -183,7 +189,6 @@ void OpenProblem(char *name){ if(!CTX.batch) WID->set_title(CTX.filename); #endif - int nb = List_Nbr(CTX.post.list); int status = MergeProblem(CTX.filename); ApplyLcFactor(THEM); @@ -199,14 +204,20 @@ void OpenProblem(char *name){ if(!CTX.batch) WID->reset_visibility(); ZeroHighlight(&M); #endif - - if(List_Nbr(CTX.post.list) > nb) + + if(!Tree_Nbr(THEM->Points) && !Tree_Nbr(THEM->Points) && List_Nbr(CTX.post.list)){ + // if there are no points or vertices and there is a view, use it CalculateMinMax(NULL, ((Post_View*)List_Pointer (CTX.post.list,List_Nbr(CTX.post.list)-1))->BBox); - else if(!status) + } + else if(!status){ + // else, if we don't have a mesh, use the geometry CalculateMinMax(THEM->Points,NULL); - else + } + else{ + // else, suppose we have a mesh (or use a default bbox if empty) CalculateMinMax(THEM->Vertices,NULL); + } } -- GitLab