diff python/storage.py @ 524:1dced8932b08

corrected bugs
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 19 Jun 2014 13:31:00 -0400
parents 1ba618fb0f70
children 7124c7d2a663
line wrap: on
line diff
--- a/python/storage.py	Wed Jun 18 23:40:47 2014 -0400
+++ b/python/storage.py	Thu Jun 19 13:31:00 2014 -0400
@@ -419,13 +419,25 @@
             finally: self.sechead = None
         else: return self.fp.readline()
 
+def loadTrajectoriesFromVissimFile(filename, nObjects = -1, sequenceNum = -1):
+    '''Reads data from VISSIM .fzp trajectory file'''
+    objects = []
+
+    infile = openCheck(filename)
+    if not infile:
+        import sys
+        sys.exit()
+
+    
+    return objects
+    
 def loadTrajectoriesFromNgsimFile(filename, nObjects = -1, sequenceNum = -1):
     '''Reads data from the trajectory data provided by NGSIM project 
     and returns the list of Feature objects'''
     objects = []
 
-    input = openCheck(filename)
-    if not input:
+    infile = openCheck(filename)
+    if not infile:
         import sys
         sys.exit()
 
@@ -451,11 +463,11 @@
         obj.size = [float(numbers[8]), float(numbers[9])] # 8 lengh, 9 width # TODO: temporary, should use a geometry object
         return obj
 
-    numbers = input.readline().strip().split()
+    numbers = infile.readline().strip().split()
     if (len(numbers) > 0):
         obj = createObject(numbers)
 
-    for line in input:
+    for line in infile:
         numbers = line.strip().split()
         if obj.getNum() != int(numbers[0]):
             # check and adapt the length to deal with issues in NGSIM data
@@ -482,7 +494,7 @@
             if (obj.size[1] != float(numbers[9])):
                 print 'changed width obj %d' % (obj.getNum())
     
-    input.close()
+    infile.close()
     return objects
 
 def convertNgsimFile(inFile, outFile, append = False, nObjects = -1, sequenceNum = 0):