/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/map.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/map.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 249 by bh, Tue Jul 30 14:17:33 2002 UTC revision 374 by jan, Mon Jan 27 14:20:02 2003 UTC
# Line 11  from messages import LAYERS_CHANGED, MAP Line 11  from messages import LAYERS_CHANGED, MAP
11       CHANGED, LAYER_PROJECTION_CHANGED, LAYER_LEGEND_CHANGED, \       CHANGED, LAYER_PROJECTION_CHANGED, LAYER_LEGEND_CHANGED, \
12       LAYER_VISIBILITY_CHANGED       LAYER_VISIBILITY_CHANGED
13    
14    from Thuban import _
15    
16  from base import TitledObject, Modifiable  from base import TitledObject, Modifiable
17    
18  from label import LabelLayer  from label import LabelLayer
# Line 32  class Map(TitledObject, Modifiable): Line 34  class Map(TitledObject, Modifiable):
34                          Parameter: the map                          Parameter: the map
35      """      """
36    
37      forwarded_channels = (LAYER_PROJECTION_CHANGED,      forwarded_channels = (CHANGED,
38                              LAYER_PROJECTION_CHANGED,
39                            LAYER_LEGEND_CHANGED,                            LAYER_LEGEND_CHANGED,
40                            LAYER_VISIBILITY_CHANGED)                            LAYER_VISIBILITY_CHANGED)
41    
42      def __init__(self, title, projection = None):      def __init__(self, title, projection = None):
43          """Initialize the map."""          """Initialize the map."""
44          TitledObject.__init__(self, title)          TitledObject.__init__(self, title)
45            Modifiable.__init__(self)
46          self.layers = []          self.layers = []
47          self.label_layer = LabelLayer("Labels")          self.label_layer = LabelLayer(_("Labels"))
48          self.label_layer.Subscribe(CHANGED, self.forward, LAYERS_CHANGED)          self.label_layer.Subscribe(CHANGED, self.forward, LAYERS_CHANGED)
49          self.projection = projection          self.projection = projection
50    
# Line 67  class Map(TitledObject, Modifiable): Line 71  class Map(TitledObject, Modifiable):
71          self.changed(LAYERS_CHANGED, self)          self.changed(LAYERS_CHANGED, self)
72          layer.Destroy()          layer.Destroy()
73    
74        def CanRemoveLayer(self, layer):
75            """Return true if the layer can be deleted.
76    
77            The default implementation always returns 1. Derived classes
78            should override this method if they have e.g. special layers
79            that the user should not be able to remove.
80            """
81            return 1
82    
83      def ClearLayers(self):      def ClearLayers(self):
84          """Delete all layers."""          """Delete all layers."""
85          for layer in self.layers:          for layer in self.layers:
# Line 198  class Map(TitledObject, Modifiable): Line 211  class Map(TitledObject, Modifiable):
211      def TreeInfo(self):      def TreeInfo(self):
212          items = []          items = []
213          if self.BoundingBox() != None:          if self.BoundingBox() != None:
214              items.append("Extent (lat-lon): (%g, %g, %g, %g)"              items.append(_("Extent (lat-lon): (%g, %g, %g, %g)")
215                           % self.BoundingBox())                           % self.BoundingBox())
216              if self.projection and len(self.projection.params) > 0:              if self.projection and len(self.projection.params) > 0:
217                  items.append("Extent (projected): (%g, %g, %g, %g)"                  items.append(_("Extent (projected): (%g, %g, %g, %g)")
218                               % self.ProjectedBoundingBox())                               % self.ProjectedBoundingBox())
219                  items.append(("Projection",                  items.append((_("Projection"),
220                                [str(param)                                [str(param)
221                                 for param in self.projection.params]))                                 for param in self.projection.params]))
222    
# Line 211  class Map(TitledObject, Modifiable): Line 224  class Map(TitledObject, Modifiable):
224          layers.reverse()          layers.reverse()
225          items.extend(layers)          items.extend(layers)
226    
227          return ("Map: %s" % self.title, items)          return (_("Map: %s") % self.title, items)
228    

Legend:
Removed from v.249  
changed lines
  Added in v.374

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26