From 5171f9c6962bc9ff3e100aba4adb2d6c94125474 Mon Sep 17 00:00:00 2001
From: Ulrich Kemloh <kemlohulrich@gmail.com>
Date: Thu, 26 Jun 2014 17:42:50 +0200
Subject: [PATCH] The unit "metre" is now working in online mode

---
 JPSvis.pro                  | 97 +++++++++++++++++++++++++++++++++++--
 src/SaxParser.cpp           | 82 +++++++++++++++----------------
 src/ThreadDataTransfert.cpp | 31 ++++++------
 3 files changed, 150 insertions(+), 60 deletions(-)

diff --git a/JPSvis.pro b/JPSvis.pro
index 59c0f83..413b8ff 100644
--- a/JPSvis.pro
+++ b/JPSvis.pro
@@ -1,19 +1,110 @@
 TEMPLATE = app
-TARGET = JPSvis
+TARGET = TraVisTo
 CONFIG += qt
+CONFIG += static
 QT += xml network
 
+#avoid some annoying dependencies
+#QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
+#QMAKE_LFLAGS += -static -static-libstdc++
+#QMAKE_CXXFLAGS += -static -static -static-libstdc++
+
 greaterThan(QT_MAJOR_VERSION, 4):QT += widgets
 
 win32 {
         INCLUDEPATH += C:/VTK/include/vtk-6.1
+
+        LIBS += -LC:/VTK/bin \
+        #LIBS += -LC:/VTK/bin_static/lib \
+        -lwsock32 \
+        -lvtkCommonCore-6.1    \
+        -lvtkRenderingOpenGL-6.1  \
+        -lvtkCommonDataModel-6.1    \
+        -lvtkCommonMath-6.1   \
+        -lvtkCommonMisc-6.1    \
+        -lvtkCommonSystem-6.1    \
+        -lvtkCommonTransforms-6.1   \
+        -lvtkCommonExecutionModel-6.1   \
+        -lvtkImagingHybrid-6.1   \
+        -lvtkIOImage-6.1   \
+        -lvtkDICOMParser-6.1   \
+        -lvtkjpeg-6.1   \
+        -lvtkmetaio-6.1   \
+        -lvtkzlib-6.1   \
+        -lvtkpng-6.1   \
+        -lvtktiff-6.1   \
+        -lvtkRenderingCore-6.1   \
+        -lvtkCommonComputationalGeometry-6.1   \
+        -lvtkFiltersCore-6.1   \
+        -lvtkFiltersExtraction-6.1   \
+        -lvtkFiltersGeneral-6.1   \
+        -lvtkFiltersStatistics-6.1   \
+        -lvtkalglib-6.1   \
+        -lvtkImagingFourier-6.1   \
+        -lvtkImagingCore-6.1   \
+        -lvtkFiltersGeometry-6.1   \
+        -lvtkFiltersSources-6.1   \
+        -lvtkRenderingLabel-6.1   \
+        -lvtkRenderingFreeType-6.1   \
+        -lvtkfreetype-6.1   \
+        -lvtkftgl-6.1   \
+        -lvtkRenderingFreeTypeOpenGL-6.1   \
+        -lvtkRenderingAnnotation-6.1   \
+        -lvtkIOMovie-6.1   \
+        -lvtkoggtheora-6.1   \
+        -lvtkInteractionStyle-6.1   \
+        -lvtkCommonCore-6.1    \
+        -lvtksys-6.1     \
+#second round
+#        -lvtksys-6.1     \
+#        -lvtkRenderingOpenGL-6.1  \
+#        -lvtkCommonCore-6.1    \
+#        -lvtkCommonDataModel-6.1    \
+#        -lvtkCommonMath-6.1   \
+#        -lvtkCommonMisc-6.1    \
+#        -lvtkCommonSystem-6.1    \
+#        -lvtkCommonTransforms-6.1   \
+#        -lvtkCommonExecutionModel-6.1   \
+#        -lvtkImagingHybrid-6.1   \
+#        -lvtkIOImage-6.1   \
+#        -lvtkDICOMParser-6.1   \
+#        -lvtkjpeg-6.1   \
+#        -lvtkmetaio-6.1   \
+#        -lvtkzlib-6.1   \
+#        -lvtkpng-6.1   \
+#        -lvtktiff-6.1   \
+#        -lvtkRenderingCore-6.1   \
+#        -lvtkCommonComputationalGeometry-6.1   \
+#        -lvtkFiltersCore-6.1   \
+#        -lvtkFiltersExtraction-6.1   \
+#        -lvtkFiltersGeneral-6.1   \
+#        -lvtkFiltersStatistics-6.1   \
+#        -lvtkalglib-6.1   \
+#        -lvtkImagingFourier-6.1   \
+#        -lvtkImagingCore-6.1   \
+#        -lvtkFiltersGeometry-6.1   \
+#        -lvtkFiltersSources-6.1   \
+#        -lvtkRenderingLabel-6.1   \
+#        -lvtkRenderingFreeType-6.1   \
+#        -lvtkfreetype-6.1   \
+#        -lvtkftgl-6.1   \
+#        -lvtkRenderingFreeTypeOpenGL-6.1   \
+#        -lvtkRenderingAnnotation-6.1   \
+#        -lvtkIOMovie-6.1   \
+#        -lvtkoggtheora-6.1   \
+#        -lvtkInteractionStyle-6.1   \
+        }
+
+win32__ {
+        INCLUDEPATH += C:/VTK/include/vtk-6.1
 	
-	LIBS += -LC:/VTK/bin \
+        LIBS += -LC:/VTK/bin \
+#        LIBS += -LC:/VTK/bin_static/lib \
+            -lvtkCommonCore-6.1  \
             -lvtkalglib-6.1  \
             -lvtkChartsCore-6.1  \
             -lvtkCommonColor-6.1  \
             -lvtkCommonComputationalGeometry-6.1  \
-            -lvtkCommonCore-6.1  \
             -lvtkCommonDataModel-6.1  \
             -lvtkCommonExecutionModel-6.1  \
             -lvtkCommonMath-6.1  \
diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp
index bd42558..8734ce2 100644
--- a/src/SaxParser.cpp
+++ b/src/SaxParser.cpp
@@ -756,9 +756,9 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 			QDomElement el = walls.item(i).toElement();
 
 			//wall thickness, default to 30 cm
-			double thickness = el.attribute("thickness","15").toDouble();
+            double thickness = el.attribute("thickness","15").toDouble()*FAKTOR;
 			//wall height default to 250 cm
-			double height = el.attribute("height","250").toDouble();
+            double height = el.attribute("height","250").toDouble()*FAKTOR;
 			//wall color default to blue
 			double color = el.attribute("color","0").toDouble();
 
@@ -767,13 +767,13 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 			QDomNodeList points = el.elementsByTagName("point");
 			for (unsigned int i = 0; i < points.length() - 1; i++) {
 
-				double x1=points.item(i).toElement().attribute("xPos", "0").toDouble();
-				double y1=points.item(i).toElement().attribute("yPos", "0").toDouble();
-				double z1=points.item(i).toElement().attribute("zPos", "0").toDouble();
+                double x1=points.item(i).toElement().attribute("xPos", "0").toDouble()*FAKTOR;
+                double y1=points.item(i).toElement().attribute("yPos", "0").toDouble()*FAKTOR;
+                double z1=points.item(i).toElement().attribute("zPos", "0").toDouble()*FAKTOR;
 
-				double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble();
-				double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble();
-				double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble();
+                double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble()*FAKTOR;
+                double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble()*FAKTOR;
+                double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble()*FAKTOR;
 				geometry->addWall(x1, y1,z1 ,x2, y2,z2,thickness,height,color);
 			}
 		}
