From 39da38548e36c1a62b8d5aeba52078ce7a51b1b8 Mon Sep 17 00:00:00 2001
From: Ulrich Kemloh <u.kemloh@fz-juelich.de>
Date: Fri, 8 Feb 2013 13:47:09 +0000
Subject: [PATCH] the geometry must not lied on the same plane anymore !

---
 src/InteractorStyle.cpp           |  2 +-
 src/SaxParser.cpp                 | 45 +++++++++++++++++--------------
 src/geometry/FacilityGeometry.cpp | 18 ++++++-------
 src/geometry/FacilityGeometry.h   |  6 ++---
 src/main.cpp                      |  3 ++-
 5 files changed, 40 insertions(+), 34 deletions(-)

diff --git a/src/InteractorStyle.cpp b/src/InteractorStyle.cpp
index 6be369c..61fcbb1 100644
--- a/src/InteractorStyle.cpp
+++ b/src/InteractorStyle.cpp
@@ -71,7 +71,7 @@ void InteractorStyle::SetSource() {
 
 //forward the event only if not in 2d mode
 void InteractorStyle::Rotate() {
-	if(!SystemSettings::get2D())
+	//if(!SystemSettings::get2D())
 	vtkInteractorStyleTrackballCamera::Rotate();
 }
 
diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp
index 6150593..de2e3b4 100644
--- a/src/SaxParser.cpp
+++ b/src/SaxParser.cpp
@@ -623,15 +623,15 @@ void SaxParser::parseGeometryJUL(QString fileName, FacilityGeometry *geometry){
 		for(int j=0; j<anz_walls; j++)
 		{
 			Line l = r.GetWall(j).GetLine();
-			geometry->addWall(l.GetPoint1().GetX()*100, l.GetPoint1().GetY()*100,
-					l.GetPoint2().GetX()*100, l.GetPoint2().GetY()*100);
+			geometry->addWall(l.GetPoint1().GetX()*100, l.GetPoint1().GetY()*100,0.0,
+					l.GetPoint2().GetX()*100, l.GetPoint2().GetY()*100,0.0);
 		}
 		int anz_trans = r.GetAllTransitions().size();
 		for(int j=0; j<anz_trans; j++)
 		{
 			Line l = r.GetTransition(j).GetLine();
-			geometry->addDoor(l.GetPoint1().GetX()*100, l.GetPoint1().GetY()*100,
-					l.GetPoint2().GetX()*100, l.GetPoint2().GetY()*100);
+			geometry->addDoor(l.GetPoint1().GetX()*100, l.GetPoint1().GetY()*100,0.0,
+					l.GetPoint2().GetX()*100, l.GetPoint2().GetY()*100,0.0);
 		}
 	}
 
@@ -667,15 +667,15 @@ void SaxParser::parseGeometryPG3(QString fileName, FacilityGeometry *geometry){
 			l.CopyData(r.GetLine(j));
 
 			if(l.GetType()==1) /* WALL */
-				geometry->addWall(l.GetPoint1().GetX()*100+x+z, l.GetPoint1().GetY()*100+y,
-						l.GetPoint2().GetX()*100+x+z, l.GetPoint2().GetY()*100+y);
+				geometry->addWall(l.GetPoint1().GetX()*100+x+z, l.GetPoint1().GetY()*100+y,0.0,
+						l.GetPoint2().GetX()*100+x+z, l.GetPoint2().GetY()*100+y,0.0);
 
 			if(l.GetType()==2) /* STEP */
-				geometry->addStep(l.GetPoint1().GetX()*100+x+z, l.GetPoint1().GetY()*100+y,
-						l.GetPoint2().GetX()*100+x+z, l.GetPoint2().GetY()*100+y);
+				geometry->addStep(l.GetPoint1().GetX()*100+x+z, l.GetPoint1().GetY()*100+y,0.0,
+						l.GetPoint2().GetX()*100+x+z, l.GetPoint2().GetY()*100+y,0.0);
 			if(l.GetType()==3) /* TRANS */
-				geometry->addDoor(l.GetPoint1().GetX()*100+x+z, l.GetPoint1().GetY()*100+y,
-						l.GetPoint2().GetX()*100+x+z, l.GetPoint2().GetY()*100+y);
+				geometry->addDoor(l.GetPoint1().GetX()*100+x+z, l.GetPoint1().GetY()*100+y,0.0,
+						l.GetPoint2().GetX()*100+x+z, l.GetPoint2().GetY()*100+y,0.0);
 		}
 	}
 
@@ -767,7 +767,8 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 
 				double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble();
 				double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble();
