From c8bf946c888c5f4854a5fd863cc592279bf80de6 Mon Sep 17 00:00:00 2001
From: Ulrich Kemloh <kemlohulrich@gmail.com>
Date: Mon, 4 Aug 2014 18:54:57 +0200
Subject: [PATCH] mem leaks and locales issues under linux

---
 JPSvis.pro                    |  4 ++--
 JPSvisSettings.xml            | 34 ----------------------------------
 src/Frame.cpp                 |  4 ++--
 src/SaxParser.cpp             |  1 -
 src/ThreadVisualisation.cpp   | 22 +++++++++++++---------
 src/geometry/PointPlotter.cpp |  1 +
 6 files changed, 18 insertions(+), 48 deletions(-)
 delete mode 100644 JPSvisSettings.xml

diff --git a/JPSvis.pro b/JPSvis.pro
index b745105..6e1453b 100644
--- a/JPSvis.pro
+++ b/JPSvis.pro
@@ -385,7 +385,7 @@ unix_6 {
 }
    
 #dynamic linking with vtk5.10
-unix {
+unix_dyn {
 INCLUDEPATH += /usr/include/vtk-5.8
 LIBS += -L/usr/lib \
 #INCLUDEPATH +=/usr/local/include/vtk-5.10
@@ -418,7 +418,7 @@ LIBS += -L/usr/lib \
  }
  
 #Static compilation linux
-unix_static {
+unix {
 #INCLUDEPATH += /usr/include/vtk-5.8
 #LIBS += -L/usr/lib \
 INCLUDEPATH +=/usr/local/include/vtk-5.10
diff --git a/JPSvisSettings.xml b/JPSvisSettings.xml
deleted file mode 100644
index a33e5ba..0000000
--- a/JPSvisSettings.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE TraVisToProject SYSTEM "TraVisToProject.dtd">
-<TraVisToProject>
-	<visualisation_mode>
-		<mode>online</mode>
-		<server>localhost</server>
-		<port>14009</port>
-	</visualisation_mode>
-	<files>
-		<trajectories>
-		e:/workspace/TraVisTo/data/evacuationTime.dat
-		</trajectories>
-		<trajectories>
-		e:/workspace/TraVisTo/data/evacuationTime2.dat
-		</trajectories>
-		<geometry>
-		e:/workspace/TraVisTo/data/geometry.dat
-		</geometry>
-	</files>
-	<settings>
-		<mode>2D</mode>
-		<showAgent>true</showAgent>
-		<showGeometry>true</showGeometry>
-		<showLegend>true</showLegend>
-		<showCaption>true</showCaption>
-		<showAxis>true</showAxis>
-		<cameraView>top</cameraView>
-		<trails>
-			<type>polygones</type>
-			<points>100</points>
-		</trails>
-		
-	</settings>
-	
-</TraVisToProject>
diff --git a/src/Frame.cpp b/src/Frame.cpp
index dddd570..c62f613 100644
--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -63,8 +63,8 @@ Frame::~Frame()
     }
     _framePoints.clear();
 
-    _polydata2D->Delete();
-    _polydata3D->Delete();
+    //_polydata2D->Delete();
+    //_polydata3D->Delete();
 }
 
 int Frame::getSize()
diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp
index 78eaeff..d5f2c5d 100644
--- a/src/SaxParser.cpp
+++ b/src/SaxParser.cpp
@@ -1040,7 +1040,6 @@ QString SaxParser::extractGeometryFilename(QString &filename)
                     int endIndex = line.indexOf(end,startIndex);
                     if(endIndex <= 0)continue; // false alarm
                     extracted_geo_name= line.mid(startIndex,endIndex - startIndex);
-                    cout<<"geoName:"<<extracted_geo_name.toStdString()<<endl;
                     return extracted_geo_name;
                     //break;// we are done
                 }
diff --git a/src/ThreadVisualisation.cpp b/src/ThreadVisualisation.cpp
index f40ea41..7f7753a 100644
--- a/src/ThreadVisualisation.cpp
+++ b/src/ThreadVisualisation.cpp
@@ -141,7 +141,7 @@ void ThreadVisualisation::slotSetFrameRate(float fps){
 void ThreadVisualisation::run(){
 
     //deactivate the output windows
-    vtkObject::GlobalWarningDisplayOff();
+    //vtkObject::GlobalWarningDisplayOff();
 
 	//emit signalStatusMessage("running");
 
@@ -157,10 +157,9 @@ void ThreadVisualisation::run(){
 
 	//initialize the datasets
     //mem leak
-    extern_glyphs_pedestrians = vtkTensorGlyph::New();
-    extern_glyphs_pedestrians_3D = vtkTensorGlyph::New();
 
-	initGlyphs2D();
+
+    initGlyphs2D();
     initGlyphs3D();
 
     //create the trails
@@ -296,11 +295,11 @@ void ThreadVisualisation::run(){
     }
 
 
-//    if(true || SystemSettings::get2D()){
-//        renderer->GetActiveCamera()->OrthogonalizeViewUp();
-//        renderer->GetActiveCamera()->ParallelProjectionOn();
-//        renderer->ResetCamera();
-//    }
+    if(true || SystemSettings::get2D()){
+        renderer->GetActiveCamera()->OrthogonalizeViewUp();
+        renderer->GetActiveCamera()->ParallelProjectionOn();
+        renderer->ResetCamera();
+    }
 
 	//create a timer for rendering the window
 	TimerCallback *renderingTimer = new TimerCallback();
@@ -427,6 +426,8 @@ void ThreadVisualisation::showFloor(bool status)
 void  ThreadVisualisation::initGlyphs2D()
 {
 
+    extern_glyphs_pedestrians = vtkTensorGlyph::New();
+
     //glyphs with ellipsoids
     //    VTK_CREATE (vtkSphereSource, agentShape);
     //    agentShape->SetRadius(30);
@@ -499,6 +500,9 @@ void  ThreadVisualisation::initGlyphs2D()
 
 void ThreadVisualisation::initGlyphs3D()
 {
+
+    extern_glyphs_pedestrians_3D = vtkTensorGlyph::New();
+
     //now create the glyphs with zylinders
     VTK_CREATE (vtkCylinderSource, agentShape);
     agentShape->SetHeight(160);
diff --git a/src/geometry/PointPlotter.cpp b/src/geometry/PointPlotter.cpp
index e36aa27..d4c8c7b 100644
--- a/src/geometry/PointPlotter.cpp
+++ b/src/geometry/PointPlotter.cpp
@@ -73,6 +73,7 @@ PointPlotter::PointPlotter()
     mapper->SetInputConnection(glyph->GetOutputPort());
 
     //borrow the lookup table from the peds glyphs
+    if(extern_glyphs_pedestrians_actor_2D->GetMapper())
     mapper->SetLookupTable(
     extern_glyphs_pedestrians_actor_2D->GetMapper()->GetLookupTable());
 
-- 
GitLab