# HG changeset patch # User Nicolas Saunier # Date 1435376984 14400 # Node ID f2b52355a286041d4bf06bd338cffb93f138bef2 # Parent de278c5e65f63616345c95f0ba38492505535b86 made length a STObject method diff -r de278c5e65f6 -r f2b52355a286 python/moving.py --- 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