Mercurial Hosting > traffic-intelligence
changeset 56:61fe73df2d36
created new package, moved Interaction class and created Crossing class
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 27 Oct 2010 18:32:27 -0400 |
parents | 88d5ee5ac164 |
children | b8b3768f8d54 |
files | python/event.py python/moving.py |
diffstat | 2 files changed, 45 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/event.py Wed Oct 27 18:32:27 2010 -0400 @@ -0,0 +1,45 @@ +#! /usr/bin/env python +'''Libraries for events +Interactions, pedestrian crossing...''' + +#import utils; + +__metaclass__ = type + +class Interaction(STObject): + '''Class for an interaction between two road users + or a road user and an obstacle + + link to the moving objects + ''' + + def __init__(self, num = None, timeInterval = None, roaduserNum1 = None, roaduserNum2 = None, movingObject1 = None, movingObject2 = None): + STObject.__init__(self, num, timeInterval) + self.roaduserNum1 = roaduserNum1 + self.roaduserNum2 = roaduserNum2 + self.movingObject1 = movingObject1 + self.movingObject2 = movingObject2 + +class Crossing(STObject): + '''Class for the event of a street crossing + + TODO: detecter passage sur la chaussee + identifier origines et destination (ou uniquement chaussee dans FOV) + carac traversee + detecter proximite veh (retirer si trop similaire simultanement + carac interaction''' + + def __init__(self, roaduserNum = None, num = None, timeInterval = None): + self.roaduserNum = roaduserNum + self.num = num + self.timeInterval = timeInterval + + + +if __name__ == "__main__": + import doctest + import unittest + #suite = doctest.DocFileSuite('tests/moving.txt') + suite = doctest.DocTestSuite() + unittest.TextTestRunner().run(suite) +
--- a/python/moving.py Wed Oct 13 19:19:17 2010 -0400 +++ b/python/moving.py Wed Oct 27 18:32:27 2010 -0400 @@ -331,20 +331,6 @@ self.name = name self.values = values -class Interaction(STObject): - '''Class for an interaction between two road users - or a road user and an obstacle - - link to the moving objects - ''' - - def __init__(self, num = None, timeInterval = None, protagonistNum1 = None, protagonistNum2 = None, movingObject1 = None, movingObject2 = None): - STObject.__init__(self, num, timeInterval) - self.protagonistNum1 = protagonistNum1 - self.protagonistNum2 = protagonistNum2 - self.movingObject1 = movingObject1 - self.movingObject2 = movingObject2 - if __name__ == "__main__": import doctest import unittest