0

added support for ploylines and polygons on the google map

Polygons and polylines are read from the new file "regions.js". Polylines
(entries with "closed" set to false) are just lines drawn on the map.
Polygons (entries with "closed" set to true) are closed loops that are
filled in with a transparent color.
This commit is contained in:
Aaron Griffith
2010-10-09 15:44:48 -04:00
parent 05770468fb
commit a5ae703258
2 changed files with 56 additions and 3 deletions

View File

@@ -128,11 +128,20 @@ class QuadtreeGen(object):
with open(os.path.join(self.destdir, "index.html"), 'w') as output:
output.write(html)
# write out the default marker table
with open(os.path.join(self.destdir, "markers.js"), 'w') as output:
output.write("var markerData=%s" % json.dumps(self.world.POI))
# write out the default (empty, but documented) region table
with open(os.path.join(self.destdir, "regions.js"), 'w') as output:
output.write('var regionData=[\n');
output.write(' // {"color": "#FFAA00", "opacity": 0.5, "closed": true, "path": [\n')
output.write(' // {"x": 0, "y": 0, "z": 0},\n')
output.write(' // {"x": 0, "y": 10, "z": 0},\n')
output.write(' // {"x": 0, "y": 0, "z": 10}\n')
output.write(' // ]},\n')
output.write('];');
# Write a blank image
blank = Image.new("RGBA", (1,1))
tileDir = os.path.join(self.destdir, "tiles")