diff python/moving.py @ 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 40e1508380ed
children c75bcdaed00f
line wrap: on
line diff
--- 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