瀏覽代碼

r.proj: add descriptions for method

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45140 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 年之前
父節點
當前提交
81a9d49854
共有 6 個文件被更改,包括 120 次插入18 次删除
  1. 1 1
      grasslib.dox
  2. 53 0
      gui/wxpython/gui_modules/gdialogs.py
  3. 25 5
      gui/wxpython/gui_modules/layertree.py
  4. 4 1
      lib/psdriver/Makefile
  5. 5 5
      lib/vector/Vlib/write.c
  6. 32 6
      raster/r.proj/main.c

+ 1 - 1
grasslib.dox

@@ -96,7 +96,7 @@ undocumented.</i>
  - ogsf:	\ref ogsflib (OpenGL (R) ported gsurf library (required for NVIZ))
  - ogsf:	\ref ogsflib (OpenGL (R) ported gsurf library (required for NVIZ))
  - pngdriver:   PNG display driver library - \ref pngdriver
  - pngdriver:   PNG display driver library - \ref pngdriver
  - proj:	\ref projlib (wrapper to PROJ4 projection library)
  - proj:	\ref projlib (wrapper to PROJ4 projection library)
- - psdriver:    PostScript display driver library - \ref psdriver
+ - psdriver:    \ref psdriver
  - python:      \ref pythonlib
  - python:      \ref pythonlib
  - raster:	\ref rasterlib
  - raster:	\ref rasterlib
  - rowio:	\ref rowiolib
  - rowio:	\ref rowiolib

+ 53 - 0
gui/wxpython/gui_modules/gdialogs.py

@@ -19,6 +19,7 @@ List of classes:
  - SetOpacityDialog
  - SetOpacityDialog
  - StaticWrapText
  - StaticWrapText
  - ImageSizeDialog
  - ImageSizeDialog
+ - SqlQueryFrame
 
 
 (C) 2008-2011 by the GRASS Development Team
 (C) 2008-2011 by the GRASS Development Team
 
 
@@ -1672,3 +1673,55 @@ class ImageSizeDialog(wx.Dialog):
         self.width.SetValue(width)
         self.width.SetValue(width)
         self.height.SetValue(height)
         self.height.SetValue(height)
         
         
