/usr/share/sumo/tools/sumolib/poi.py is in sumo-tools 0.15.0~dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | """
@file poi.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2010-02-18
@version $Id: poi.py 11671 2012-01-07 20:14:30Z behrisch $
Library for reading and storing POIs.
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2010-2012 DLR (http://www.dlr.de/) and contributors
All rights reserved
"""
from xml.sax import handler, parse
class PoI:
def __init__(self, id, type, layer, color, pos, lane):
self._id = id
self._type = type
self._layer = layer
self._color = color
self._pos = pos
self._lane = lane
class PoIReader(handler.ContentHandler):
def __init__(self):
self._id2poi = {}
self._pois = []
def startElement(self, name, attrs):
if name == 'poi':
if not attrs.has_key('lane'):
poi = PoI(attrs['id'], attrs['type'], int(attrs['layer']), attrs['color'], (float(attrs['x']), float(attrs['y'])), None)
else:
poi = PoI(attrs['id'], attrs['type'], int(attrs['layer']), attrs['color'], float(attrs['pos']), attrs['lane'])
self._id2poi[poi._id] = poi
self._pois.append(poi)
def readPois(filename):
pois = PoIReader()
parse(filename, pois)
return pois._pois
|