From fb0095ca72858822fc98a7898be62d33c45d20e5 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Thu, 11 Aug 2011 07:51:17 +0000 Subject: [PATCH] Geography : first try to solve bug 5053. svn: r18025 --- src/plugins/lib/maps/grampsmaps.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/lib/maps/grampsmaps.py b/src/plugins/lib/maps/grampsmaps.py index d1d6535da..f1caf5dfc 100644 --- a/src/plugins/lib/maps/grampsmaps.py +++ b/src/plugins/lib/maps/grampsmaps.py @@ -223,6 +223,7 @@ class osmGpsMap(): self.osm.layer_remove(layer) def zoom_changed(self, zoom): + _LOG.debug("zoom_changed : %d" % self.osm.props.zoom) config.set("geography.zoom",self.osm.props.zoom) self.save_center(self.osm.props.latitude, self.osm.props.longitude) @@ -257,8 +258,17 @@ class osmGpsMap(): """ Save the longitude and lontitude in case we switch between maps. """ - config.set("geography.center-lat",lat) - config.set("geography.center-lon",lon) + _LOG.debug("save_center : %s,%s" % (lat, lon) ) + if ( -90.0 < lat < +90.0 ) and ( -180.0 < lon < +180.0 ): + config.set("geography.center-lat",lat) + config.set("geography.center-lon",lon) + else: + _LOG.debug("save_center : new coordinates : %s,%s" % (lat, lon) ) + _LOG.debug("save_center : old coordinates : %s,%s" % (lat, lon) ) + # osmgpsmap bug ? reset to prior values to avoid osmgpsmap problems. + self.osm.set_center_and_zoom(config.get("geography.center-lat"), + config.get("geography.center-lon"), + config.get("geography.zoom") ) def activate_selection_zoom(self, osm, event): if self.end_selection is not None: