Mercurial Hosting > traffic-intelligence
changeset 688:f2b52355a286 dev
made length a STObject method
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 26 Jun 2015 23:49:44 -0400 |
parents | de278c5e65f6 |
children | 9990ef119bce |
files | python/moving.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/python/moving.py Mon Jun 22 15:27:33 2015 +0200 +++ b/python/moving.py Fri Jun 26 23:49:44 2015 -0400 @@ -122,6 +122,9 @@ '''Returns the length of the interval''' return float(max(0,self.last-self.first+1)) + def __len__(self): + return self.length() + # class BoundingPolygon: # '''Class for a polygon bounding a set of points # with methods to create intersection, unions... @@ -141,11 +144,17 @@ self.boundingPolygon = boundingPolygon def empty(self): - return self.timeInterval.empty() or not self.boudingPolygon + return self.timeInterval.empty()# or not self.boudingPolygon def getNum(self): return self.num + def __len__(self): + return self.timeInterval.length() + + def length(self): + return self.timeInterval.length() + def getFirstInstant(self): return self.timeInterval.first @@ -1054,9 +1063,6 @@ print 'The object does not exist at '+str(inter) return None - def length(self): - return self.timeInterval.length() - def getPositions(self): return self.positions