diff python/events.py @ 664:455f9b93819c

added capability to set a videofilename to movingobject and interaction, renames interactiontype to collision in interaction
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 20 May 2015 12:04:22 +0200
parents 72174e66aba5
children 15e244d2a1b5
line wrap: on
line diff
--- a/python/events.py	Tue May 19 16:58:26 2015 +0200
+++ b/python/events.py	Wed May 20 12:04:22 2015 +0200
@@ -9,6 +9,7 @@
 import itertools
 
 import moving, prediction, indicators, utils, cvutils
+from storage import VideoFilenameAddable
 __metaclass__ = type
 
 def findRoute(prototypes,objects,i,j,noiseEntryNums,noiseExitNums,minSimilarity= 0.3, spatialThreshold=1.0, delta=180):
@@ -41,7 +42,7 @@
             route= findRoute(prototypes,objects,route,obj.getNum(),noiseEntryNums,noiseExitNums)
     return route
 
-class Interaction(moving.STObject):
+class Interaction(moving.STObject, VideoFilenameAddable):
     '''Class for an interaction between two road users 
     or a road user and an obstacle
     
@@ -231,12 +232,15 @@
         # TODO add crossing zone
         self.pet = moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold)
 
-    def addVideoFilename(self,videoFilename):
-        self.videoFilename = videoFilename
+    def setCollision(self, collision):
+        '''indicates if it is a collision: argument should be boolean'''
+        self.collision = collision
 
-    def addInteractionType(self,interactionType):
-        ''' interaction types: conflict or collision if they are known'''
-        self.interactionType = interactionType
+    def isCollision(self):
+        if hasattr(self, 'collision'):
+            return self.collision
+        else:
+            return None
 
     def getCrossingZones(self, predictionMethodName):
         if self.crossingZones is not None: