From 6f67ac44362b62c44ec01fb637c1eb188d6d767d Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Fri, 7 Jun 2019 20:56:47 +0200
Subject: [PATCH] lable trains using type and id

---
 src/TimerCallback.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/TimerCallback.cpp b/src/TimerCallback.cpp
index fcbb6f2..8d0290b 100644
--- a/src/TimerCallback.cpp
+++ b/src/TimerCallback.cpp
@@ -37,7 +37,7 @@
 #include <algorithm>
 #include <cstdlib>
 #include <iostream>
-
+#include <stdio.h>
 
 #ifdef TRAVISTO_FFMPEG
 #ifdef _WIN32
@@ -175,11 +175,14 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
 
                     // }
                     int countTrains  = 0;
+                    char label[100];
+
                     for (auto tab: extern_trainTimeTables)
                         {
                              // VTK_CREATE(vtkTextActor, textActor);
                              VTK_CREATE(vtkTextActor3D, textActor);
                              auto trainType = tab.second->type;
+                             sprintf(label, "%s_%d", trainType.c_str(), tab.second->id);
                              auto trainId = tab.second->id;
                              auto trackStart = tab.second->pstart;
                              auto trackEnd = tab.second->pend;
@@ -211,11 +214,11 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId,
 
                                   // text
                                   txtActor->GetTextProperty()->SetOpacity(0.7);
-                                  double pos_x = 50*(trainStart._x + trainEnd._x);
-                                  double pos_y = 50*(trainStart._y + trainEnd._y);
+                                  double pos_x = 50*(trainStart._x + trainEnd._x+0.5);
+z                                  double pos_y = 50*(trainStart._y + trainEnd._y+0.5);
 
                                   txtActor->SetPosition (pos_x, pos_y+2, 20);
-                                  txtActor->SetInput (trainType.c_str());
+                                  txtActor->SetInput (label);
                                   txtActor->GetTextProperty()->SetFontSize (30);
                                   txtActor->GetTextProperty()->SetBold (true);
                                   txtActor->GetTextProperty()->SetColor (
-- 
GitLab