Mercurial Hosting > traffic-intelligence
diff python/ubc_utils.py @ 42:1a2ac2d4f53a
added loading of the rest of the data for objects
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 01 Jul 2010 10:44:32 -0400 |
parents | 28e546861263 |
children | 6d11d9e7ad4e |
line wrap: on
line diff
--- a/python/ubc_utils.py Fri May 28 20:25:45 2010 -0400 +++ b/python/ubc_utils.py Thu Jul 01 10:44:32 2010 -0400 @@ -26,16 +26,27 @@ objects = [] objNum = 0 + isObjectFile = filename.endswith('objects.txt'); lines = getLines(file) while (lines != []) and ((nObjects<0) or (objNum<nObjects)): l = lines[0].split(' ') parsedLine = [int(n) for n in l[:4]] obj = MovingObject(num = objNum, timeInterval = TimeInterval(parsedLine[1],parsedLine[2])) - add = True - if (len(lines) >= 3): + #add = True + if len(lines) >= 3: obj.positions = Trajectory(lines[1], lines[2]) - if (len(lines) >= 5): + if len(lines) >= 5: obj.velocities = Trajectory(lines[3], lines[4]) + if (isObjectFile): + obj.userType = parsedLine[3] + obj.nObjects = float(l[4]) + obj.featureNumbers = [int(n) for n in l[5:]] + + # load contour data if available + if len(lines) >= 6: + obj.contourType = utils.line2Floats(lines[6]) + obj.contourOrigins = Trajectory(lines[7], lines[8]) + obj.contourSizes = Trajectory(lines[9], lines[10]) if len(lines) != 2: objects.append(obj)