bh: thuban/Thuban/UI viewport.py,1.16,1.17

cvs@intevation.de cvs at intevation.de
Fri Jul 16 21:47:31 CEST 2004


Author: bh

Update of /thubanrepository/thuban/Thuban/UI
In directory doto:/tmp/cvs-serv12493/Thuban/UI

Modified Files:
	viewport.py 
Log Message:
* test/test_viewport.py
(ViewPortTest.test_changing_map_projection): Check that changing
the projection of an empty map shown in a viewport doesn't lead to
exceptions in the viewport's handler for the
MAP_PROJECTION_CHANGED messages

* Thuban/UI/viewport.py (ViewPort.map_projection_changed): Only
try to keep the same region visible when the map actually contains
something


Index: viewport.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/UI/viewport.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- viewport.py	27 Nov 2003 16:04:42 -0000	1.16
+++ viewport.py	16 Jul 2004 19:47:29 -0000	1.17
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2002, 2003 by Intevation GmbH
+# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 # Frank Koormann <frank at intevation.de>
@@ -327,12 +327,17 @@
         return self.map
 
     def map_projection_changed(self, map, old_proj):
-        """Subscribed to the map's MAP_PROJECTION_CHANGED message"""
+        """Subscribed to the map's MAP_PROJECTION_CHANGED message
+
+        If the projection changes, the region shown is probably not
+        meaningful anymore in the new projection.  Therefore this method
+        tries to keep the same region visible as before.
+        """
         proj = self.map.GetProjection()
 
         bbox = None
 
-        if old_proj is not None and proj is not None:
+        if old_proj is not None and proj is not None and self.map.HasLayers():
             width, height = self.GetPortSizeTuple()
             llx, lly = self.win_to_proj(0, height)
             urx, ury = self.win_to_proj(width, 0)





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)