diff python/moving.py @ 329:a70c205ebdd9

added sqlite code, in particular to load and save road user type
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 13 Jun 2013 00:42:40 -0400
parents 42f2b46ec210
children 40790d93200e
line wrap: on
line diff
--- a/python/moving.py	Wed Jun 12 18:23:16 2013 -0400
+++ b/python/moving.py	Thu Jun 13 00:42:40 2013 -0400
@@ -128,7 +128,7 @@
     def empty(self):
         return self.timeInterval.empty() or not self.boudingPolygon
 
-    def getId(self):
+    def getNum(self):
         return self.num
 
     def getFirstInstant(self):
@@ -555,9 +555,11 @@
 # Moving Objects
 ##################
 
-userTypeNames = ['car',
+userTypeNames = ['unknown',
+                 'car',
                  'pedestrian',
-                 'twowheels',
+                 'motorcycle',
+                 'bicycle',
                  'bus',
                  'truck']
 
@@ -565,7 +567,7 @@
 
 class MovingObject(STObject):
     '''Class for moving objects: a spatio-temporal object 
-    with a trajectory and a geometry (constant volume over time) and a usertype (e.g. road user)
+    with a trajectory and a geometry (constant volume over time) and a usertype (e.g. road user) coded as a number (see 
     '''
 
     def __init__(self, num = None, timeInterval = None, positions = None, geometry = None, userType = None):
@@ -599,6 +601,12 @@
     def getVelocities(self):
         return self.velocities
 
+    def getUserType(self):
+        return self.userType
+
+    def setUserType(self, userType):
+        self.userType = userType
+
     def setFeatures(self, features):
         self.features = [features[i] for i in self.featureNumbers]