view python/event.py @ 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
children f955e83da499
line wrap: on
line source

#! /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)