Bläddra i källkod

wxGUI: fix georectify tool (i.rectify)
i.rectify message cosmetics + i18n
(merge from devbr6, https://trac.osgeo.org/grass/changeset/34202, https://trac.osgeo.org/grass/changeset/34250)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@34251 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 år sedan
förälder
incheckning
32d86392d5

+ 12 - 2
gui/wxpython/gui_modules/georect.py

@@ -24,12 +24,14 @@ import os
 import sys
 import sys
 import tempfile
 import tempfile
 import shutil
 import shutil
+import time
 
 
 import wx
 import wx
 from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin, TextEditMixin
 from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin, TextEditMixin
 import wx.lib.colourselect as  csel
 import wx.lib.colourselect as  csel
 import wx.wizard as wiz
 import wx.wizard as wiz
 
 
+import grass
 import globalvar
 import globalvar
 import mapdisp
 import mapdisp
 import render
 import render
@@ -817,7 +819,13 @@ class GCP(wx.Frame):
             mapWin.polypen = wx.Pen(colour=wxCol, width=wpx, style=wx.SOLID) # ?
             mapWin.polypen = wx.Pen(colour=wxCol, width=wpx, style=wx.SOLID) # ?
             coord = mapWin.Cell2Pixel((gcp[coordtype][0], gcp[coordtype][1]))
             coord = mapWin.Cell2Pixel((gcp[coordtype][0], gcp[coordtype][1]))
             mapWin.DrawCross(pdc=mapWin.pdcTmp, coords=coord,
             mapWin.DrawCross(pdc=mapWin.pdcTmp, coords=coord,
-                             size=5, text=('%s' % str(idx + 1), font, wxCol, 0.0))
+                             size=5, text={ 'text' : '%s' % str(idx + 1),
+                                            'font' : font,
+                                            'color': wxCol,
+                                            'coords': [coord[0] + 5,
+                                                       coord[1] + 5,
+                                                       5,
+                                                       5]})
             
             
             idx += 1
             idx += 1
             
             
@@ -990,8 +998,10 @@ class GCP(wx.Frame):
             if self.clip_to_region:
             if self.clip_to_region:
                 cmdlist.append('-c')
                 cmdlist.append('-c')
             
             
-            self.parent.goutput.RunCmd(cmdlist)
+            self.parent.goutput.RunCmd(cmdlist, compReg=False,
+                                       switchPage=True)
 
 
+            time.sleep(.1)
             self.grwiz.SwitchEnv('original')
             self.grwiz.SwitchEnv('original')
 
 
         elif maptype == 'vector':
         elif maptype == 'vector':

+ 29 - 15
gui/wxpython/gui_modules/mapdisp.py

@@ -418,7 +418,10 @@ class BufferedWindow(MapWindow, wx.Window):
                 # self.ovlcoords[drawid] = coords
                 # self.ovlcoords[drawid] = coords
 
 
         elif pdctype == 'text': # draw text on top of map
         elif pdctype == 'text': # draw text on top of map
-            rotation = float(img['rotation'])
+            if img.has_key('rotation'):
+                rotation = float(img['rotation'])
+            else:
+                rotation = 0.0
             w, h = self.GetFullTextExtent(img['text'])[0:2]
             w, h = self.GetFullTextExtent(img['text'])[0:2]
             pdc.SetFont(img['font'])
             pdc.SetFont(img['font'])
             pdc.SetTextForeground(img['color'])
             pdc.SetTextForeground(img['color'])
@@ -442,7 +445,11 @@ class BufferedWindow(MapWindow, wx.Window):
         @param textinfo text metadata (text, font, color, rotation)
         @param textinfo text metadata (text, font, color, rotation)
         @param coords reference point
         @param coords reference point
         """
         """
-        rotation = float(textinfo['rotation'])
+        if textinfo.has_key('rotation'):
+            rotation = float(textinfo['rotation'])
+        else:
+            rotation = 0.0
+        
         coords = textinfo['coords']
         coords = textinfo['coords']
         
         
         Debug.msg (4, "BufferedWindow.TextBounds(): text=%s, rotation=%f" % \
         Debug.msg (4, "BufferedWindow.TextBounds(): text=%s, rotation=%f" % \
@@ -673,11 +680,13 @@ class BufferedWindow(MapWindow, wx.Window):
         #
         #
         
         
         # update layer dictionary if there has been a change in layers
         # update layer dictionary if there has been a change in layers
-        if self.tree.reorder == True:
+        if self.tree and self.tree.reorder == True:
             self.tree.ReorderLayers()
             self.tree.ReorderLayers()
             
             
         # reset flag for auto-rendering
         # reset flag for auto-rendering
-        self.tree.rerender = False
+        if self.tree:
+            self.tree.rerender = False
+        
         if render:
         if render:
             # update display size
             # update display size
             self.Map.ChangeMapSize(self.GetClientSize())
             self.Map.ChangeMapSize(self.GetClientSize())
@@ -2931,9 +2940,10 @@ class MapFrame(wx.Frame):
 
 
     def OnPointer(self, event):
     def OnPointer(self, event):
         """Pointer button clicked"""
         """Pointer button clicked"""
-        if event:
-            self.toolbars['map'].OnTool(event)
-        self.toolbars['map'].action['desc'] = ''
+        if self.toolbars['map']:
+            if event:
+                self.toolbars['map'].OnTool(event)
+            self.toolbars['map'].action['desc'] = ''
         
         
         self.MapWindow.mouse['use'] = "pointer"
         self.MapWindow.mouse['use'] = "pointer"
         self.MapWindow.mouse['box'] = "point"
         self.MapWindow.mouse['box'] = "point"
@@ -2967,8 +2977,9 @@ class MapFrame(wx.Frame):
         Zoom in the map.
         Zoom in the map.
         Set mouse cursor, zoombox attributes, and zoom direction
         Set mouse cursor, zoombox attributes, and zoom direction
         """
         """
-        self.toolbars['map'].OnTool(event)
-        self.toolbars['map'].action['desc'] = ''
+        if self.toolbars['map']:
+            self.toolbars['map'].OnTool(event)
+            self.toolbars['map'].action['desc'] = ''
         
         
         self.MapWindow.mouse['use'] = "zoom"
         self.MapWindow.mouse['use'] = "zoom"
         self.MapWindow.mouse['box'] = "box"
         self.MapWindow.mouse['box'] = "box"
@@ -2983,8 +2994,9 @@ class MapFrame(wx.Frame):
         Zoom out the map.
         Zoom out the map.
         Set mouse cursor, zoombox attributes, and zoom direction
         Set mouse cursor, zoombox attributes, and zoom direction
         """
         """
-        self.toolbars['map'].OnTool(event)
-        self.toolbars['map'].action['desc'] = ''
+        if self.toolbars['map']:
+            self.toolbars['map'].OnTool(event)
+            self.toolbars['map'].action['desc'] = ''
         
         
         self.MapWindow.mouse['use'] = "zoom"
         self.MapWindow.mouse['use'] = "zoom"
         self.MapWindow.mouse['box'] = "box"
         self.MapWindow.mouse['box'] = "box"
@@ -3004,8 +3016,9 @@ class MapFrame(wx.Frame):
         """
         """
         Panning, set mouse to drag
         Panning, set mouse to drag
         """
         """
-        self.toolbars['map'].OnTool(event)
-        self.toolbars['map'].action['desc'] = ''
+        if self.toolbars['map']:
+            self.toolbars['map'].OnTool(event)
+            self.toolbars['map'].action['desc'] = ''
         
         
         self.MapWindow.mouse['use'] = "pan"
         self.MapWindow.mouse['use'] = "pan"
         self.MapWindow.mouse['box'] = "pan"
         self.MapWindow.mouse['box'] = "pan"
@@ -3510,8 +3523,9 @@ class MapFrame(wx.Frame):
 
 
     def OnQuery(self, event):
     def OnQuery(self, event):
         """Query tools menu"""
         """Query tools menu"""
-        self.toolbars['map'].OnTool(event)
-        action = self.toolbars['map'].GetAction()
+        if self.toolbars['map']:
+            self.toolbars['map'].OnTool(event)
+            action = self.toolbars['map'].GetAction()
         
         
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
         toolsmenu = wx.Menu()
         toolsmenu = wx.Menu()

+ 2 - 1
gui/wxpython/gui_modules/menuform.py

@@ -829,7 +829,8 @@ class mainFrame(wx.Frame):
     def OnCancel(self, event):
     def OnCancel(self, event):
         """Cancel button pressed"""
         """Cancel button pressed"""
         self.MakeModal(False)
         self.MakeModal(False)
-        if self.get_dcmd:
+        if self.get_dcmd and \
+                hasattr(self.parent, "GetPyData"):
             # display decorations and 
             # display decorations and 
             # pressing OK or cancel after setting layer properties
             # pressing OK or cancel after setting layer properties
             if self.task.name in ['d.barscale','d.legend','d.histogram'] \
             if self.task.name in ['d.barscale','d.legend','d.histogram'] \

+ 9 - 7
imagery/i.rectify/cp.c

@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 #include "crs.h"		/* CRS HEADER FILE */
 #include "crs.h"		/* CRS HEADER FILE */
 int get_control_points(char *group, int order	/* THIS HAS BEEN ADDED WITH THE CRS MODIFICATIONS */
 int get_control_points(char *group, int order	/* THIS HAS BEEN ADDED WITH THE CRS MODIFICATIONS */
@@ -11,24 +12,24 @@ int get_control_points(char *group, int order	/* THIS HAS BEEN ADDED WITH THE CR
     if (!I_get_control_points(group, &cp))
     if (!I_get_control_points(group, &cp))
 	exit(0);
 	exit(0);
 
 
-    sprintf(msg, "Control Point file for group [%s] in [%s] - ",
+    sprintf(msg, _("Control Point file for group <%s@%s> - "),
 	    group, G_mapset());
 	    group, G_mapset());
 
 
     switch (CRS_compute_georef_equations(&cp, E12, N12, E21, N21, order)) {
     switch (CRS_compute_georef_equations(&cp, E12, N12, E21, N21, order)) {
     case 0:
     case 0:
 	sprintf(&msg[strlen(msg)],
 	sprintf(&msg[strlen(msg)],
-		"Not enough active control points for current order, %d are required.",
+		_("Not enough active control points for current order, %d are required."),
 		(order + 1) * (order + 2) / 2);
 		(order + 1) * (order + 2) / 2);
 	break;
 	break;
     case -1:
     case -1:
-	strcat(msg, "Poorly placed control points.");
-	strcat(msg, " Can not generate the transformation equation.");
+	strcat(msg, _("Poorly placed control points."));
+	strcat(msg, _(" Can not generate the transformation equation."));
 	break;
 	break;
     case -2:
     case -2:
-	strcat(msg, "Not enough memory to solve for transformation equation");
+	strcat(msg, _("Not enough memory to solve for transformation equation"));
 	break;
 	break;
     case -3:
     case -3:
-	strcat(msg, "Invalid order");
+	strcat(msg, _("Invalid order"));
 	break;
 	break;
     default:
     default:
 	/* COMMENTED OUT WHEN SUPPORT FOR 3rd ORDER WAS ADDED BY 'CRS'
 	/* COMMENTED OUT WHEN SUPPORT FOR 3rd ORDER WAS ADDED BY 'CRS'
@@ -40,5 +41,6 @@ int get_control_points(char *group, int order	/* THIS HAS BEEN ADDED WITH THE CR
 	return 1;
 	return 1;
     }
     }
     G_fatal_error(msg);
     G_fatal_error(msg);
-    exit(1);
+
+    return 0; /* G_fatal_error() calls exit() */
 }
 }

+ 3 - 2
imagery/i.rectify/exec.c

@@ -13,6 +13,7 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <time.h>
 #include <time.h>
 #include <unistd.h>
 #include <unistd.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 
 
 int exec_rectify(int order, char *extension)
 int exec_rectify(int order, char *extension)
@@ -50,8 +51,8 @@ int exec_rectify(int order, char *extension)
 		G_malloc(strlen(ref.file[n].name) + strlen(extension) + 1);
 		G_malloc(strlen(ref.file[n].name) + strlen(extension) + 1);
 	    strcpy(result, ref.file[n].name);
 	    strcpy(result, ref.file[n].name);
 	    strcat(result, extension);
 	    strcat(result, extension);
-	    fprintf(stderr, "Rectified input file %s will be saved as %s\n",
-		    name, result);
+	    G_message(_("Rectified input raster map <%s> will be saved as <%s>"),
+		      name, result);
 
 
 	    select_current_env();
 	    select_current_env();
 
 

+ 3 - 2
imagery/i.rectify/get_wind.c

@@ -1,3 +1,4 @@
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 #include "crs.h"		/* CRS HEADER FILE */
 #include "crs.h"		/* CRS HEADER FILE */
 
 
@@ -42,9 +43,9 @@ int georef_window(struct Cell_head *w1, struct Cell_head *w2, int order)
     w2->ns_res = (w2->north - w2->south) / w1->rows;
     w2->ns_res = (w2->north - w2->south) / w1->rows;
     w2->ew_res = (w2->east - w2->west) / w1->cols;
     w2->ew_res = (w2->east - w2->west) / w1->cols;
 
 
-    fprintf(stderr, "Region N=%f S=%f E=%f W=%f\n", w2->north, w2->south,
+    G_message(_("Region N=%f S=%f E=%f W=%f"), w2->north, w2->south,
 	    w2->east, w2->west);
 	    w2->east, w2->west);
-    fprintf(stderr, "Resolution EW=%f NS=%f\n", w2->ew_res, w2->ns_res);
+    G_message(_("Resolution EW=%f NS=%f"), w2->ew_res, w2->ns_res);
 
 
     return 0;
     return 0;
 }
 }

+ 8 - 7
imagery/i.rectify/main.c

@@ -24,9 +24,10 @@
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 #include "crs.h"
 #include "crs.h"
-#include <grass/glocale.h>
+
 
 
 ROWCOL row_map[NROWS][NCOLS];
 ROWCOL row_map[NROWS][NCOLS];
 ROWCOL col_map[NROWS][NCOLS];
 ROWCOL col_map[NROWS][NCOLS];
@@ -80,11 +81,11 @@ int main(int argc, char *argv[])
     G_gisinit(argv[0]);
     G_gisinit(argv[0]);
 
 
     module = G_define_module();
     module = G_define_module();
-    module->keywords = _("imagery");
+    module->keywords = _("imagery, rectify");
     module->description =
     module->description =
 	_("Rectifies an image by computing a coordinate "
 	_("Rectifies an image by computing a coordinate "
 	  "transformation for each pixel in the image based on the "
 	  "transformation for each pixel in the image based on the "
-	  "control points");
+	  "control points.");
 
 
     grp = G_define_standard_option(G_OPT_I_GROUP);
     grp = G_define_standard_option(G_OPT_I_GROUP);
 
 
@@ -107,7 +108,7 @@ int main(int argc, char *argv[])
     c = G_define_flag();
     c = G_define_flag();
     c->key = 'c';
     c->key = 'c';
     c->description =
     c->description =
-	_("Use curr. region settings in target location (def.=calculate smallest area)");
+	_("Use current region settings in target location (def.=calculate smallest area)");
 
 
     a = G_define_flag();
     a = G_define_flag();
     a->key = 'a';
     a->key = 'a';
@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
 	georef_window(&cellhd, &target_window, order);
 	georef_window(&cellhd, &target_window, order);
     }
     }
 
 
