Skip to content

Commit

Permalink
keeping color information in edgesInDistricts. refs #3979
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Oct 18, 2018
1 parent c787c3f commit 13911be
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/tools/district/edgesInDistricts/input_districts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

<tazs>
<taz id="b" shape="-5.00,-5.00 5.00,-5.00 5.00,5.00 -5.00,5.00 -5.00,-5.00"/>
<taz id="e" shape="1995.00,-5.00 2005.00,-5.00 2005.00,5.00 1995.00,5.00 -1995.00,-5.00"/>
<taz id="e" shape="1995.00,-5.00 2005.00,-5.00 2005.00,5.00 1995.00,5.00 -1995.00,-5.00" color="blue"/>
</tazs>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated on 2018-03-09 09:35:26.058000 by $Id: $
<!-- generated on 2018-10-18 09:47:53.500988 by $Id$
options: -n input_net.net.xml -t input_districts.xml -o out.add.xml <doubleminus>weighted -s
-->
<tazs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/taz_file.xsd">
<taz id="b" shape="-5.0,-5.0 5.0,-5.0 5.0,5.0 -5.0,5.0 -5.0,-5.0">
<tazSource id="absBeg" weight="13859.69"/>
<tazSink id="absBeg" weight="13859.69"/>
</taz>
<taz id="e" shape="1995.0,-5.0 2005.0,-5.0 2005.0,5.0 1995.0,5.0 -1995.0,-5.0">
<taz id="e" shape="1995.0,-5.0 2005.0,-5.0 2005.0,5.0 1995.0,5.0 -1995.0,-5.0" color="blue">
<tazSource id="absBeg" weight="13859.69"/>
<tazSink id="absBeg" weight="13859.69"/>
<tazSource id="absEnd" weight="13900.00"/>
Expand Down
5 changes: 3 additions & 2 deletions tools/edgesInDistricts.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def writeResults(self, options):
else:
if options.weighted:
if options.shapeinfo:
fd.write(' <taz id="%s" shape="%s">\n' %
(district.id, district.getShapeString()))
color = ' color="%s"' % district.color if district.color is not None else ''
fd.write(' <taz id="%s" shape="%s"%s>\n' %
(district.id, district.getShapeString(), color))
else:
fd.write(' <taz id="%s">\n' % district.id)
for edge in filtered:
Expand Down
2 changes: 1 addition & 1 deletion tools/sumolib/shapes/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def startElement(self, name, attrs):
poly = Polygon(attrs['id'], attrs['type'], c, float(
attrs['layer']), attrs['fill'], cshape)
else:
poly = Polygon(attrs['id'], shape=cshape)
poly = Polygon(attrs['id'], color=attrs.get('color'), shape=cshape)
self._id2poly[poly.id] = poly
self._polys.append(poly)
self._lastPoly = poly
Expand Down

0 comments on commit 13911be

Please sign in to comment.