+class SqlQueryFrame(wx.Frame):
+    def __init__(self, parent, id = wx.ID_ANY,
+                 title = _("GRASS GIS SQL Query Utility"),
+                 *kwargs):
+        """!SQL Query Utility window
+        """
+        self.parent = parent
+
+        wx.Frame.__init__(self, parent = parent, id = id, title = title, *kwargs)
+        self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass_sql.ico'), wx.BITMAP_TYPE_ICO))
+        self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
+        
+        self.sqlBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
+                                   label = _(" SQL statement "))
+        self.sql = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY,
+                               style = wx.TE_MULTILINE)
+        
+        self.btnApply = wx.Button(parent = self.panel, id = wx.ID_APPLY)
+        self.btnCancel = wx.Button(parent = self.panel, id = wx.ID_CANCEL)
+        self.Bind(wx.EVT_BUTTON, self.OnCloseWindow, self.btnCancel)
+        
+        self._layout()
+
+        self.SetMinSize(wx.Size(300, 150))
+        self.SetSize(wx.Size(500, 200))
+        
+    def _layout(self):
+        """!Do layout"""
+        sizer = wx.BoxSizer(wx.VERTICAL)
+        
+        sqlSizer = wx.StaticBoxSizer(self.sqlBox, wx.HORIZONTAL)
+        sqlSizer.Add(item = self.sql, proportion = 1,
+                     flag = wx.EXPAND)
+
+        btnSizer = wx.StdDialogButtonSizer()
+        btnSizer.AddButton(self.btnApply)
+        btnSizer.AddButton(self.btnCancel)
+        btnSizer.Realize()
+        
+        sizer.Add(item = sqlSizer, proportion = 1,
+                  flag = wx.EXPAND | wx.ALL, border = 5) 
+        sizer.Add(item = btnSizer, proportion = 0,
+                  flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
+       
+        self.panel.SetSizer(sizer)
+        
+        self.Layout()
+
+    def OnCloseWindow(self, event):
+        """!Close window
+        """
+        self.Close()

+ 25 - 5
gui/wxpython/gui_modules/layertree.py

@@ -260,7 +260,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             for key in ('remove', 'rename', 'opacity', 'nviz', 'zoom',
             for key in ('remove', 'rename', 'opacity', 'nviz', 'zoom',
                         'region', 'export', 'attr', 'edit0', 'edit1',
                         'region', 'export', 'attr', 'edit0', 'edit1',
                         'bgmap', 'topo', 'meta', 'null', 'zoom1', 'region1',
                         'bgmap', 'topo', 'meta', 'null', 'zoom1', 'region1',
-                        'color', 'hist', 'prof', 'properties'):
+                        'color', 'hist', 'prof', 'properties', 'sql'):
                 self.popupID[key] = wx.NewId()
                 self.popupID[key] = wx.NewId()
         
         
         self.popupMenu = wx.Menu()
         self.popupMenu = wx.Menu()
@@ -338,6 +338,18 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.popupMenu.Append(self.popupID['topo'], text = _("Rebuild topology"))
             self.popupMenu.Append(self.popupID['topo'], text = _("Rebuild topology"))
             self.Bind(wx.EVT_MENU, self.OnTopology, id = self.popupID['topo'])
             self.Bind(wx.EVT_MENU, self.OnTopology, id = self.popupID['topo'])
 
 
+            # determine format
+            if layer and layer.GetType() == 'vector':
+                if not self.GetPyData(self.layer_selected)[0].has_key('info'):
+                    info = grass.parse_command('v.info',
+                                               map = layer.GetName(),
+                                               shell = 'basic')
+                    self.GetPyData(self.layer_selected)[0]['info'] = info
+                info = self.GetPyData(self.layer_selected)[0]['info']
+                if info and info['format'] == 'ogr,PostgreSQL':
+                    self.popupMenu.Append(self.popupID['sql'], text = _("SQL Spatial Query"))
+                    self.Bind(wx.EVT_MENU, self.OnSqlQuery, id = self.popupID['sql'])
+            
             if layer.GetMapset() != grass.gisenv()['MAPSET']:
             if layer.GetMapset() != grass.gisenv()['MAPSET']:
                 # only vector map in current mapset can be edited
                 # only vector map in current mapset can be edited
                 self.popupMenu.Enable (self.popupID['edit0'], False)
                 self.popupMenu.Enable (self.popupID['edit0'], False)
@@ -411,6 +423,13 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                'map=%s' % mapLayer.GetName()]
                'map=%s' % mapLayer.GetName()]
         self.lmgr.goutput.RunCmd(cmd, switchPage = True)
         self.lmgr.goutput.RunCmd(cmd, switchPage = True)
         
         
+    def OnSqlQuery(self, event):
+        """!Show SQL query window for PostGIS layers
+        """
+        dlg = gdialogs.SqlQueryFrame(parent = self)
+        dlg.CentreOnScreen()
+        dlg.Show()
+        
     def OnMetadata(self, event):
     def OnMetadata(self, event):
         """!Print metadata of raster/vector map layer
         """!Print metadata of raster/vector map layer
         TODO: Dialog to modify metadata
         TODO: Dialog to modify metadata
@@ -1349,7 +1368,8 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         
         
         
         
     def GetOptData(self, dcmd, layer, params, propwin):
     def GetOptData(self, dcmd, layer, params, propwin):
-        """!Process layer data (when changes in propertiesdialog are applied)"""
+        """!Process layer data (when changes in properties dialog are applied)
+        """
         # set layer text to map name
         # set layer text to map name
         if dcmd:
         if dcmd:
             self.GetPyData(layer)[0]['cmd'] = dcmd
             self.GetPyData(layer)[0]['cmd'] = dcmd
@@ -1369,7 +1389,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                 GWarning(parent = self,
                 GWarning(parent = self,
                          message = _("Map <%s> not found.") % mapName)
                          message = _("Map <%s> not found.") % mapName)
                 return
                 return
-            
+        
         # update layer data
         # update layer data
         if params:
         if params:
             self.SetPyData(layer, (self.GetPyData(layer)[0], params))
             self.SetPyData(layer, (self.GetPyData(layer)[0], params))
@@ -1377,7 +1397,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         
         
         # change parameters for item in layers list in render.Map
         # change parameters for item in layers list in render.Map
         self.ChangeLayer(layer)
         self.ChangeLayer(layer)
