Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 880:000555430b28
adapted code from Paul St-Aubin and udpated MovingObject.setFeatures to truly find the right features in a list that may not start at 0
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 14 Mar 2017 17:10:35 -0400 |
parents | d1ff6917d082 |
children | 8ba82b371eea |
comparison
equal
deleted
inserted
replaced
879:f9ea5083588e | 880:000555430b28 |
---|---|
1240 print('Object {} has no curvilinear positions'.format(self.getNum())) | 1240 print('Object {} has no curvilinear positions'.format(self.getNum())) |
1241 | 1241 |
1242 def setUserType(self, userType): | 1242 def setUserType(self, userType): |
1243 self.userType = userType | 1243 self.userType = userType |
1244 | 1244 |
1245 def setFeatures(self, features): | 1245 def setFeatures(self, features, featuresOrdered = False): |
1246 self.features = [features[i] for i in self.featureNumbers] | 1246 '''Sets the features in the features field based on featureNumbers |
1247 if not all features are loaded from 0, one needs to renumber in a dict''' | |
1248 if featuresOrdered: | |
1249 tmp = features | |
1250 else: | |
1251 tmp = {f.getNum():f for f in features} | |
1252 self.features = [tmp[i] for i in self.featureNumbers] | |
1247 | 1253 |
1248 def getFeatures(self): | 1254 def getFeatures(self): |
1249 return self.features | 1255 return self.features |
1250 | 1256 |
1251 def hasFeatures(self): | 1257 def hasFeatures(self): |