/[thuban]/trunk/thuban/Thuban/Model/layer.py
ViewVC logotype

Diff of /trunk/thuban/Thuban/Model/layer.py

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

revision 364 by jonathan, Mon Jan 27 11:47:12 2003 UTC revision 386 by jonathan, Mon Feb 3 11:44:27 2003 UTC
# Line 10  __version__ = "$Revision$" Line 10  __version__ = "$Revision$"
10  import os  import os
11  from math import log, ceil  from math import log, ceil
12    
13    from Thuban import _
14    
15  import shapelib, shptree  import shapelib, shptree
16    
17  from messages import LAYER_PROJECTION_CHANGED, LAYER_LEGEND_CHANGED, \  from messages import LAYER_PROJECTION_CHANGED, LAYER_LEGEND_CHANGED, \
# Line 248  class Layer(BaseLayer): Line 250  class Layer(BaseLayer):
250    
251      def SetFill(self, fill):      def SetFill(self, fill):
252          """Set the layer's fill color. None means the shapes are not filled"""          """Set the layer's fill color. None means the shapes are not filled"""
253          self.fill = fill          null = self.classification.getNull()
254            null['fill'] = fill
255            self.classification.setNull(null)
256          self.changed(LAYER_LEGEND_CHANGED, self)          self.changed(LAYER_LEGEND_CHANGED, self)
257    
258      def SetStroke(self, stroke):      def SetStroke(self, stroke):
259          """Set the layer's stroke color. None means the shapes are not          """Set the layer's stroke color. None means the shapes are not
260          stroked."""          stroked."""
261          self.stroke = stroke          null = self.classification.getNull()
262            null['stroke'] = stroke
263            self.classification.setNull(null)
264          self.changed(LAYER_LEGEND_CHANGED, self)          self.changed(LAYER_LEGEND_CHANGED, self)
265    
266      def SetStrokeWidth(self, width):      def SetStrokeWidth(self, width):
267          """Set the layer's stroke width."""          """Set the layer's stroke width."""
268          self.stroke_width = width          null = self.classification.getNull()
269            null['stroke_width'] = width
270            self.classification.setNull(null)
271          self.changed(LAYER_LEGEND_CHANGED, self)          self.changed(LAYER_LEGEND_CHANGED, self)
272    
273      def TreeInfo(self):      def TreeInfo(self):
274          items = []          items = []
275    
276          if self.Visible():          if self.Visible():
277              items.append("Shown")              items.append(_("Shown"))
278          else:          else:
279              items.append("Hidden")              items.append(_("Hidden"))
280          items.append("Shapes: %d" % self.NumShapes())          items.append(_("Shapes: %d") % self.NumShapes())
281    
282          bbox = self.LatLongBoundingBox()          bbox = self.LatLongBoundingBox()
283          if bbox is not None:          if bbox is not None:
284              items.append("Extent (lat-lon): (%g, %g, %g, %g)" % bbox)              items.append(_("Extent (lat-lon): (%g, %g, %g, %g)") % bbox)
285          else:          else:
286              items.append("Extent (lat-lon):")              items.append(_("Extent (lat-lon):"))
287          items.append("Shapetype: %s" % shapetype_names[self.ShapeType()])          items.append(_("Shapetype: %s") % shapetype_names[self.ShapeType()])
288    
289          def color_string(color):          def color_string(color):
290              if color is None:              if color is None:
291                  return "None"                  return "None"
292              return "(%.3f, %.3f, %.3f)" % (color.red, color.green, color.blue)              return "(%.3f, %.3f, %.3f)" % (color.red, color.green, color.blue)
         items.append("Fill: " + color_string(self.fill))  
         items.append("Outline: " + color_string(self.stroke))  
293    
294          return ("Layer '%s'" % self.Title(), items)          # layers will always have a classification with at least a NULL data set
295    
296            #items.append((_("Fill: %s") % color_string(self.fill), self.fill))
297            #items.append((_("Outline: %s") % color_string(self.stroke), self.stroke))
298    
299            items.append(self.classification)
300    
301            return (_("Layer '%s'") % self.Title(), items)
302    

Legend:
Removed from v.364  
changed lines
  Added in v.386

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26