22 |
wxTRANSPARENT_PEN, wxTRANSPARENT_BRUSH, \ |
wxTRANSPARENT_PEN, wxTRANSPARENT_BRUSH, \ |
23 |
wxBLACK_PEN, wxBLACK, wxSOLID, wxCROSS_HATCH, wxSWISS, wxNORMAL, \ |
wxBLACK_PEN, wxBLACK, wxSOLID, wxCROSS_HATCH, wxSWISS, wxNORMAL, \ |
24 |
wxBitmapFromImage, wxImageFromStream, wxBITMAP_TYPE_BMP, \ |
wxBitmapFromImage, wxImageFromStream, wxBITMAP_TYPE_BMP, \ |
25 |
wxBITMAP_TYPE_JPEG, wxBITMAP_TYPE_PNG, wxBITMAP_TYPE_TIF, wxBITMAP_TYPE_GIF |
wxBITMAP_TYPE_JPEG, wxBITMAP_TYPE_PNG, wxBITMAP_TYPE_TIF, \ |
26 |
|
wxBITMAP_TYPE_GIF, wxEmptyImage, wxMask, wxBitmapFromBits |
27 |
|
|
28 |
from wxproj import draw_polygon_shape, draw_polygon_init |
from wxproj import draw_polygon_shape, draw_polygon_init |
29 |
|
|
39 |
|
|
40 |
from baserenderer import BaseRenderer |
from baserenderer import BaseRenderer |
41 |
|
|
42 |
|
from math import floor |
43 |
|
|
44 |
|
from types import StringType |
45 |
|
|
46 |
|
|
47 |
# 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 |
48 |
# method to the appropriate wxWindows constants |
# method to the appropriate wxWindows constants |
104 |
return wxFont(int(round(self.resolution * 10)), wxSWISS, wxNORMAL, |
return wxFont(int(round(self.resolution * 10)), wxSWISS, wxNORMAL, |
105 |
wxNORMAL) |
wxNORMAL) |
106 |
|
|
107 |
def draw_raster_data(self, data, format = 'BMP'): |
def draw_raster_data(self, x,y, data, format = 'BMP'): |
108 |
stream = cStringIO.StringIO(data) |
|
109 |
image = wxImageFromStream(stream, raster_format_map[format]) |
mask = None |
110 |
|
|
111 |
|
if format == 'RAW': |
112 |
|
image = wxEmptyImage(data[0], data[1]) |
113 |
|
image.SetData(data[2][0]) |
114 |
|
if data[2][1] is not None: |
115 |
|
mask = wxBitmapFromBits(data[2][1], data[0], data[1], 1) |
116 |
|
mask = wxMask(mask) |
117 |
|
else: |
118 |
|
stream = cStringIO.StringIO(data[2][0]) |
119 |
|
image = wxImageFromStream(stream, raster_format_map[format]) |
120 |
|
if data[2][1] is not None: |
121 |
|
stream = cStringIO.StringIO(data[2][1]) |
122 |
|
mask = wxImageFromStream(stream, raster_format_map[format]) |
123 |
|
mask = wxMask(wxBitmapFromImage(mask, 1)) |
124 |
|
|
125 |
bitmap = wxBitmapFromImage(image) |
bitmap = wxBitmapFromImage(image) |
126 |
self.dc.DrawBitmap(bitmap, 0, 0) |
bitmap.SetMask(mask) |
127 |
|
|
128 |
|
self.dc.DrawBitmap(bitmap, int(round(x)), int(round(y)), True) |
129 |
|
|
130 |
|
|
131 |
class ScreenRenderer(MapRenderer): |
class ScreenRenderer(MapRenderer): |
188 |
|
|
189 |
# Get the size of the specific property for this |
# Get the size of the specific property for this |
190 |
# point |
# point |
191 |
if shapetype == SHAPETYPE_POINT: |
if shapetype == SHAPETYPE_POINT and field is not None: |
192 |
value = table.ReadValue(shape.ShapeID(), field) |
value = table.ReadValue(shape.ShapeID(), field) |
193 |
group = lc.FindGroup(value) |
group = lc.FindGroup(value) |
194 |
size = group.GetProperties().GetSize() |
size = group.GetProperties().GetSize() |
290 |
self.shifty = (mmaxy - mminy)*0.5 - (ury - lly)*0.5 |
self.shifty = (mmaxy - mminy)*0.5 - (ury - lly)*0.5 |
291 |
|
|
292 |
self.offset = (offx+self.shiftx, offy+self.shifty) |
self.offset = (offx+self.shiftx, offy+self.shifty) |
293 |
|
self.region = (llx + self.shiftx, lly + self.shifty, urx, ury) |
294 |
|
|
295 |
# Draw the map |
# Draw the map |
296 |
self.dc.BeginDrawing() |
self.dc.BeginDrawing() |