@@ -784,9 +784,9 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 				QDomElement el = doors.item(i).toElement();
 
 				//door thickness, default to 15 cm
-				double thickness = el.attribute("thickness","15").toDouble();
+                double thickness = el.attribute("thickness","15").toDouble()*FAKTOR;
 				//door height default to 250 cm
-				double height = el.attribute("height","250").toDouble();
+                double height = el.attribute("height","250").toDouble()*FAKTOR;
 				//door color default to blue
 				double color = el.attribute("color","255").toDouble();
 
@@ -796,13 +796,13 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 				//Debug::Messages("found:  " << points.length() <<" for this wall" <<endl;
 				for (unsigned int i = 0; i < points.length() - 1; i++) {
 
-					double x1=points.item(i).toElement().attribute("xPos", "0").toDouble();
-					double y1=points.item(i).toElement().attribute("yPos", "0").toDouble();
-					double z1=points.item(i).toElement().attribute("zPos", "0").toDouble();
+                    double x1=points.item(i).toElement().attribute("xPos", "0").toDouble()*FAKTOR;
+                    double y1=points.item(i).toElement().attribute("yPos", "0").toDouble()*FAKTOR;
+                    double z1=points.item(i).toElement().attribute("zPos", "0").toDouble()*FAKTOR;
 
-					double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble();
-					double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble();
-					double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble();
+                    double x2=points.item(i+1).toElement().attribute("xPos", "0").toDouble()*FAKTOR;
+                    double y2=points.item(i+1).toElement().attribute("yPos", "0").toDouble()*FAKTOR;
+                    double z2=points.item(i+1).toElement().attribute("zPos", "0").toDouble()*FAKTOR;
 					geometry->addDoor(x1, y1, z1, x2, y2,z2,thickness,height,color);
 				}
 			}