-    G_message(_("Using Region: N=%f S=%f, E=%f W=%f"), target_window.north,
+    G_verbose_message(_("Using region: N=%f S=%f, E=%f W=%f"), target_window.north,
 	      target_window.south, target_window.east, target_window.west);
 	      target_window.south, target_window.east, target_window.west);
 
 
     exec_rectify(order, extension);
     exec_rectify(order, extension);
@@ -215,11 +216,11 @@ void err_exit(char *file, char *grp)
     int n;
     int n;
 
 
     fprintf(stderr,
     fprintf(stderr,
-	    "Input raster map <%s> does not exist in group <%s>.\n Try:\n",
+	    _("Input raster map <%s> does not exist in group <%s>.\n Try:\n"),
 	    file, grp);
 	    file, grp);
 
 
     for (n = 0; n < ref.nfiles; n++)
     for (n = 0; n < ref.nfiles; n++)
 	fprintf(stderr, "%s\n", ref.file[n].name);
 	fprintf(stderr, "%s\n", ref.file[n].name);
 
 
-    G_fatal_error("Exit!");
+    G_fatal_error(_("Exit!"));
 }
 }

+ 5 - 7
imagery/i.rectify/rectify.c

@@ -1,4 +1,5 @@
 #include <unistd.h>
 #include <unistd.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 
 
 /* Modified to support Grass 5.0 fp format 11 april 2000
 /* Modified to support Grass 5.0 fp format 11 april 2000
@@ -90,17 +91,14 @@ int rectify(char *name, char *mapset, char *result, int order)
 
 
     if (target_window.proj != cellhd.proj) {
     if (target_window.proj != cellhd.proj) {
 	cellhd.proj = target_window.proj;
 	cellhd.proj = target_window.proj;
-	sprintf(buf,
-		"WARNING %s@%s: projection don't match current settings.\n",
-		name, mapset);
-	G_warning(buf);
+	G_warning(_("Raster map <%s@%s>: projection don't match current settings"),
+		  name, mapset);
     }
     }
 
 
     if (target_window.zone != cellhd.zone) {
     if (target_window.zone != cellhd.zone) {
 	cellhd.zone = target_window.zone;
 	cellhd.zone = target_window.zone;
-	sprintf(buf, "WARNING %s@%s: zone don't match current settings .\n",
-		name, mapset);
-	G_warning(buf);
+	G_warning(_("Raster map <%s@%s>: zone don't match current settings"),
+		  name, mapset);
     }
     }
 
 
     target_window.compressed = cellhd.compressed;
     target_window.compressed = cellhd.compressed;

+ 20 - 19
imagery/i.rectify/report.c

@@ -1,3 +1,4 @@
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 
 
 int report(char *name, char *mapset, char *result,
 int report(char *name, char *mapset, char *result,
@@ -8,14 +9,11 @@ int report(char *name, char *mapset, char *result,
     long ncells;
     long ncells;
 
 
     select_current_env();
     select_current_env();
-    fprintf(stderr, "***********************************************\n");
-    fprintf(stderr, "Rectify [%s@%s] (LOCATION %s)\n",
-	    name, mapset, G_location());
-    fprintf(stderr, " into  [%s in ", result);
+    G_message(_("Rectify <%s@%s> (location <%s>)"),
+	      name, mapset, G_location());
     select_target_env();
     select_target_env();
-    fprintf(stderr, "%s] (LOCATION %s)\n", G_mapset(), G_location());
-    fprintf(stderr, "%s\n", ok ? "complete" : "failed");
-    fprintf(stderr, "-----------------------------------------------\n");
+    G_message(_("into  <%s@%s> (location <%s>) ... %s"),
+	      result, G_mapset(), G_location(), ok ? _("complete") : _("failed"));
     select_current_env();
     select_current_env();
 
 
     if (!ok)
     if (!ok)
@@ -26,30 +24,33 @@ int report(char *name, char *mapset, char *result,
     hours = minutes / 60;
     hours = minutes / 60;
     minutes -= hours * 60;
     minutes -= hours * 60;
     ncells = target_window.rows * target_window.cols;
     ncells = target_window.rows * target_window.cols;
-    fprintf(stderr, " %d rows, %d cols (%ld cells) completed in ",
-	    target_window.rows, target_window.cols, ncells);
+    G_verbose_message(_("%d rows, %d cols (%ld cells) completed in"),
+			target_window.rows, target_window.cols, ncells);
     if (hours)
     if (hours)
-	fprintf(stderr, "%d:%02d:%02ld\n", hours, minutes, seconds % 60);
+	G_verbose_message("%d:%02d:%02ld", hours, minutes, seconds % 60);
     else
     else
-	fprintf(stderr, "%d:%02ld\n", minutes, seconds % 60);
+	G_verbose_message("%d:%02ld", minutes, seconds % 60);
     if (seconds)
     if (seconds)
-	fprintf(stderr, " %.1f cells per minute\n",
-		(60.0 * ncells) / ((double)seconds));
-
-    fprintf(stderr, "\n");
+	G_verbose_message(_("%.1f cells per minute"),
+			  (60.0 * ncells) / ((double)seconds));
+		      
     seconds = compress;
     seconds = compress;
 
 
-    if (seconds <= 0)
+    if (seconds <= 0) {
+	G_message("-----------------------------------------------");
 	return 1;
 	return 1;
+    }
 
 
     minutes = seconds / 60;
     minutes = seconds / 60;
     hours = minutes / 60;
     hours = minutes / 60;
     minutes -= hours * 60;
     minutes -= hours * 60;
-    fprintf(stderr, " data compression required an additional ");
+    G_verbose_message(_("data compression required an additional"));
     if (hours)
     if (hours)
-	fprintf(stderr, "%d:%02d:%02ld\n", hours, minutes, seconds % 60);
+	G_verbose_message("%d:%02d:%02ld", hours, minutes, seconds % 60);
     else
     else
-	fprintf(stderr, "%d:%02ld\n", minutes, seconds % 60);
+	G_verbose_message("%d:%02ld\n", minutes, seconds % 60);
+
+    G_message("-----------------------------------------------");
 
 
     return 0;
     return 0;
 }
 }

+ 6 - 5
imagery/i.rectify/target.c

@@ -1,5 +1,6 @@
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 
 
 int get_target(char *group)
 int get_target(char *group)
@@ -10,13 +11,13 @@ int get_target(char *group)
     int stat;
     int stat;
 
 
     if (!I_get_target(group, location, mapset)) {
     if (!I_get_target(group, location, mapset)) {
-	sprintf(buf, "Target information for group [%s] missing\n", group);
+	sprintf(buf, _("Target information for group <%s> missing"), group);
 	goto error;
 	goto error;
     }
     }
 
 
     sprintf(buf, "%s/%s", G_gisdbase(), location);
     sprintf(buf, "%s/%s", G_gisdbase(), location);
     if (access(buf, 0) != 0) {
     if (access(buf, 0) != 0) {
-	sprintf(buf, "Target location [%s] not found\n", location);
+	sprintf(buf, _("Target location <%s> not found"), location);
 	goto error;
 	goto error;
     }
     }
     select_target_env();
     select_target_env();
@@ -28,10 +29,10 @@ int get_target(char *group)
 	select_current_env();
 	select_current_env();
 	return 1;
 	return 1;
     }
     }
-    sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
-    strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
+    sprintf(buf, _("Mapset <%s> in target location <%s> - "), mapset, location);
+    strcat(buf, stat == 0 ? _("permission denied") : _("not found"));
   error:
   error:
-    strcat(buf, "Please run i.target for group ");
+    strcat(buf, _("Please run i.target for group."));
     strcat(buf, group);
     strcat(buf, group);
     G_fatal_error(buf);
     G_fatal_error(buf);
     return 1;			/* never reached */
     return 1;			/* never reached */

