Mercurial Hosting > traffic-intelligence
changeset 21:3c4629550f5f
added basic getters for objects
author | Nicolas Saunier <nico@confins.net> |
---|---|
date | Mon, 30 Nov 2009 18:54:26 -0500 |
parents | ef0d7caf8e91 |
children | 169cd4679366 |
files | python/moving.py |
diffstat | 1 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/python/moving.py Sat Nov 28 01:56:46 2009 -0500 +++ b/python/moving.py Mon Nov 30 18:54:26 2009 -0500 @@ -106,14 +106,23 @@ from matplotlib.pylab import plot plot(self.positions[0], self.positions[1]) + def length(self): + return len(self.getXCoordinates()) + + def getXCoordinates(self): + return self.positions[0] + + def getYCoordinates(self): + return self.positions[1] + def xBounds(self): # look for function that does min and max in one pass - return [min(self.positions[0]), max(self.positions[0])] + return [min(self.getXCoordinates()), max(self.getXCoordinates())] def yBounds(self): # look for function that does min and max in one pass - return [min(self.positions[1]), max(self.positions[1])] - + return [min(self.getYCoordinates()), max(self.getYCoordinates())] + def norm(self): '''Returns the list of the norms at each instant''' # def add(x, y): return x+y @@ -139,9 +148,18 @@ self.type = type # compute bounding polygon from trajectory + def length(self): + return self.timeInterval.length() + + def getXCoordinates(self): + return self.positions.getXCoordinates() + + def getYCoordinates(self): + return self.positions.getYCoordinates() + def draw(self): self.positions.draw() - + # def computeVelocities(self): # need for a class representing the indicators, their units, how to print them in graphs...