[GRASS-SVN] r45140 - in grass/trunk: . gui/wxpython/gui_modules
lib/psdriver lib/vector/Vlib raster/r.proj
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 21 18:44:17 EST 2011
Author: martinl
Date: 2011-01-21 15:44:17 -0800 (Fri, 21 Jan 2011)
New Revision: 45140
Modified:
grass/trunk/grasslib.dox
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/gui_modules/layertree.py
grass/trunk/lib/psdriver/Makefile
grass/trunk/lib/vector/Vlib/write.c
grass/trunk/raster/r.proj/main.c
Log:
r.proj: add descriptions for method
Modified: grass/trunk/grasslib.dox
===================================================================
--- grass/trunk/grasslib.dox 2011-01-21 23:28:11 UTC (rev 45139)
+++ grass/trunk/grasslib.dox 2011-01-21 23:44:17 UTC (rev 45140)
@@ -96,7 +96,7 @@
- ogsf: \ref ogsflib (OpenGL (R) ported gsurf library (required for NVIZ))
- pngdriver: PNG display driver library - \ref pngdriver
- proj: \ref projlib (wrapper to PROJ4 projection library)
- - psdriver: PostScript display driver library - \ref psdriver
+ - psdriver: \ref psdriver
- python: \ref pythonlib
- raster: \ref rasterlib
- rowio: \ref rowiolib
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2011-01-21 23:28:11 UTC (rev 45139)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2011-01-21 23:44:17 UTC (rev 45140)
@@ -19,6 +19,7 @@
- SetOpacityDialog
- StaticWrapText
- ImageSizeDialog
+ - SqlQueryFrame
(C) 2008-2011 by the GRASS Development Team
@@ -1672,3 +1673,55 @@
self.width.SetValue(width)
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()
Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-01-21 23:28:11 UTC (rev 45139)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-01-21 23:44:17 UTC (rev 45140)
@@ -260,7 +260,7 @@
for key in ('remove', 'rename', 'opacity', 'nviz', 'zoom',
'region', 'export', 'attr', 'edit0', 'edit1',
'bgmap', 'topo', 'meta', 'null', 'zoom1', 'region1',
- 'color', 'hist', 'prof', 'properties'):
+ 'color', 'hist', 'prof', 'properties', 'sql'):
self.popupID[key] = wx.NewId()
self.popupMenu = wx.Menu()
@@ -338,6 +338,18 @@
self.popupMenu.Append(self.popupID['topo'], text = _("Rebuild topology"))
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']:
# only vector map in current mapset can be edited
self.popupMenu.Enable (self.popupID['edit0'], False)
@@ -411,6 +423,13 @@
'map=%s' % mapLayer.GetName()]
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):
"""!Print metadata of raster/vector map layer
TODO: Dialog to modify metadata
@@ -1349,7 +1368,8 @@
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
if dcmd:
self.GetPyData(layer)[0]['cmd'] = dcmd
@@ -1369,7 +1389,7 @@
GWarning(parent = self,
message = _("Map <%s> not found.") % mapName)
return
-
+
# update layer data
if params:
self.SetPyData(layer, (self.GetPyData(layer)[0], params))
@@ -1377,7 +1397,7 @@
# change parameters for item in layers list in render.Map
self.ChangeLayer(layer)
-
+
# set region if auto-zooming is enabled
if dcmd and UserSettings.Get(group = 'display', key = 'autoZooming', subkey = 'enabled'):
mapLayer = self.GetPyData(layer)[0]['maplayer']
@@ -1385,7 +1405,7 @@
render = UserSettings.Get(group = 'display', key = 'autoRendering', subkey = 'enabled')
self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
render = render)
-
+
# update nviz session
if self.mapdisplay.toolbars['nviz'] and dcmd:
mapLayer = self.GetPyData(layer)[0]['maplayer']
Modified: grass/trunk/lib/psdriver/Makefile
===================================================================
--- grass/trunk/lib/psdriver/Makefile 2011-01-21 23:28:11 UTC (rev 45139)
+++ grass/trunk/lib/psdriver/Makefile 2011-01-21 23:44:17 UTC (rev 45140)
@@ -1,13 +1,16 @@
MODULE_TOPDIR = ../..
-EXTRA_CFLAGS=-I../driver
+EXTRA_CFLAGS = -I../driver
LIB = PSDRIVER
PGM = psdriver
include $(MODULE_TOPDIR)/include/Make/Lib.make
+include $(MODULE_TOPDIR)/include/Make/Doxygen.make
default: lib $(ETC)/psdriver.ps
$(ETC)/psdriver.ps: psdriver.ps
$(INSTALL_DATA) $< $@
+
+DOXNAME = psdriver
Modified: grass/trunk/lib/vector/Vlib/write.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write.c 2011-01-21 23:28:11 UTC (rev 45139)
+++ grass/trunk/lib/vector/Vlib/write.c 2011-01-21 23:44:17 UTC (rev 45140)
@@ -186,14 +186,13 @@
\return feature offset
\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;
-
+
G_debug(3, "Vect_rewrite_line(): name = %s, line = %d", Map->name, line);
-
+ fprintf(stderr, "%s", Map->head);
if (!VECT_OPEN(Map))
G_fatal_error(_("Unable to rewrite feature, vector map is not opened"));
@@ -204,6 +203,7 @@
}
offset = Map->plus.Line[line]->offset;
+ G_debug(3, " offset=%lu", Map->plus.Line[line]->offset);
ret =
(*Vect_rewrite_line_array[Map->format][Map->level]) (Map, line, type, offset,
points, cats);
Modified: grass/trunk/raster/r.proj/main.c
===================================================================
--- grass/trunk/raster/r.proj/main.c 2011-01-21 23:28:11 UTC (rev 45139)
+++ grass/trunk/raster/r.proj/main.c 2011-01-21 23:44:17 UTC (rev 45140)
@@ -17,7 +17,7 @@
* one of three different methods: nearest neighbor, bilinear and
* 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
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -77,6 +77,7 @@
};
static char *make_ipol_list(void);
+static char *make_ipol_desc(void);
int main(int argc, char **argv)
{
@@ -146,7 +147,7 @@
G_add_keyword(_("projection"));
G_add_keyword(_("transformation"));
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->description = _("Name of input raster map to re-project");
@@ -162,7 +163,8 @@
inlocation->key_desc = "name";
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");
indbase = G_define_option();
@@ -176,7 +178,7 @@
outmap = G_define_standard_option(G_OPT_R_OUTPUT);
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");
ipolname = make_ipol_list();
@@ -189,6 +191,7 @@
interpol->options = ipolname;
interpol->description = _("Interpolation method to use");
interpol->guisection = _("Target");
+ interpol->descriptions = make_ipol_desc();
memory = G_define_option();
memory->key = "memory";
@@ -200,7 +203,7 @@
res->key = "resolution";
res->type = TYPE_DOUBLE;
res->required = NO;
- res->description = _("Resolution of output map");
+ res->description = _("Resolution of output raster map");
res->guisection = _("Target");
list = G_define_flag();
@@ -536,7 +539,7 @@
exit(EXIT_SUCCESS);
}
-static char *make_ipol_list(void)
+char *make_ipol_list(void)
{
int size = 0;
int i;
@@ -556,3 +559,26 @@
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;
+}
More information about the grass-commit
mailing list