Mercurial Hosting > traffic-intelligence
changeset 62:290fceb125d2
moved road user types and added plotting for all road users
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 04 Nov 2010 17:40:07 -0400 |
parents | a8c6d544f015 |
children | 40e8e3bb3702 |
files | python/moving.py python/ubc_utils.py |
diffstat | 2 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
diff -r a8c6d544f015 -r 290fceb125d2 python/moving.py --- a/python/moving.py Wed Nov 03 22:51:38 2010 -0400 +++ b/python/moving.py Thu Nov 04 17:40:07 2010 -0400 @@ -247,6 +247,16 @@ # use shapely polygon contains pass +################## +# Moving Objects +################## + +userTypeNames = ['car', + 'pedestrian', + 'twowheels', + 'bus' + 'truck'] + class MovingObject(STObject): '''Class for moving objects i.e. with a trajectory and a geometry (volume) (constant) @@ -320,6 +330,15 @@ # def computeVelocities(self): +def plotRoadUsers(objects, colors): + '''Colors is a PlottingPropertyValues instance''' + from matplotlib.pyplot import figure, axis + figure() + for obj in objects: + obj.draw(colors.get(obj.userType)) + axis('equal') + + # need for a class representing the indicators, their units, how to print them in graphs... class TemporalIndicator: '''Class for temporal indicators
diff -r a8c6d544f015 -r 290fceb125d2 python/ubc_utils.py --- a/python/ubc_utils.py Wed Nov 03 22:51:38 2010 -0400 +++ b/python/ubc_utils.py Thu Nov 04 17:40:07 2010 -0400 @@ -6,12 +6,6 @@ __metaclass__ = type -userTypeNames = ['car', - 'pedestrian', - 'twowheels', - 'bus' - 'truck'] - fileTypeNames = ['feature', 'object', 'prototype',