-				geometry->addWall(x1, y1, x2, y2,z1,thickness,height,color);
+				double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble();
+				geometry->addWall(x1, y1,z1 ,x2, y2,z2,thickness,height,color);
 			}
 		}
 
@@ -791,12 +792,12 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 
 					double x1=points.item(i).toElement().attribute("xPos", "0").toDouble();
 					double y1=points.item(i).toElement().attribute("yPos", "0").toDouble();
-					double z=points.item(i).toElement().attribute("zPos", "0").toDouble();
+					double z1=points.item(i).toElement().attribute("zPos", "0").toDouble();
 
 					double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble();
 					double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble();
-					z=points.item(i+1).toElement().attribute("z", "0").toDouble();
-					geometry->addDoor(x1, y1, x2, y2,z,thickness,height,color);
+					double z2=points.item(i+1).toElement().attribute("z", "0").toDouble();
+					geometry->addDoor(x1, y1, z1, x2, y2,z2,thickness,height,color);
 				}
 			}
 
@@ -929,12 +930,13 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){
 				double z1=xVertices.item(i).toElement().attribute("pz", "0").toDouble()*xToCmfactor;
 				double x2=xVertices.item(i+1).toElement().attribute("px", "0").toDouble()*xToCmfactor;
 				double y2=xVertices.item(i+1).toElement().attribute("py", "0").toDouble()*xToCmfactor;
+				double z2=xVertices.item(i+1).toElement().attribute("pz", "0").toDouble()*xToCmfactor;
 
 				position[0]+= x1;
 				position[1]+= y1;
 				position[2]+= z1;
 
-				geo->addWall(x1, y1, x2, y2,z1,thickness,height,color);
+				geo->addWall(x1, y1, z1, x2, y2,z2,thickness,height,color);
 			}
 			xPoly = xPoly.nextSiblingElement("polygon");
 		}
@@ -970,7 +972,8 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){
 
 				double x2=xVertices.item(i+1).toElement().attribute("px", "0").toDouble()*xToCmfactor;
 				double y2=xVertices.item(i+1).toElement().attribute("py", "0").toDouble()*xToCmfactor;
-				geo->addWall(x1, y1, x2, y2,z1,thickness,height,color);
+				double z2=xVertices.item(i+1).toElement().attribute("pz", "0").toDouble()*xToCmfactor;
+				geo->addWall(x1, y1, z1, x2, y2,z2,thickness,height,color);
 			}
 			xPoly = xPoly.nextSiblingElement("polygon");
 		}
@@ -995,9 +998,10 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){
 
 		double x2=xVertices.item(1).toElement().attribute("px", "0").toDouble()*xToCmfactor;
 		double y2=xVertices.item(1).toElement().attribute("py", "0").toDouble()*xToCmfactor;
-		geo->addDoor(x1, y1, x2, y2,z1,thickness,height,color);
+		double z2=xVertices.item(1).toElement().attribute("pz", "0").toDouble()*xToCmfactor;
+		geo->addDoor(x1, y1, z1, x2, y2,z2,thickness,height,color);
 
-		double center[3]={(x1+x2)/2.0, (y1+y2)/2.0, z1};
+		double center[3]={(x1+x2)/2.0, (y1+y2)/2.0, (z2+z1)/2.0};
 		geo->addObjectLabel(center,center,id.toStdString(),21);
 	}
 
@@ -1019,10 +1023,11 @@ void SaxParser::parseGeometryXMLV04(QString filename, FacilityGeometry *geo){
 
 		double x2=xVertices.item(1).toElement().attribute("px", "0").toDouble()*xToCmfactor;
 		double y2=xVertices.item(1).toElement().attribute("py", "0").toDouble()*xToCmfactor;
-		geo->addDoor(x1, y1, x2, y2,z1,thickness,height,color);
+		double z2=xVertices.item(1).toElement().attribute("pz", "0").toDouble()*xToCmfactor;
+		geo->addDoor(x1, y1, z1, x2, y2,z2,thickness,height,color);
 
 		string id= xTransition.attribute("id","-1").toStdString();
-		double center[3]={(x1+x2)/2.0, (y1+y2)/2.0, z1};
+		double center[3]={(x1+x2)/2.0, (y1+y2)/2.0, (z2+z1)/2.0};
 		geo->addObjectLabel(center,center,id,21);
 	}
 }
