/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/renderer.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/renderer.py

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

revision 938 by jonathan, Tue May 20 15:25:10 2003 UTC revision 1165 by jonathan, Thu Jun 12 12:42:10 2003 UTC
# Line 35  from Thuban.Model.label import ALIGN_CEN Line 35  from Thuban.Model.label import ALIGN_CEN
35    
36  from Thuban.Model.classification import Classification  from Thuban.Model.classification import Classification
37  from Thuban.Model.color import Color  from Thuban.Model.color import Color
38    import Thuban.Model.resource
39    
40  class MapRenderer:  class MapRenderer:
41    
# Line 72  class MapRenderer: Line 73  class MapRenderer:
73          self.map = map          self.map = map
74          seenRaster = True          seenRaster = True
75    
76            if self.scale == 0:
77                return
78    
79          #          #
80          # This is only a good optimization if there is only one          # This is only a good optimization if there is only one
81          # raster layer and the image covers the entire window (as          # raster layer and the image covers the entire window (as
82          # it currently does).          # it currently does). We note if there is a raster layer
83            # and only begin drawing layers once we have drawn it.
84            # That way we avoid drawing layers that won't be seen.
85          #          #
86          for layer in map.Layers():          for layer in map.Layers():
87              if isinstance(layer, RasterLayer):              if isinstance(layer, RasterLayer) and layer.Visible():
88                  seenRaster = False                  seenRaster = False
89                  break                  break
90    
# Line 88  class MapRenderer: Line 94  class MapRenderer:
94              if not self.honor_visibility or layer.Visible():              if not self.honor_visibility or layer.Visible():
95                  if isinstance(layer, Layer) and seenRaster:                  if isinstance(layer, Layer) and seenRaster:
96                      self.draw_shape_layer(layer)                      self.draw_shape_layer(layer)
97                  elif isinstance(layer, RasterLayer):                  elif isinstance(layer, RasterLayer) \
98                        and Thuban.Model.resource.has_gdal_support():
99                      self.draw_raster_layer(layer)                      self.draw_raster_layer(layer)
100                      seenRaster = True                      seenRaster = True
101    
# Line 189  class MapRenderer: Line 196  class MapRenderer:
196              for p in proj.GetAllParameters():              for p in proj.GetAllParameters():
197                  outProj += "+" + p + " "                  outProj += "+" + p + " "
198    
         print "self.scale: ", self.scale, offx, offy, width, height  
199          xmin = (0 - offx) / self.scale          xmin = (0 - offx) / self.scale
200          ymin = (offy - height) / self.scale          ymin = (offy - height) / self.scale
201          xmax = (width - offx) / self.scale          xmax = (width - offx) / self.scale
# Line 200  class MapRenderer: Line 206  class MapRenderer:
206                  layer.GetImageFilename(),                  layer.GetImageFilename(),
207                  inProj,                  inProj,
208                  outProj,                  outProj,
209                  str(xmin), str(ymin), str(xmax), str(ymax),                  (xmin, ymin, xmax, ymax),
210                  "", str(width), str(height));                  "", (width, height))
211          except (AttributeError, IOError, ValueError):          except IOError, (strerr):
212                print strerr
213            except (AttributeError, ValueError):
214              pass              pass
215          else:          else:
216              if data is not None:              if data is not None:

Legend:
Removed from v.938  
changed lines
  Added in v.1165

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26