/[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 2568 by jan, Wed Feb 16 23:14:35 2005 UTC revision 2569 by jan, Thu Feb 17 11:02:28 2005 UTC
# Line 22  from label import LabelLayer Line 22  from label import LabelLayer
22    
23  class Map(TitledObject, Modifiable):  class Map(TitledObject, Modifiable):
24    
25      """Represent a map. A map is a list of layers. Additionally      """Represent a map.
26    
27        A map is a list of layers. Additionally
28      there is a special label layer containing all labels that      there is a special label layer containing all labels that
29      are defined for the map.      are defined for the map.
30    
# Line 53  class Map(TitledObject, Modifiable): Line 55  class Map(TitledObject, Modifiable):
55          self.projection = projection          self.projection = projection
56    
57      def Destroy(self):      def Destroy(self):
58          """Destroys the map object with all layers including          """Destroys the map object with all layers including the label layer.
         the label layer.  
59    
60          Calls Modifiable.Destroy first since it will call          Calls Modifiable. Destroy first since it will call
61          Publisher.Destroy which removes all subscriptions. Otherwise          Publisher.Destroy which removes all subscriptions. Otherwise
62          clearing the layers results in messages to be sent which can          clearing the layers results in messages to be sent which can
63          cause problems.          cause problems.
# Line 75  class Map(TitledObject, Modifiable): Line 76  class Map(TitledObject, Modifiable):
76    
77      def RemoveLayer(self, layer):      def RemoveLayer(self, layer):
78          """Remove layer from the map.          """Remove layer from the map.
79    
80          This can not be applied for the label layer of the map.          This can not be applied for the label layer of the map.
81          """          """
82          self.unsubscribe_layer_channels(layer)          self.unsubscribe_layer_channels(layer)
# Line 93  class Map(TitledObject, Modifiable): Line 95  class Map(TitledObject, Modifiable):
95          return 1          return 1
96    
97      def ClearLayers(self):      def ClearLayers(self):
98          """Delete all layers and also remove all labels from the          """Delete all layers and also remove all labels from the label layer.
         label layer.  
99          """          """
100          for layer in self.layers:          for layer in self.layers:
101              self.unsubscribe_layer_channels(layer)              self.unsubscribe_layer_channels(layer)
# Line 126  class Map(TitledObject, Modifiable): Line 127  class Map(TitledObject, Modifiable):
127          return self.layers          return self.layers
128    
129      def HasLayers(self):      def HasLayers(self):
130          """Return true if the map has at least one layer other          """Information whether this map has layers.
131    
132            Returns true if the map has at least one layer other
133          than the label layer."""          than the label layer."""
134          return len(self.layers) > 0          return len(self.layers) > 0
135    
136      def MoveLayerToTop(self, layer):      def MoveLayerToTop(self, layer):
137          """Put the layer on top of the layer stack. This can not          """Put the layer on top of the layer stack.
138          be applied to the label layer.  
139            This can not be applied to the label layer.
140    
141          If the layer is already at the top do nothing. If the stacking          If the layer is already at the top do nothing. If the stacking
142          order has been changed, issue a MAP_LAYERS_CHANGED message.          order has been changed, issue a MAP_LAYERS_CHANGED message.
# Line 145  class Map(TitledObject, Modifiable): Line 149  class Map(TitledObject, Modifiable):
149              self.changed(MAP_STACKING_CHANGED, self)              self.changed(MAP_STACKING_CHANGED, self)
150    
151      def RaiseLayer(self, layer):      def RaiseLayer(self, layer):
152          """Swap the layer with the one above it. This does          """Swap the layer with the one above it.
153          not apply to the label layer.  
154            This does not apply to the label layer.
155    
156          If the layer is already at the top do nothing. If the stacking          If the layer is already at the top do nothing. If the stacking
157          order has been changed, issue a MAP_LAYERS_CHANGED message.          order has been changed, issue a MAP_LAYERS_CHANGED message.
# Line 159  class Map(TitledObject, Modifiable): Line 164  class Map(TitledObject, Modifiable):
164              self.changed(MAP_STACKING_CHANGED, self)              self.changed(MAP_STACKING_CHANGED, self)
165    
166      def LowerLayer(self, layer):      def LowerLayer(self, layer):
167          """Swap the layer with the one below it. This does          """Swap the layer with the one below it.
168          not apply to the label layer.  
169            This does not apply to the label layer.
170    
171          If the layer is already at the bottom do nothing. If the          If the layer is already at the bottom do nothing. If the
172          stacking order has been changed, issue a MAP_LAYERS_CHANGED message.          stacking order has been changed, issue a MAP_LAYERS_CHANGED message.
# Line 173  class Map(TitledObject, Modifiable): Line 179  class Map(TitledObject, Modifiable):
179              self.changed(MAP_STACKING_CHANGED, self)              self.changed(MAP_STACKING_CHANGED, self)
180    
181      def MoveLayerToBottom(self, layer):      def MoveLayerToBottom(self, layer):
182          """Put the layer at the bottom of the stack. This does          """Put the layer at the bottom of the stack.
183          not apply to the label layer.  
184            This does not apply to the label layer.
185    
186          If the layer is already at the bottom do nothing. If the          If the layer is already at the bottom do nothing. If the
187          stacking order has been changed, issue a MAP_LAYERS_CHANGED message.          stacking order has been changed, issue a MAP_LAYERS_CHANGED message.
# Line 188  class Map(TitledObject, Modifiable): Line 195  class Map(TitledObject, Modifiable):
195    
196      def BoundingBox(self):      def BoundingBox(self):
197          """Return the bounding box of the map in Lat/Lon coordinates.          """Return the bounding box of the map in Lat/Lon coordinates.
198    
199          The label layer is not considered for the computation of the          The label layer is not considered for the computation of the
200          bounding box.          bounding box.
201    
# Line 218  class Map(TitledObject, Modifiable): Line 226  class Map(TitledObject, Modifiable):
226    
227      def ProjectedBoundingBox(self):      def ProjectedBoundingBox(self):
228          """Return the bounding box of the map in projected coordinates.          """Return the bounding box of the map in projected coordinates.
229    
230          The label layer is not considered for the computation of the          The label layer is not considered for the computation of the
231          bounding box.          bounding box.
232    
# Line 238  class Map(TitledObject, Modifiable): Line 247  class Map(TitledObject, Modifiable):
247      def SetProjection(self, projection):      def SetProjection(self, projection):
248          """Set the projection of the map.          """Set the projection of the map.
249    
250          Issue a MAP_PROJECTION_CHANGED message."""          Issue a MAP_PROJECTION_CHANGED message.
251            """
252          old_proj = self.projection          old_proj = self.projection
253          self.projection = projection          self.projection = projection
254          self.changed(MAP_PROJECTION_CHANGED, self, old_proj)          self.changed(MAP_PROJECTION_CHANGED, self, old_proj)
# Line 267  class Map(TitledObject, Modifiable): Line 277  class Map(TitledObject, Modifiable):
277          self.label_layer.UnsetModified()          self.label_layer.UnsetModified()
278    
279      def TreeInfo(self):      def TreeInfo(self):
280          """Return a tuple of (title, tupel) describing the contents          """Return a description of the object.
281          of the object in a tree-structure.  
282            A tuple of (title, tupel) describing the contents
283            of the object in a tree-structure is returned.
284          """          """
285          items = []          items = []
286          if self.BoundingBox() != None:          if self.BoundingBox() != None:

Legend:
Removed from v.2568  
changed lines
  Added in v.2569

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26