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