+ 6 - 4
imagery/i.rectify/write.c

@@ -2,6 +2,7 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <unistd.h>
+#include <grass/glocale.h>
 #include "global.h"
 #include "global.h"
 
 
 int write_matrix(int row, int col)
 int write_matrix(int row, int col)
@@ -23,7 +24,7 @@ int write_matrix(int row, int col)
 	if (write(temp_fd, cell_buf[n], G_raster_size(map_type) * matrix_cols)
 	if (write(temp_fd, cell_buf[n], G_raster_size(map_type) * matrix_cols)
 	    != G_raster_size(map_type) * matrix_cols) {
 	    != G_raster_size(map_type) * matrix_cols) {
 	    unlink(temp_name);
 	    unlink(temp_name);
-	    G_fatal_error("error while writing to temp file");
+	    G_fatal_error(_("Error while writing to temp file"));
 	}
 	}
 	/*G_put_map_row_random (outfd, cell_buf[n], row++, col, matrix_cols); */
 	/*G_put_map_row_random (outfd, cell_buf[n], row++, col, matrix_cols); */
     }
     }
@@ -45,14 +46,15 @@ int write_map(char *name)
     fd = G_open_raster_new(name, map_type);
     fd = G_open_raster_new(name, map_type);
 
 
     if (fd <= 0)
     if (fd <= 0)
-	G_fatal_error("Can't open map %s", name);
+	G_fatal_error(_("Unable to create raster map <%s>"), name);
 
 
     for (row = 0; row < target_window.rows; row++) {
     for (row = 0; row < target_window.rows; row++) {
 	if (read(temp_fd, rast, target_window.cols * G_raster_size(map_type))
 	if (read(temp_fd, rast, target_window.cols * G_raster_size(map_type))
 	    != target_window.cols * G_raster_size(map_type))
 	    != target_window.cols * G_raster_size(map_type))
-	    G_fatal_error("error writing row %d", row);
+	    G_fatal_error(_("Error writing row %d"), row);
 	if (G_put_raster_row(fd, rast, map_type) < 0) {
 	if (G_put_raster_row(fd, rast, map_type) < 0) {
-	    G_fatal_error("error while writing to raster map");
+	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
+			  name, row);
 	    unlink(temp_name);
 	    unlink(temp_name);
 	}
 	}
     }
     }