Mercurial > hg > nsaunier > traffic-intelligence
comparison python/traffic_engineering.py @ 116:2bf5b76320c0
moved intersection plotting and added markers for scatter plots
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 08 Aug 2011 14:47:30 -0400 |
| parents | f234154207d4 |
| children | c91c8fd8bf1e |
comparison
equal
deleted
inserted
replaced
| 115:550556378466 | 116:2bf5b76320c0 |
|---|---|
| 63 def capacity(self): | 63 def capacity(self): |
| 64 self.qmax = self.kc*self.vc | 64 self.qmax = self.kc*self.vc |
| 65 return self.qmax | 65 return self.qmax |
| 66 | 66 |
| 67 ######################### | 67 ######################### |
| 68 # intersection | |
| 69 ######################### | |
| 70 | |
| 71 class FourWayIntersection: | |
| 72 '''Simple class for simple intersection outline''' | |
| 73 def __init__(self, dimension, coordX, coordY): | |
| 74 self.dimension = dimension | |
| 75 self.coordX = coordX | |
| 76 self.coordY = coordY | |
| 77 | |
| 78 def plot(self, options = 'k'): | |
| 79 from matplotlib.pyplot import plot, axis | |
| 80 | |
| 81 minX = min(self.dimension[0]) | |
| 82 maxX = max(self.dimension[0]) | |
| 83 minY = min(self.dimension[1]) | |
| 84 maxY = max(self.dimension[1]) | |
| 85 | |
| 86 plot([minX, self.coordX[0], self.coordX[0]], [self.coordY[0], self.coordY[0], minY],options) | |
| 87 plot([self.coordX[1], self.coordX[1], maxX], [minY, self.coordY[0], self.coordY[0]],options) | |
| 88 plot([minX, self.coordX[0], self.coordX[0]], [self.coordY[1], self.coordY[1], maxY],options) | |
| 89 plot([self.coordX[1], self.coordX[1], maxX], [maxY, self.coordY[1], self.coordY[1]],options) | |
| 90 axis('equal') | |
| 91 | |
| 92 ######################### | |
| 68 # traffic signals | 93 # traffic signals |
| 69 ######################### | 94 ######################### |
| 70 | 95 |
| 71 class Volume: | 96 class Volume: |
| 72 '''Class to represent volumes with varied vehicule types ''' | 97 '''Class to represent volumes with varied vehicule types ''' |