-
+        
         # set region if auto-zooming is enabled
         # set region if auto-zooming is enabled
         if dcmd and UserSettings.Get(group = 'display', key = 'autoZooming', subkey = 'enabled'):
         if dcmd and UserSettings.Get(group = 'display', key = 'autoZooming', subkey = 'enabled'):
             mapLayer = self.GetPyData(layer)[0]['maplayer']
             mapLayer = self.GetPyData(layer)[0]['maplayer']
@@ -1385,7 +1405,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                 render = UserSettings.Get(group = 'display', key = 'autoRendering', subkey = 'enabled')
                 render = UserSettings.Get(group = 'display', key = 'autoRendering', subkey = 'enabled')
                 self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
                 self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
                                                     render = render)
                                                     render = render)
-
+        
         # update nviz session        
         # update nviz session        
         if self.mapdisplay.toolbars['nviz'] and dcmd:
         if self.mapdisplay.toolbars['nviz'] and dcmd:
             mapLayer = self.GetPyData(layer)[0]['maplayer']
             mapLayer = self.GetPyData(layer)[0]['maplayer']

+ 4 - 1
lib/psdriver/Makefile

@@ -1,13 +1,16 @@
 MODULE_TOPDIR = ../..
 MODULE_TOPDIR = ../..
 
 
-EXTRA_CFLAGS=-I../driver
+EXTRA_CFLAGS = -I../driver
 
 
 LIB = PSDRIVER
 LIB = PSDRIVER
 PGM = psdriver
 PGM = psdriver
 
 
 include $(MODULE_TOPDIR)/include/Make/Lib.make
 include $(MODULE_TOPDIR)/include/Make/Lib.make
+include $(MODULE_TOPDIR)/include/Make/Doxygen.make
 
 
 default: lib $(ETC)/psdriver.ps
 default: lib $(ETC)/psdriver.ps
 
 
 $(ETC)/psdriver.ps: psdriver.ps
 $(ETC)/psdriver.ps: psdriver.ps
 	$(INSTALL_DATA) $< $@
 	$(INSTALL_DATA) $< $@
+
+DOXNAME = psdriver

+ 5 - 5
lib/vector/Vlib/write.c

