45 |
|
|
46 |
from Thuban.version import versions |
from Thuban.version import versions |
47 |
|
|
48 |
|
if Thuban.Model.resource.has_gdal_support(): |
49 |
|
from gdalwarp import ProjectRasterFile |
50 |
|
|
51 |
|
|
52 |
# Map the strings used for the format parameter of the draw_raster_data |
# Map the strings used for the format parameter of the draw_raster_data |
53 |
# method to the appropriate wxWindows constants |
# method to the appropriate wxWindows constants |
111 |
return wxFont(int(round(self.resolution * 10)), wxSWISS, wxNORMAL, |
return wxFont(int(round(self.resolution * 10)), wxSWISS, wxNORMAL, |
112 |
wxNORMAL) |
wxNORMAL) |
113 |
|
|
114 |
|
def projected_raster_layer(self, layer, srcProj, dstProj, extents, |
115 |
|
resolution, dimensions, options): |
116 |
|
|
117 |
|
ret = None |
118 |
|
|
119 |
|
if Thuban.Model.resource.has_gdal_support(): |
120 |
|
|
121 |
|
if versions['wxPython-tuple'] < (2,5,3): |
122 |
|
options = options | 4 # INVERT_MASK_BITS |
123 |
|
options = options & ~2 # ALPHA_MASK not supported |
124 |
|
|
125 |
|
try: |
126 |
|
ret = ProjectRasterFile(layer.GetImageFilename(), |
127 |
|
srcProj, dstProj, |
128 |
|
extents, resolution, dimensions, |
129 |
|
options) |
130 |
|
except (MemoryError, IOError, AttributeError, ValueError): |
131 |
|
# Why does this catch AttributeError and ValueError? |
132 |
|
# FIXME: The exception should be communicated to the user |
133 |
|
# better. |
134 |
|
traceback.print_exc() |
135 |
|
|
136 |
|
return ret |
137 |
|
|
138 |
def draw_raster_data(self, x,y, data, format = 'BMP'): |
def draw_raster_data(self, x,y, data, format = 'BMP'): |
139 |
|
|
140 |
mask = None |
mask = None |