Skip to content

Commit

Permalink
updated generate map code for cables, markers and lines
Browse files Browse the repository at this point in the history
  • Loading branch information
alonswartz committed Dec 27, 2011
1 parent f09191d commit 14116d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions generate.py
Expand Up @@ -91,8 +91,8 @@ def write_index(self, tag, filepath):


fd.close() fd.close()


def write_map(self, template, output): def write_map(self, template, cables, output):
"""generate map from template""" """generate map from template (cables, markers, lines)"""
t = Template(file(template).read()) t = Template(file(template).read())


# markers # markers
Expand All @@ -114,7 +114,9 @@ def write_map(self, template, output):
r = self.regions[e.region] r = self.regions[e.region]
lines.append(line.substitute(num=n, e_ll=e.latlon, r_ll=r.latlon)) lines.append(line.substitute(num=n, e_ll=e.latlon, r_ll=r.latlon))


html = t.substitute(MARKERS="\n".join(markers), LINES="\n".join(lines) ) html = t.substitute( CABLES=file(cables).read(),
MARKERS="\n".join(markers),
LINES="\n".join(lines) )


fd = open(output, 'w') fd = open(output, 'w')
fd.write(html) fd.write(html)
Expand Down Expand Up @@ -143,7 +145,7 @@ def main():


entries.write_index("usa", "output/usa.index") entries.write_index("usa", "output/usa.index")
entries.write_index("countries", "output/countries.index") entries.write_index("countries", "output/countries.index")
entries.write_map("input/map.html.tmpl", "output/map.html") entries.write_map("input/map.html.tmpl", "input/cables", "output/map.html")




if __name__ == "__main__": if __name__ == "__main__":
Expand Down
4 changes: 3 additions & 1 deletion input/map.html.tmpl
Expand Up @@ -257,7 +257,9 @@ function initialize() {
mapTypeId: google.maps.MapTypeId.TERRAIN }; mapTypeId: google.maps.MapTypeId.TERRAIN };
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);


// MAPPING DATA GOES HERE ${CABLES}
${MARKERS}
${LINES}


for (var l=0;l<landings.length;l++) { for (var l=0;l<landings.length;l++) {
var land = landings[l]; var land = landings[l];
Expand Down

0 comments on commit 14116d6

Please sign in to comment.