GeoView : correction when no places with coordinates in the database.
svn: r11739
This commit is contained in:
@@ -96,6 +96,7 @@ if WebKit == NOWEB :
|
||||
Config.set(Config.GEOVIEW, False)
|
||||
raise ImportError, 'No GTK html plugin found'
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps Modules
|
||||
@@ -115,6 +116,7 @@ MOZEMBED_SUBPATH = Utils.get_empty_tempdir('mozembed_gramps')
|
||||
GEOVIEW_SUBPATH = Utils.get_empty_tempdir('geoview')
|
||||
NB_MARKERS_PER_PAGE = 200
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Renderer
|
||||
@@ -167,7 +169,6 @@ class Renderer():
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
#def page_loaded(self,obj,status):
|
||||
def page_loaded(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -177,6 +178,7 @@ class Renderer():
|
||||
"""
|
||||
self.fct()
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Renderer with WebKit
|
||||
@@ -284,6 +286,7 @@ class RendererMozilla(Renderer):
|
||||
pass
|
||||
pass # We don't use a proxy or the http_proxy variable is not set.
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# HtmlView
|
||||
@@ -654,7 +657,6 @@ class GeoView(HtmlView):
|
||||
callback=self.event_places,
|
||||
tip=_("Attempt to view places on the Map for all events."))
|
||||
|
||||
|
||||
def goto_active_person(self,handle=None):
|
||||
self.geo_places(self.displaytype)
|
||||
|
||||
@@ -973,8 +975,8 @@ class GeoView(HtmlView):
|
||||
# We center the map on a point at the center of all markers
|
||||
self.centerlat = maxlat/2
|
||||
self.centerlon = maxlong/2
|
||||
latit = self.centerlat
|
||||
longt = self.centerlon
|
||||
latit = 0.0
|
||||
longt = 0.0
|
||||
for mark in self.sort:
|
||||
cent = int(mark[6])
|
||||
if cent:
|
||||
@@ -991,6 +993,8 @@ class GeoView(HtmlView):
|
||||
longt = self.maxlon+self.centerlon
|
||||
else:
|
||||
longt = self.maxlon-self.centerlon
|
||||
self.mustcenter = False
|
||||
if latit != 0.0 or longt != 0.0:
|
||||
self.latit = latit
|
||||
self.longt = longt
|
||||
self.mustcenter = True
|
||||
@@ -1163,7 +1167,19 @@ class GeoView(HtmlView):
|
||||
self.yearinmarker = []
|
||||
self.mapview.write("mapstraction.addMarker(my_marker);")
|
||||
self.setattr = False
|
||||
if not self.centered:
|
||||
if self.nbmarkers > 0:
|
||||
if self.setattr:
|
||||
years = ""
|
||||
if mark[2]:
|
||||
for y in self.yearinmarker:
|
||||
years += "%d " % y
|
||||
years += "end"
|
||||
self.mapview.write("my_marker.setAttribute('year','%s');" % years)
|
||||
self.yearinmarker = []
|
||||
years=""
|
||||
self.mapview.write("mapstraction.addMarker(my_marker);")
|
||||
self.setattr = False
|
||||
else:
|
||||
# We have no valid geographic point to center the map.
|
||||
# So you'll see the street where I live.
|
||||
# I think another place should be better :
|
||||
@@ -1183,20 +1199,8 @@ class GeoView(HtmlView):
|
||||
self.mapview.write("%s</div>\");\n"%_("This request has no geolocation associated."))
|
||||
self.mapview.write(" mapstraction.addMarker(my_marker);")
|
||||
self.setattr = False
|
||||
if self.setattr:
|
||||
years = ""
|
||||
if mark[2]:
|
||||
for y in self.yearinmarker:
|
||||
years += "%d " % y
|
||||
years += "end"
|
||||
self.mapview.write("my_marker.setAttribute('year','%s');" % years)
|
||||
self.yearinmarker = []
|
||||
years=""
|
||||
self.mapview.write("mapstraction.addMarker(my_marker);")
|
||||
self.setattr = False
|
||||
self.mapview.write("\n </script>\n")
|
||||
|
||||
|
||||
def createPersonMarkers(self,db,person,comment):
|
||||
"""
|
||||
This function create all markers for the specified person.
|
||||
|
||||
Reference in New Issue
Block a user