Attempt at getting zoomlevel correct in displaying a larger map section based on Family Map.
svn: r17992
This commit is contained in:
parent
eaec14898b
commit
4027c75d52
@ -4048,6 +4048,23 @@ class IndividualPage(BasePage):
|
|||||||
spanx = int(maxx - minx)
|
spanx = int(maxx - minx)
|
||||||
spany = int(maxy - miny)
|
spany = int(maxy - miny)
|
||||||
|
|
||||||
|
# set zoom level based on span of Longitude?
|
||||||
|
tinyset = [value for value in (-3, -2, -1, 0, 1, 2, 3)]
|
||||||
|
smallset = [value for value in (-4, -5, -6, -7, 4, 5, 6, 7)]
|
||||||
|
middleset = [value for value in (-8, -9, -10, -11, 8, 9, 10, 11)]
|
||||||
|
largeset = [value for value in (-11, -12, -13, -14, -15, -16, -17, 11, 12, 13, 14, 15, 16, 17)]
|
||||||
|
|
||||||
|
if spany in tinyset:
|
||||||
|
zoomlevel = 13
|
||||||
|
elif spany in smallset:
|
||||||
|
zoomlevel = 6
|
||||||
|
elif spany in middleset:
|
||||||
|
zoomlevel = 5
|
||||||
|
elif spany in largeset:
|
||||||
|
zoomlevel = 4
|
||||||
|
else:
|
||||||
|
zoomlevel = 3
|
||||||
|
|
||||||
# sort place_lat_long based on latitude and longitude order...
|
# sort place_lat_long based on latitude and longitude order...
|
||||||
place_lat_long.sort()
|
place_lat_long.sort()
|
||||||
|
|
||||||
@ -4069,7 +4086,8 @@ class IndividualPage(BasePage):
|
|||||||
if self.mapservice == "Google":
|
if self.mapservice == "Google":
|
||||||
head += Html("script", type ="text/javascript",
|
head += Html("script", type ="text/javascript",
|
||||||
src ="http://maps.googleapis.com/maps/api/js?sensor=false", inline =True)
|
src ="http://maps.googleapis.com/maps/api/js?sensor=false", inline =True)
|
||||||
elif self.mapservice == "OpenStreetMap":
|
|
||||||
|
else:
|
||||||
head += Html("script", type ="text/javascript",
|
head += Html("script", type ="text/javascript",
|
||||||
src ="http://www.openlayers.org/api/OpenLayers.js", inline =True)
|
src ="http://www.openlayers.org/api/OpenLayers.js", inline =True)
|
||||||
|
|
||||||
@ -4140,7 +4158,7 @@ class IndividualPage(BasePage):
|
|||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
||||||
var mapOptions = {
|
var mapOptions = {
|
||||||
zoom: 4,
|
zoom: %d,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
center: centre
|
center: centre
|
||||||
}
|
}
|
||||||
@ -4165,7 +4183,7 @@ class IndividualPage(BasePage):
|
|||||||
animation: google.maps.Animation.DROP
|
animation: google.maps.Animation.DROP
|
||||||
}));
|
}));
|
||||||
iterator++;
|
iterator++;
|
||||||
}""" % ( data[0], data[1] )
|
}""" % (data[0], data[1], zoomlevel)
|
||||||
# there is no need to add an ending "</script>",
|
# there is no need to add an ending "</script>",
|
||||||
# as it will be added automatically by libhtml()!
|
# as it will be added automatically by libhtml()!
|
||||||
|
|
||||||
@ -4186,7 +4204,7 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
if self.mapservice == "OpenStreetMap":
|
if self.mapservice == "OpenStreetMap":
|
||||||
with Html("script", type ="text/javascript") as jsc:
|
with Html("script", type ="text/javascript") as jsc:
|
||||||
canvas += jsc
|
mapbackground += jsc
|
||||||
|
|
||||||
if number_markers == 1:
|
if number_markers == 1:
|
||||||
data = place_lat_long[0]
|
data = place_lat_long[0]
|
||||||
@ -4202,10 +4220,11 @@ class IndividualPage(BasePage):
|
|||||||
projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator)
|
projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator)
|
||||||
|
|
||||||
var centre = new OpenLayers.LonLat( %s, %s ).transform(epsg4326, projectTo);
|
var centre = new OpenLayers.LonLat( %s, %s ).transform(epsg4326, projectTo);
|
||||||
var zoom = 4;
|
var zoom = %d;
|
||||||
map.setCenter(centre, zoom);
|
map.setCenter(centre, zoom);
|
||||||
|
|
||||||
var vectorLayer = new OpenLayers.Layer.Vector("Overlay");""" % ( Utils.xml_lang()[3:5].lower(), midY_, midX_ )
|
var vectorLayer = new OpenLayers.Layer.Vector("Overlay");""" % (Utils.xml_lang()[3:5].lower(),
|
||||||
|
midY_, midX_, zoomlevel)
|
||||||
for (latitude, longitude, pname, h, d) in place_lat_long:
|
for (latitude, longitude, pname, h, d) in place_lat_long:
|
||||||
jsc += """
|
jsc += """
|
||||||
var feature = new OpenLayers.Feature.Vector(
|
var feature = new OpenLayers.Feature.Vector(
|
||||||
|
Loading…
Reference in New Issue
Block a user