From 496c053dc458626774db55ddee3b2c23705d41ab Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Thu, 8 Feb 2018 15:07:25 +0100
Subject: [PATCH] Transitions to outside get z for both points

---
 src/SaxParser.cpp | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp
index 660581d..01cf46d 100644
--- a/src/SaxParser.cpp
+++ b/src/SaxParser.cpp
@@ -782,21 +782,20 @@ bool SaxParser::parseGeometryJPS(QString fileName, GeometryFactory& geoFac)
                 Point p2 = tr->GetPoint2();
                 double z1 = 0;
                 double z2 = 0;
-                if(! tr->GetSubRoom1())
+                
+                if(tr->GetSubRoom1()) // get elevation for both points
                 {
-                    std::cout << "Warning: transition " << tr->GetID() << ", " << tr->GetCaption() << " has no subroom1\n";
-                    std::cout << "\t Assume z1=0\n";
+                     z2 = tr->GetSubRoom1()->GetElevation(p2);
+                     z1 = tr->GetSubRoom1()->GetElevation(p1);
                 }
-                else
-                    z1 = tr->GetSubRoom1()->GetElevation(p2);
-                if(! tr->GetSubRoom2())
+                else if(! tr->GetSubRoom2())
                 {
-                    std::cout << "Warning: transition " << tr->GetID() << ", " << tr->GetCaption() << " has no subroom2. \n";
-                    std::cout << "\t Assume z2=0\n";
+                     z2 = tr->GetSubRoom2()->GetElevation(p2);
+                     z1 = tr->GetSubRoom2()->GetElevation(p1);
                 }
                 else
-                    z2 = tr->GetSubRoom2()->GetElevation(p1);
-
+                     std::cout << "ERROR: Can not calculate elevations for transition " << tr->GetID() << ", " << tr->GetCaption() << ". Both subrooms are not defined \n";
+                
                 geometry->addDoor(p1._x*FAKTOR, p1._y*FAKTOR, z1*FAKTOR, p2._x*FAKTOR, p2._y*FAKTOR,z2*FAKTOR);
 
                 const Point& p =tr->GetCentre();
-- 
GitLab