Fixed errors created by my last commit# 18480.

svn: r18484
This commit is contained in:
Rob G. Healey 2011-11-22 11:18:07 +00:00
parent 7b2ea14225
commit a52ab113f7
2 changed files with 85 additions and 43 deletions

View File

@ -4874,22 +4874,27 @@ class IndividualPage(BasePage):
# create the array, if there are more than one set of coordinates to be displayed?
if number_markers > 1:
tracelife = """
if self.googleopts == "FamilyLinks":
tracelife = """
var tracelife = ["""
titleArray = """
# place titles Array for place maps...
titleArray = """
var titleArray = ["""
for index in xrange(0, (number_markers - 1)):
dataline = place_lat_long[index]
latitude, longitude, placetitle = dateline[0], dataline[1], dataline[2]
tracelife += """ new google.maps.LatLng(%s, %s),""" % (latitude, longitude)
titleArray += """ ['%s'],""" % placetitle
for index in xrange(0, (number_markers - 1)):
dataline = place_lat_long[index]
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
tracelife += """
new google.maps.LatLng(%s, %s),""" % (latitude, longitude)
titleArray += """'%s',""" % placetitle
dataline = place_lat_long[-1]
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
tracelife += """ new google.maps.LatLng(%s, %s) ];""" % (latitude, longitude)
titleArray += """ ['%s'] ];""" % placetitle
dataline = place_lat_long[-1]
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
tracelife += """
new google.maps.LatLng(%s, %s) ];""" % (latitude, longitude)
titleArray += """
'%s' ];""" % placetitle
of = self.report.create_file(person.get_handle(), "maps")
self.up = True
@ -4914,18 +4919,19 @@ class IndividualPage(BasePage):
src ="http://www.openlayers.org/api/OpenLayers.js", inline =True)
# begin inline javascript code
# because jsc is a string, it does NOT have to properly indented
# because jsc is a docstring, it does NOT have to properly indented
with Html("script", type ="text/javascript", indent =False) as jsc:
# Google Maps add their javascript inside of the head element...
if self.mapservice == "Google":
head += jsc
# if the number of places is only 1, then use code from imported javascript?
if number_markers == 1:
data = place_lat_long[0]
jsc += google_jsc % (data[0], data[1])
dataline = place_lat_long[0]
latitude, longitude = dataline[0], dataline[1]
jsc += google_jsc % (latitude, longitude)
# Google Maps add their javascript inside of the head element...
else:
if self.googleopts == "FamilyLinks":
jsc += """
@ -4941,64 +4947,89 @@ class IndividualPage(BasePage):
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var flightPath = new google.maps.Polyline({
path: lifeHistory,
path: %s,
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
}""" % (latitude, longitude)
}""" % (midX_, midY_, zoomlevel, lifetrace)
# Google Maps Markers only...
elif self.googleopts == "Markers":
if (not midX_ and not midY_):
midX_, midY_ = conv_lat_lon(place_lat_long[0][0], place_lat_long[0][1], "D.D8")
jsc += """
//<![CDATA[
var centre = new google.maps.LatLng(%s, %s);
var gpsCoords = [""" % (midX_, midY_)
var centre = new google.maps.LatLng(%s, %s);""" % (midX_, midY_)
jsc += """
var myCoordinates = ["""
for index in xrange(0, (number_markers - 1)):
latitude, longitude = place_lat_long[index][0], place_lat_long[index][1]
jsc += """ new google.maps.LatLng(%s, %s),""" % (latitude, longitude)
latitude, longitude = place_lat_long[-1][0], place_lat_long[-1][1]
dataline = place_lat_long[index]
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
jsc += """ new google.maps.LatLng(%s, %s),""" % (latitude, longitude)
dataline = place_lat_long[-1]
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
jsc += """ new google.maps.LatLng(%s, %s)
];
var markers = [];
];""" % (latitude, longitude)
jsc += """
var markers = [];
var iterator = 0;
var map;
var map;
function initialize() {
var mapOptions = {
zoom: %d,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: centre
scrollwheel: false,
scaleControl: false,
backgroundColor: '#FFFFFF',
zoom: %d,
center: centre,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
}
function drop() {
for (var i = 0; i < gpsCoords.length; i++) {
function drop() {
for (var i = 0; i < myCoordinates.length; i++) {
setTimeout(function() {
addMarker();
addMarkers();
}, i * 1000);
}
}
function addMarker() {
function addMarkers() {
markers.push(new google.maps.Marker({
position: gpsCoords[iterator],
position: myCoordinates[iterator],
map: map,
draggable: true,
animation: google.maps.Animation.DROP
}));
iterator++;
}
//]]>""" % (latitude, longitude, zoomlevel)
//]]>""" % zoomlevel
# there is no need to add an ending "</script>",
# as it will be added automatically by libhtml()!
dont = """
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
function setMarkers(map, locations) {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < locations.length; i++) {
var coordinates = locations[i];
var myLatLng = new google.maps.LatLng(coordinates[1], coordinates[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: coordinates[0]
});
bounds.extend(locations[i]);
map.fitBounds(bounds);
}"""
with Html("div", class_ ="content", id ="FamilyMapDetail") as mapbackground:
body += mapbackground

View File

@ -21,15 +21,26 @@
# $Id$
#
###################################################### */
body#FamilyMap {
background-color: #000;
margin-left: 7px;
margin-right: 7px;
width: 965px;
}
div#map_canvas {
margin: 0 auto;
padding: 0px 0px 10px 10px;
border: solid 4px #000;
width: 965px;
height: 800px;
margin-left: 10px;
margin-right: 10px;
border: solid 4px #000;
width: 931px;
height: 800px;
}
button#drop {
padding: 10px;
border: solid 1px #000;
background-color: purple;
color: #FFF;
font: bold .8em sans-serif;
padding: 10px;
margin-top: 0px;
margin-bottom: 10px;
margin-left: 10px;
border: solid 2px green;
}