Added boundary limits for the Google Family Markers Map pages.
svn: r18524
This commit is contained in:
parent
c8367703f5
commit
aa60900487
@ -650,21 +650,37 @@ class BasePage(object):
|
|||||||
@param: event -- event object from database
|
@param: event -- event object from database
|
||||||
@param: place_lat_long -- for use in Family Map Pages
|
@param: place_lat_long -- for use in Family Map Pages
|
||||||
"""
|
"""
|
||||||
|
place_handle = place.get_handle()
|
||||||
placetitle = place.get_title()
|
placetitle = place.get_title()
|
||||||
latitude = place.get_latitude()
|
latitude = place.get_latitude()
|
||||||
longitude = place.get_longitude()
|
longitude = place.get_longitude()
|
||||||
|
|
||||||
if (latitude and longitude):
|
if (latitude and longitude):
|
||||||
found = any(data[3] == place.get_handle() for data in place_lat_long)
|
found = any(data[3] == place_handle for data in place_lat_long)
|
||||||
if not found:
|
if not found:
|
||||||
|
|
||||||
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
|
latitude, longitude = conv_lat_lon(latitude, longitude, "D.D8")
|
||||||
|
|
||||||
# 0 = latitude, 1 = longitude, 2 = place title,
|
# 0 = latitude, 1 = longitude, 2 = place title,
|
||||||
# 3 = place handle, 4 = event date...
|
# 3 = place handle, 4 = event date, 5 = Marker color
|
||||||
|
# red = birth, blue = death, purple = census
|
||||||
if latitude is not None:
|
if latitude is not None:
|
||||||
place_lat_long.append( [latitude, longitude, placetitle,
|
|
||||||
place.get_handle(), event.get_date_object()] )
|
# get event type for color marker chooser...
|
||||||
|
etype = event.get_type()
|
||||||
|
if etype in [gen.lib.EventType.BIRTH, gen.lib.EventType.BAPTISM,
|
||||||
|
gen.lib.EventType.ADULT_CHRISTEN, gen.lib.EventType.CHRISTEN]:
|
||||||
|
marker = "Red"
|
||||||
|
elif etype in [gen.lib.EventType.DEATH, gen.lib.EventType.BURIAL]:
|
||||||
|
marker = "Blue"
|
||||||
|
elif etype == gen.lib.EventType.CENSUS:
|
||||||
|
marker = "Purple"
|
||||||
|
else:
|
||||||
|
marker = None
|
||||||
|
|
||||||
|
if marker is not None:
|
||||||
|
place_lat_long.append([latitude, longitude, placetitle,
|
||||||
|
place.get_handle(), event.get_date_object(), marker])
|
||||||
|
|
||||||
def _get_event_place(self, person, ppl_handle_list, place_lat_long):
|
def _get_event_place(self, person, ppl_handle_list, place_lat_long):
|
||||||
"""
|
"""
|
||||||
@ -1859,10 +1875,7 @@ class BasePage(object):
|
|||||||
"""
|
"""
|
||||||
creates a link to the family map
|
creates a link to the family map
|
||||||
"""
|
"""
|
||||||
|
return Html("a", _("Family Map"), href = url, title =_("Family Map"), class_ ="familymap", inline =True)
|
||||||
# return hyperlink to its caller
|
|
||||||
return Html("a", _("Family Map"), href = url, title = _("Family Map"),
|
|
||||||
class_ = "familymap", inline = True)
|
|
||||||
|
|
||||||
def display_relationships(self, ppl_handle_list, place_lat_long):
|
def display_relationships(self, ppl_handle_list, place_lat_long):
|
||||||
"""
|
"""
|
||||||
@ -3215,21 +3228,19 @@ class PlacePage(BasePage):
|
|||||||
placedetail += Html("h4", _("Place Map"), inline =True)
|
placedetail += Html("h4", _("Place Map"), inline =True)
|
||||||
|
|
||||||
# begin map_canvas division
|
# begin map_canvas division
|
||||||
with Html("div", id ="map_canvas") as canvas:
|
with Html("div", id ="place_canvas") as canvas:
|
||||||
placedetail += canvas
|
placedetail += canvas
|
||||||
|
|
||||||
# begin inline javascript code
|
# begin inline javascript code
|
||||||
# because jsc is a docstring, it does NOT have to be properly indented
|
# because jsc is a docstring, it does NOT have to be properly indented
|
||||||
with Html("script", type = "text/javascript") as jsc:
|
with Html("script", type = "text/javascript") as jsc:
|
||||||
|
head += jsc
|
||||||
|
|
||||||
if self.mapservice == "Google":
|
if self.mapservice == "Google":
|
||||||
head += jsc
|
|
||||||
jsc += google_jsc % (latitude, longitude)
|
jsc += google_jsc % (latitude, longitude)
|
||||||
else:
|
else:
|
||||||
# do not need to write on head, load into canvas
|
# do not need to write on head, load into canvas
|
||||||
jsc += openstreet_jsc % (Utils.xml_lang()[3:5].lower(),
|
jsc += openstreet_jsc % (Utils.xml_lang()[3:5].lower(), longitude, latitude)
|
||||||
longitude, latitude)
|
|
||||||
canvas += jsc
|
|
||||||
# there is no need to add an ending "</script>",
|
# there is no need to add an ending "</script>",
|
||||||
# as it will be added automatically!
|
# as it will be added automatically!
|
||||||
|
|
||||||
@ -3798,13 +3809,12 @@ class MediaPage(BasePage):
|
|||||||
self.XHTMLWriter(mediapage, of)
|
self.XHTMLWriter(mediapage, of)
|
||||||
|
|
||||||
def media_nav_link(self, handle, name, up = False):
|
def media_nav_link(self, handle, name, up = False):
|
||||||
|
"""
|
||||||
|
Creates the Media Page Navigation hyperlinks for Next and Prev
|
||||||
|
"""
|
||||||
url = self.report.build_url_fname_html(handle, "img", up)
|
url = self.report.build_url_fname_html(handle, "img", up)
|
||||||
img_name = html_escape(name)
|
name = html_escape(name)
|
||||||
hyper = Html("a", img_name, name = img_name, id = img_name, href = url, title = img_name, inline = True)
|
return Html("a", name, name =name, id =name, href =url, title =name, inline =True)
|
||||||
|
|
||||||
# return hyperlink to its callers
|
|
||||||
return hyper
|
|
||||||
|
|
||||||
def display_media_sources(self, photo):
|
def display_media_sources(self, photo):
|
||||||
|
|
||||||
@ -4696,12 +4706,16 @@ class IndividualPage(BasePage):
|
|||||||
self.place_list = place_list
|
self.place_list = place_list
|
||||||
self.sort_name = self.get_name(person)
|
self.sort_name = self.get_name(person)
|
||||||
self.name = self.get_name(person)
|
self.name = self.get_name(person)
|
||||||
|
|
||||||
|
self.familymappages = self.report.options['familymappages']
|
||||||
|
self.placemappages = self.report.options['placemappages']
|
||||||
|
self.mapservice = self.report.options['mapservice']
|
||||||
|
self.googleopts = self.report.options['googleopts']
|
||||||
db = report.database
|
db = report.database
|
||||||
|
|
||||||
of = self.report.create_file(person.get_handle(), "ppl")
|
of = self.report.create_file(person.get_handle(), "ppl")
|
||||||
self.up = True
|
self.up = True
|
||||||
indivdetpage, head, body = self.write_header(self.sort_name)
|
indivdetpage, head, body = self.write_header(self.sort_name)
|
||||||
self.familymappages = self.report.options['familymappages']
|
|
||||||
|
|
||||||
# attach the ancestortree style sheet if ancestor graph is being created?
|
# attach the ancestortree style sheet if ancestor graph is being created?
|
||||||
if self.report.options["ancestortree"]:
|
if self.report.options["ancestortree"]:
|
||||||
@ -4829,10 +4843,6 @@ class IndividualPage(BasePage):
|
|||||||
if not place_lat_long:
|
if not place_lat_long:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.familymappages = self.report.options['familymappages']
|
|
||||||
self.mapservice = self.report.options['mapservice']
|
|
||||||
self.googleopts = self.report.options['googleopts']
|
|
||||||
|
|
||||||
minx, maxx = Decimal("0.00000001"), Decimal("0.00000001")
|
minx, maxx = Decimal("0.00000001"), Decimal("0.00000001")
|
||||||
miny, maxy = Decimal("0.00000001"), Decimal("0.00000001")
|
miny, maxy = Decimal("0.00000001"), Decimal("0.00000001")
|
||||||
xwidth, yheight = [], []
|
xwidth, yheight = [], []
|
||||||
@ -4840,7 +4850,7 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
number_markers = len(place_lat_long)
|
number_markers = len(place_lat_long)
|
||||||
if number_markers > 1:
|
if number_markers > 1:
|
||||||
for (lat, long, p, h, d) in place_lat_long:
|
for (lat, long, p, h, d, marker) in place_lat_long:
|
||||||
xwidth.append(lat)
|
xwidth.append(lat)
|
||||||
yheight.append(long)
|
yheight.append(long)
|
||||||
xwidth.sort()
|
xwidth.sort()
|
||||||
@ -4947,15 +4957,15 @@ class IndividualPage(BasePage):
|
|||||||
var myLatLng = new google.maps.LatLng(%s, %s);
|
var myLatLng = new google.maps.LatLng(%s, %s);
|
||||||
|
|
||||||
var myOptions = {
|
var myOptions = {
|
||||||
zoom: %d,
|
zoom: %d,
|
||||||
center: myLatLng,
|
center: myLatLng,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
};
|
};
|
||||||
|
|
||||||
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
||||||
|
|
||||||
var flightPath = new google.maps.Polyline({
|
var flightPath = new google.maps.Polyline({
|
||||||
path: %s,
|
path: %s,
|
||||||
strokeColor: "#FF0000",
|
strokeColor: "#FF0000",
|
||||||
strokeOpacity: 1.0,
|
strokeOpacity: 1.0,
|
||||||
strokeWeight: 2
|
strokeWeight: 2
|
||||||
@ -4972,21 +4982,20 @@ class IndividualPage(BasePage):
|
|||||||
jsc += """
|
jsc += """
|
||||||
var centre = new google.maps.LatLng(%s, %s);""" % (midX_, midY_)
|
var centre = new google.maps.LatLng(%s, %s);""" % (midX_, midY_)
|
||||||
jsc += """
|
jsc += """
|
||||||
var myCoordinates = ["""
|
var myCoordinates = ["""
|
||||||
for index in xrange(0, (number_markers - 1)):
|
for index in xrange(0, (number_markers - 1)):
|
||||||
dataline = place_lat_long[index]
|
data = place_lat_long[index]
|
||||||
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
|
latitude, longitude, placetitle, marker = data[0], data[1], data[2], data[5]
|
||||||
jsc += """ new google.maps.LatLng(%s, %s),""" % (latitude, longitude)
|
jsc += """ [%s, %s, '%s', '%s', %d],""" % (latitude, longitude, placetitle, marker, index)
|
||||||
|
|
||||||
dataline = place_lat_long[-1]
|
data = place_lat_long[-1]
|
||||||
latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2]
|
latitude, longitude, placetitle, marker = data[0], data[1], data[2], data[5]
|
||||||
jsc += """ new google.maps.LatLng(%s, %s)
|
jsc += """ [%s, %s, '%s', '%s', %d]
|
||||||
];""" % (latitude, longitude)
|
];""" % (latitude, longitude, placetitle, marker, index+1)
|
||||||
jsc += """
|
jsc += """
|
||||||
var markers = [];
|
var bounds;
|
||||||
var iterator = 0;
|
|
||||||
var map;
|
var map;
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
var mapOptions = {
|
var mapOptions = {
|
||||||
scrollwheel: true,
|
scrollwheel: true,
|
||||||
@ -4994,27 +5003,42 @@ class IndividualPage(BasePage):
|
|||||||
backgroundColor: '#000000',
|
backgroundColor: '#000000',
|
||||||
zoom: %d,
|
zoom: %d,
|
||||||
center: centre,
|
center: centre,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
}
|
}
|
||||||
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
|
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
|
||||||
}
|
addMarkers();
|
||||||
|
|
||||||
function drop() {
|
|
||||||
for (var i = 0; i < myCoordinates.length; i++) {
|
|
||||||
setTimeout(function() {
|
|
||||||
addMarkers();
|
|
||||||
}, i * 1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMarkers() {
|
function addMarkers() {
|
||||||
markers.push(new google.maps.Marker({
|
bounds = new google.LatLngBounds();
|
||||||
position: myCoordinates[iterator],
|
|
||||||
map: map,
|
for (var iterator = 0; iterator < myCoordinates.length; iterator++) {
|
||||||
draggable: true,
|
var locations = myCoordinates[iterator];
|
||||||
animation: google.maps.Animation.DROP
|
|
||||||
}));
|
var myLatLng = new google.maps.LatLng(locations[0], locations[1]);
|
||||||
iterator++;
|
|
||||||
|
var image;
|
||||||
|
if (locations[2] = 'Red')
|
||||||
|
{
|
||||||
|
image = '../../../images/red_marker.png';
|
||||||
|
} else if (locations[2] = 'Blue')
|
||||||
|
{
|
||||||
|
image = '../../../images/blue_marker.png';
|
||||||
|
} else {
|
||||||
|
image = '../../../images/purple_marker.png';
|
||||||
|
}
|
||||||
|
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: myLatLng,
|
||||||
|
draggable: true,
|
||||||
|
title: locations[2],
|
||||||
|
icon: image,
|
||||||
|
map: map,
|
||||||
|
zIndex: locations[6]
|
||||||
|
});
|
||||||
|
bounds.extend(myLatLng);
|
||||||
|
map.fitBounds(bounds);
|
||||||
|
}
|
||||||
}""" % zoomlevel
|
}""" % 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()!
|
||||||
@ -5037,8 +5061,8 @@ class IndividualPage(BasePage):
|
|||||||
mapbackground += canvas
|
mapbackground += canvas
|
||||||
|
|
||||||
# if Google and Markers are selected, then add "Drop Markers" button?
|
# if Google and Markers are selected, then add "Drop Markers" button?
|
||||||
if (self.mapservice == "Google" and self.googleopts == "Markers"):
|
#if (self.mapservice == "Google" and self.googleopts == "Markers"):
|
||||||
mapbackground += Html("button", _("Drop Markers"), id ="drop", onclick ="drop()", inline =True)
|
# mapbackground += Html("button", _("Drop Markers"), id ="drop", onclick ="drop()", inline =True)
|
||||||
|
|
||||||
if self.mapservice == "OpenStreetMap":
|
if self.mapservice == "OpenStreetMap":
|
||||||
with Html("script", type ="text/javascript") as jsc:
|
with Html("script", type ="text/javascript") as jsc:
|
||||||
@ -5049,7 +5073,6 @@ class IndividualPage(BasePage):
|
|||||||
jsc += openstreet_jsc % (Utils.xml_lang()[3:5].lower(), data[0], data[1] )
|
jsc += openstreet_jsc % (Utils.xml_lang()[3:5].lower(), data[0], data[1] )
|
||||||
else:
|
else:
|
||||||
jsc += """
|
jsc += """
|
||||||
//<![CDATA[
|
|
||||||
OpenLayers.Lang.setCode("%s");
|
OpenLayers.Lang.setCode("%s");
|
||||||
|
|
||||||
map = new OpenLayers.Map("map_canvas");
|
map = new OpenLayers.Map("map_canvas");
|
||||||
@ -5096,8 +5119,7 @@ class IndividualPage(BasePage):
|
|||||||
feature.popup = null;
|
feature.popup = null;
|
||||||
}
|
}
|
||||||
map.addControl(controls['selector']);
|
map.addControl(controls['selector']);
|
||||||
controls['selector'].activate();
|
controls['selector'].activate();"""
|
||||||
//]]>"""
|
|
||||||
|
|
||||||
with Html("div", class_ ="subsection", id ="references") as section:
|
with Html("div", class_ ="subsection", id ="references") as section:
|
||||||
mapbackground += section
|
mapbackground += section
|
||||||
@ -5108,7 +5130,7 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
# 0 = latitude, 1 = longitude, 2 = place title, 3 = handle, and 4 = date
|
# 0 = latitude, 1 = longitude, 2 = place title, 3 = handle, and 4 = date
|
||||||
place_lat_long = sorted(place_lat_long, key =operator.itemgetter(4, 3, 0, 1))
|
place_lat_long = sorted(place_lat_long, key =operator.itemgetter(4, 3, 0, 1))
|
||||||
for (lat, long, pname, handle, date) in place_lat_long:
|
for (lat, long, pname, handle, date, marker) in place_lat_long:
|
||||||
|
|
||||||
list = Html("li", self.place_link(handle, pname, up =self.up))
|
list = Html("li", self.place_link(handle, pname, up =self.up))
|
||||||
ordered += list
|
ordered += list
|
||||||
@ -5634,9 +5656,7 @@ class IndividualPage(BasePage):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
db = self.report.database
|
db = self.report.database
|
||||||
|
|
||||||
birthorder = self.report.options['birthorder']
|
birthorder = self.report.options['birthorder']
|
||||||
familymappages = self.report.options['familymappages']
|
|
||||||
|
|
||||||
# begin parents division
|
# begin parents division
|
||||||
with Html("div", class_ = "subsection", id = "parents") as section:
|
with Html("div", class_ = "subsection", id = "parents") as section:
|
||||||
@ -6586,6 +6606,9 @@ class NavWebReport(Report):
|
|||||||
fname = CSS["NarrativeMaps"]["filename"]
|
fname = CSS["NarrativeMaps"]["filename"]
|
||||||
self.copy_file(fname, "narrative-maps.css", "styles")
|
self.copy_file(fname, "narrative-maps.css", "styles")
|
||||||
|
|
||||||
|
# if Family Map Pages is selected, then copy the colored markers too?
|
||||||
|
imgs += CSS["FamilyMaps"]["images"]
|
||||||
|
|
||||||
# if OpenStreetMap is being used, copy blue marker?
|
# if OpenStreetMap is being used, copy blue marker?
|
||||||
if self.mapservice == "OpenStreetMap":
|
if self.mapservice == "OpenStreetMap":
|
||||||
imgs += CSS["NarrativeMaps"]["images"]
|
imgs += CSS["NarrativeMaps"]["images"]
|
||||||
@ -7309,8 +7332,9 @@ class NavWebOptions(MenuReportOptions):
|
|||||||
self.__gallery.connect('value-changed', self.__gallery_changed)
|
self.__gallery.connect('value-changed', self.__gallery_changed)
|
||||||
|
|
||||||
self.__create_thumbs_only = BooleanOption(_("Create and only use thumbnail- sized images"), False)
|
self.__create_thumbs_only = BooleanOption(_("Create and only use thumbnail- sized images"), False)
|
||||||
self.__create_thumbs_only.set_help(_("This options allows you the choice to not create any full- sized"
|
self.__create_thumbs_only.set_help(_("This options allows you the choice to not create any full- sized "
|
||||||
"images as in the Media Page, and only a thumb- sized images or not?"))
|
"images as in the Media Page, and only a thumb- sized images. This will allow you to have a much "
|
||||||
|
"smaller total upload size to your web hosting site."))
|
||||||
addopt("create_thumbs_only", self.__create_thumbs_only)
|
addopt("create_thumbs_only", self.__create_thumbs_only)
|
||||||
self.__create_thumbs_only.connect("value-changed", self.__gallery_changed)
|
self.__create_thumbs_only.connect("value-changed", self.__gallery_changed)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user