@@ -186,14 +186,13 @@ Vect_write_line(struct Map_info *Map, int type,
    \return feature offset
    \return feature offset
    \return -1 on error
    \return -1 on error
  */
  */
-off_t
-Vect_rewrite_line(struct Map_info *Map, int line, int type,
-              const struct line_pnts *points, const struct line_cats *cats)
+off_t Vect_rewrite_line(struct Map_info *Map, int line, int type,
+			const struct line_pnts *points, const struct line_cats *cats)
 {
 {
     off_t ret, offset;
     off_t ret, offset;
-
+    
     G_debug(3, "Vect_rewrite_line(): name = %s, line = %d", Map->name, line);
     G_debug(3, "Vect_rewrite_line(): name = %s, line = %d", Map->name, line);
-
+    fprintf(stderr, "%s", Map->head);
     if (!VECT_OPEN(Map))
     if (!VECT_OPEN(Map))
 	G_fatal_error(_("Unable to rewrite feature, vector map is not opened"));
 	G_fatal_error(_("Unable to rewrite feature, vector map is not opened"));
 
 
@@ -204,6 +203,7 @@ Vect_rewrite_line(struct Map_info *Map, int line, int type,
     }
     }
 
 
     offset = Map->plus.Line[line]->offset;
     offset = Map->plus.Line[line]->offset;
+    G_debug(3, "   offset=%lu", Map->plus.Line[line]->offset);
     ret =
     ret =
 	(*Vect_rewrite_line_array[Map->format][Map->level]) (Map, line, type, offset,
 	(*Vect_rewrite_line_array[Map->format][Map->level]) (Map, line, type, offset,
 							     points, cats);
 							     points, cats);

+ 32 - 6
raster/r.proj/main.c

@@ -17,7 +17,7 @@
 *	        one of three different methods: nearest neighbor, bilinear and
 *	        one of three different methods: nearest neighbor, bilinear and
 *	        cubic convolution.
 *	        cubic convolution.
 *
 *
-* COPYRIGHT:    (C) 2001 by the GRASS Development Team
+* COPYRIGHT:    (C) 2001, 2011 by the GRASS Development Team
 *
 *
 *               This program is free software under the GNU General Public
 *               This program is free software under the GNU General Public
 *               License (>=v2). Read the file COPYING that comes with GRASS
 *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -77,6 +77,7 @@ struct menu menu[] = {
 };
 };
 
 
 static char *make_ipol_list(void);
 static char *make_ipol_list(void);
+static char *make_ipol_desc(void);
 
 
 int main(int argc, char **argv)
 int main(int argc, char **argv)
 {
 {
@@ -146,7 +147,7 @@ int main(int argc, char **argv)
     G_add_keyword(_("projection"));
     G_add_keyword(_("projection"));
     G_add_keyword(_("transformation"));
     G_add_keyword(_("transformation"));
     module->description =
     module->description =
-	_("Re-projects a raster map from one location to the current location.");
+	_("Re-projects a raster map from given location to the current location.");
 
 
     inmap = G_define_standard_option(G_OPT_R_INPUT);
     inmap = G_define_standard_option(G_OPT_R_INPUT);
     inmap->description = _("Name of input raster map to re-project");
     inmap->description = _("Name of input raster map to re-project");
@@ -162,7 +163,8 @@ int main(int argc, char **argv)
     inlocation->key_desc = "name";
     inlocation->key_desc = "name";
 
 
     imapset = G_define_standard_option(G_OPT_M_MAPSET);
     imapset = G_define_standard_option(G_OPT_M_MAPSET);
-    imapset->description = _("Mapset containing input raster map");
+    imapset->label = _("Mapset containing input raster map");
+    imapset->description = _("default: name of current mapset");
     imapset->guisection = _("Source");
     imapset->guisection = _("Source");
 
 
     indbase = G_define_option();
     indbase = G_define_option();
@@ -176,7 +178,7 @@ int main(int argc, char **argv)
 
 
     outmap = G_define_standard_option(G_OPT_R_OUTPUT);
     outmap = G_define_standard_option(G_OPT_R_OUTPUT);
     outmap->required = NO;
     outmap->required = NO;
-    outmap->description = _("Name for output raster map (default: input)");
+    outmap->description = _("Name for output raster map (default: same as 'input')");
     outmap->guisection = _("Target");
     outmap->guisection = _("Target");
 
 
     ipolname = make_ipol_list();
     ipolname = make_ipol_list();
@@ -189,6 +191,7 @@ int main(int argc, char **argv)
     interpol->options = ipolname;
     interpol->options = ipolname;
     interpol->description = _("Interpolation method to use");
     interpol->description = _("Interpolation method to use");
     interpol->guisection = _("Target");
     interpol->guisection = _("Target");
+    interpol->descriptions = make_ipol_desc();
 
 
     memory = G_define_option();
     memory = G_define_option();
     memory->key = "memory";
     memory->key = "memory";
@@ -200,7 +203,7 @@ int main(int argc, char **argv)
     res->key = "resolution";
     res->key = "resolution";
     res->type = TYPE_DOUBLE;
     res->type = TYPE_DOUBLE;
     res->required = NO;
     res->required = NO;
-    res->description = _("Resolution of output map");
+    res->description = _("Resolution of output raster map");
     res->guisection = _("Target");
     res->guisection = _("Target");
 
 
     list = G_define_flag();
     list = G_define_flag();
@@ -536,7 +539,7 @@ int main(int argc, char **argv)
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }
 
 
-static char *make_ipol_list(void)
+char *make_ipol_list(void)
 {
 {
     int size = 0;
     int size = 0;
     int i;
     int i;
@@ -556,3 +559,26 @@ static char *make_ipol_list(void)
 
 
     return buf;
     return buf;
 }
 }
+
+char *make_ipol_desc(void)
+{
+    int size = 0;
+    int i;
+    char *buf;
+
+    for (i = 0; menu[i].name; i++)
+	size += strlen(menu[i].name) + strlen(menu[i].text) + 2;
+    
+    buf = G_malloc(size);
+    *buf = '\0';
+    
+    for (i = 0; menu[i].name; i++) {
+	if (i)
+	    strcat(buf, ";");
+	strcat(buf, menu[i].name);
+	strcat(buf, ";");
+	strcat(buf, menu[i].text);
+    }
+
+    return buf;
+}