@@ -811,11 +811,11 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 		for (unsigned int i = 0; i < spheres.length(); i++) {
 
 			double center[3];
-			center[0] = spheres.item(i).toElement().attribute("centerX", "0").toDouble();
-			center[1]= spheres.item(i).toElement().attribute("centerY", "0").toDouble();
-			center[2]= spheres.item(i).toElement().attribute("centerZ", "0").toDouble();
-			double color= spheres.item(i).toElement().attribute("color", "0").toDouble();
-			double radius= spheres.item(i).toElement().attribute("radius", "0").toDouble();
+            center[0] = spheres.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR;
+            center[1]= spheres.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR;
+            center[2]= spheres.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR;
+            double color= spheres.item(i).toElement().attribute("color", "0").toDouble()*FAKTOR;
+            double radius= spheres.item(i).toElement().attribute("radius", "0").toDouble()*FAKTOR;
 			//double width = spheres.item(i).toElement().attribute("width", "0").toDouble();
 			//double height= spheres.item(i).toElement().attribute("height", "0").toDouble();
 
@@ -825,49 +825,49 @@ void SaxParser::parseGeometryTRAV(QString content, FacilityGeometry *geometry,QD
 		for (unsigned int i = 0; i < cuboids.length(); i++) {
 
 			double center[3];
-			center[0] = cuboids.item(i).toElement().attribute("centerX", "0").toDouble();
-			center[1]= cuboids.item(i).toElement().attribute("centerY", "0").toDouble();
-			center[2]= cuboids.item(i).toElement().attribute("centerZ", "0").toDouble();
+            center[0] = cuboids.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR;
+            center[1]= cuboids.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR;
+            center[2]= cuboids.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR;
 			double color= cuboids.item(i).toElement().attribute("color", "0").toDouble();
-			double length= cuboids.item(i).toElement().attribute("length", "0").toDouble();
-			double width = cuboids.item(i).toElement().attribute("width", "0").toDouble();
-			double height= cuboids.item(i).toElement().attribute("height", "0").toDouble();
+            double length= cuboids.item(i).toElement().attribute("length", "0").toDouble()*FAKTOR;
+            double width = cuboids.item(i).toElement().attribute("width", "0").toDouble()*FAKTOR;
+            double height= cuboids.item(i).toElement().attribute("height", "0").toDouble()*FAKTOR;
 			geometry->addObjectBox(center,height,width,length,color);
 			//		Debug::Error("cuboids: "<<length<<" || " <<width << " || "<<height<<" || "<<color<<endl;
 		}
 		// floors
         for (  int i = 0; i < floors.length(); i++) {
 
-			double left =floors.item(i).toElement().attribute("xMin","0").toDouble();
-			double right =floors.item(i).toElement().attribute("xMax","0").toDouble();
-			double up =floors.item(i).toElement().attribute("yMax","0").toDouble();
-			double down =floors.item(i).toElement().attribute("yMin","0").toDouble();
-			double z =floors.item(i).toElement().attribute("z","0").toDouble();
+            double left =floors.item(i).toElement().attribute("xMin","0").toDouble()*FAKTOR;
+            double right =floors.item(i).toElement().attribute("xMax","0").toDouble()*FAKTOR;
+            double up =floors.item(i).toElement().attribute("yMax","0").toDouble()*FAKTOR;
+            double down =floors.item(i).toElement().attribute("yMin","0").toDouble()*FAKTOR;
+            double z =floors.item(i).toElement().attribute("z","0").toDouble()*FAKTOR;
 			geometry->addFloor(left,down,right,up,z);
 		}
 		// cylinders
         for (  int i = 0; i < cylinders.length(); i++) {
 
 			double center[3], rotation[3];
-			center[0] = cylinders.item(i).toElement().attribute("centerX", "0").toDouble();
-			center[1]= cylinders.item(i).toElement().attribute("centerY", "0").toDouble();
-			center[2]= cylinders.item(i).toElement().attribute("centerZ", "0").toDouble();
+            center[0] = cylinders.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR;
+            center[1]= cylinders.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR;
+            center[2]= cylinders.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR;
 			double color= cylinders.item(i).toElement().attribute("color", "0").toDouble();
-			double radius= cylinders.item(i).toElement().attribute("radius", "0").toDouble();
-			double height= cylinders.item(i).toElement().attribute("height", "0").toDouble();
+            double radius= cylinders.item(i).toElement().attribute("radius", "0").toDouble()*FAKTOR;
+            double height= cylinders.item(i).toElement().attribute("height", "0").toDouble()*FAKTOR;
 			rotation[0] = cylinders.item(i).toElement().attribute("angleX", "90").toDouble();
 			rotation[1] = cylinders.item(i).toElement().attribute("angleY", "0").toDouble();
 			rotation[2] = cylinders.item(i).toElement().attribute("angleZ", "0").toDouble();
 			geometry->addObjectCylinder(center,radius,height,rotation,color);
 		}
 
-		//Tlabels
+        //Labels
         for (  int i = 0; i < labels.length(); i++) {
 
 			double center[3];
-			center[0] = labels.item(i).toElement().attribute("centerX", "0").toDouble();
-			center[1]= labels.item(i).toElement().attribute("centerY", "0").toDouble();
-			center[2]= labels.item(i).toElement().attribute("centerZ", "0").toDouble();
+            center[0] = labels.item(i).toElement().attribute("centerX", "0").toDouble()*FAKTOR;
+            center[1]= labels.item(i).toElement().attribute("centerY", "0").toDouble()*FAKTOR;
+            center[2]= labels.item(i).toElement().attribute("centerZ", "0").toDouble()*FAKTOR;
 			double color= labels.item(i).toElement().attribute("color", "0").toDouble();
 			string caption= labels.item(i).toElement().attribute("text", "").toStdString();
 			geometry->addObjectLabel(center,center,caption,color);
diff --git a/src/ThreadDataTransfert.cpp b/src/ThreadDataTransfert.cpp
index 55647ff..2a4251c 100644
--- a/src/ThreadDataTransfert.cpp
+++ b/src/ThreadDataTransfert.cpp
@@ -55,6 +55,7 @@
 
 #include "network/TraVisToServer.h"
 #include "geometry/FacilityGeometry.h"
+#include "general/Macros.h"
 #include "Debug.h"
 
 
@@ -169,8 +170,6 @@ void ThreadDataTransfer::slotProcessMessage(QString& data){
 		errNr++;
 		Debug::Error(">> %s",(const char *)errorMsg.toStdString().c_str());
 		Debug::Error(">> %s",(const char *)data.toStdString().c_str());
-		//Debug::Error(">> %d", errNr);
-		//Debug::Error(">> %s", (const char *)data.toStdString().c_str());
 		return;
 	}
 
@@ -267,40 +266,40 @@ void ThreadDataTransfer::parseDataNode(QDomNodeList frames){
 	//emit signal_CurrentAction("parsing data");
 
 
-	for (unsigned int i = 0; i < frames.length(); i++) {
+    for (int i = 0; i < frames.length(); i++) {
 		Frame *newFrame = new Frame();
 		QDomElement el = frames.item(i).toElement();
 		QDomNodeList agents = el.elementsByTagName("agent");
 		//cout << "found:  " << agents.length() <<" agents" <<endl;
-		for (unsigned int i = 0; i < agents.length(); i++) {
+        for (int i = 0; i < agents.length(); i++) {
 
 			bool ok=false;
 			int id=agents.item(i).toElement().attribute("ID").toInt(&ok);
 			if(!ok) continue; // invalid ID
-			double xPos=agents.item(i).toElement().attribute("xPos","0").toDouble();
-			double yPos=agents.item(i).toElement().attribute("yPos","0").toDouble();
-			double zPos=agents.item(i).toElement().attribute("zPos","0").toDouble();
+            double xPos=agents.item(i).toElement().attribute("xPos","0").toDouble()*FAKTOR;
+            double yPos=agents.item(i).toElement().attribute("yPos","0").toDouble()*FAKTOR;
+            double zPos=agents.item(i).toElement().attribute("zPos","0").toDouble()*FAKTOR;
 
 			double agent_color =std::numeric_limits<double>::quiet_NaN();
 
-			double xVel=agents.item(i).toElement().attribute("xVel").toDouble(&ok);
+            double xVel=agents.item(i).toElement().attribute("xVel").toDouble(&ok)*FAKTOR;
 			if(!ok)xVel=std::numeric_limits<double>::quiet_NaN();
-			double yVel=agents.item(i).toElement().attribute("yVel").toDouble(&ok);
+            double yVel=agents.item(i).toElement().attribute("yVel").toDouble(&ok)*FAKTOR;
 			if(!ok)yVel=std::numeric_limits<double>::quiet_NaN();
-			double zVel=agents.item(i).toElement().attribute("zVel").toDouble(&ok);
+            double zVel=agents.item(i).toElement().attribute("zVel").toDouble(&ok)*FAKTOR;
 			if(!ok)zVel=std::numeric_limits<double>::quiet_NaN();
 
 			//coordinates of the ellipse, default to the head of the agent
-			double el_x=agents.item(i).toElement().attribute("xEll").toDouble(&ok);
+            double el_x=agents.item(i).toElement().attribute("xEll").toDouble(&ok)*FAKTOR;
 			if(!ok)	el_x=xPos;
-			double el_y=agents.item(i).toElement().attribute("yEll").toDouble(&ok);
+            double el_y=agents.item(i).toElement().attribute("yEll").toDouble(&ok)*FAKTOR;
 			if(!ok)	el_y=yPos;
-			double el_z=agents.item(i).toElement().attribute("zEll").toDouble(&ok);
+            double el_z=agents.item(i).toElement().attribute("zEll").toDouble(&ok)*FAKTOR;
 			if(!ok)	el_z=zPos;
 
-			double dia_a=agents.item(i).toElement().attribute("radiusA").toDouble(&ok);
+            double dia_a=agents.item(i).toElement().attribute("radiusA").toDouble(&ok)*FAKTOR;
 			if(!ok)dia_a=std::numeric_limits<double>::quiet_NaN();
-			double dia_b=agents.item(i).toElement().attribute("radiusB").toDouble(&ok);
+            double dia_b=agents.item(i).toElement().attribute("radiusB").toDouble(&ok)*FAKTOR;
 			if(!ok)dia_b=std::numeric_limits<double>::quiet_NaN();
 			double el_angle=agents.item(i).toElement().attribute("ellipseOrientation").toDouble(&ok);
 			if(!ok){el_angle=std::numeric_limits<double>::quiet_NaN(); }
@@ -387,7 +386,7 @@ void ThreadDataTransfer::parseShapeNode(QDomNode shape){
 	QStringList colors;
 
 
-	for (unsigned int i = 0; i < agents.length(); i++) {
+    for (int i = 0; i < agents.length(); i++) {
 
 		bool ok=false;
 		int id=agents.item(i).toElement().attribute("ID").toInt(&ok);
-- 
GitLab