diff --git a/src/geometry/FacilityGeometry.cpp b/src/geometry/FacilityGeometry.cpp
index 118dbc6..f7c0259 100644
--- a/src/geometry/FacilityGeometry.cpp
+++ b/src/geometry/FacilityGeometry.cpp
@@ -254,25 +254,25 @@ vtkAssembly* FacilityGeometry::getActor(){
 //	actor->Delete();
 //}
 
-void FacilityGeometry::addWall(double x1, double y1, double x2, double y2, double z,double thickness,double height,double color){
+void FacilityGeometry::addWall(double x1, double y1, double z1, double x2, double y2, double z2,double thickness,double height,double color){
 
 	// all walls will have this parameters until changed
 	wallColor=color;
 
 	//	if(SystemSettings::get2D()){
-	double m[]={x1,y1,z};
-	double n[]={x2,y2,z};
+	double m[]={x1,y1,z1};
+	double n[]={x2,y2,z2};
 	linesPlotter2D->PlotWall(m,n,wallColor/255.0);
 }
 
-void FacilityGeometry::addDoor(double x1, double y1, double x2, double y2, double z,double thickness ,double height, double color){
+void FacilityGeometry::addDoor(double x1, double y1, double z1, double x2, double y2, double z2,double thickness ,double height, double color){
 
 	// all doors will take this color upon changed
 	doorColor=color;
 	//constructing the 2D assembly
 	//	if(SystemSettings::get2D()){
-	double m[]={x1,y1,z};
-	double n[]={x2,y2,z};
+	double m[]={x1,y1,z1};
+	double n[]={x2,y2,z2};
 
 	//double m[]={x1,y1,z+1};
 	//double n[]={x2,y2,z+1};
@@ -281,10 +281,10 @@ void FacilityGeometry::addDoor(double x1, double y1, double x2, double y2, doubl
 	linesPlotter2D->PlotDoor(m,n,doorColor/255.0);
 }
 
-void FacilityGeometry::addStep(double x1, double y1, double x2, double y2, double z)
+void FacilityGeometry::addStep(double x1, double y1, double z1, double x2, double y2, double z2)
 {
-	double m[]={x1,y1,z};
-	double n[]={x2,y2,z};
+	double m[]={x1,y1,z1};
+	double n[]={x2,y2,z2};
 	linesPlotter2D->PlotDoor(m,n,doorColor/255.0);
 }
 
diff --git a/src/geometry/FacilityGeometry.h b/src/geometry/FacilityGeometry.h
index adf7b5f..c5f9468 100644
--- a/src/geometry/FacilityGeometry.h
+++ b/src/geometry/FacilityGeometry.h
@@ -71,18 +71,18 @@ public:
 	vtkActor2DCollection* getCaptions();
 
 	///draw a wall
-	void addWall(double x1, double y1, double x2, double y2, double z=0, double thickness=15, double height=250,double col=255);
+	void addWall(double x1, double y1, double z1, double x2, double y2, double z2, double thickness=15, double height=250,double col=255);
 	//void addWall(double center[3], double width, double orientation);
 	void addWall(Point* p1, Point* p2, std::string caption="");
 
 	///draw a door
-	void addDoor(double x1, double y1, double x2, double y2, double z=0, double thickness=17, double height=250,double col=30);
+	void addDoor(double x1, double y1, double z1 ,double x2, double y2, double z2, double thickness=17, double height=250,double col=30);
 	//void addDoor(double center[3], double width, double orientation);
 	void addDoor(Point* p1, Point* p2, std::string caption="");
 
 	///draw a step
 	///todo: implement thickness and color
-	void addStep(double x1, double y1, double x2, double y2, double z=0/*, double thickness=30, double height=10,double col=50*/);
+	void addStep(double x1, double y1, double z1, double x2, double y2, double z2=0/*, double thickness=30, double height=10,double col=50*/);
 	//void addStep(double center[3], double width, double orientation);
 	void addStep(Point* p1, Point* p2);
 
diff --git a/src/main.cpp b/src/main.cpp
index 5870074..13b8fd4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -35,7 +35,7 @@
 *
 * \date 7.6.2010
 *
-* TraVisTo stands for Trajectories Visualisation Tool and is part of the OPS Project.
+* JuPedSim stands for Jülich Pedestrians Simulator and is currently developed at the Forschungszentrum Jülich in Germany.
 *
 * @image html travisto.png " "
 *
@@ -45,6 +45,7 @@
 * 	2: <a href="http://www.vtk.org">www.vtk.org</a> <br>
 * 	3: <a href="http://www.trolltech.com">www.trolltech.com</a> <br>
 * 	4: <a href="http://www.fz-juelich.de">www.fz-juelich.de</a> <br>
+* 	4: <a href="http://www.jupedsim.org">www.fz-juelich.de</a> <br>
 *
 */
 
-- 
GitLab