[GRASS-SVN] r44188 - in grass/branches/develbranch_6:
gui/wxpython/gui_modules raster/r.proj raster/r.proj.seg
vector/v.proj
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 6 11:43:12 EDT 2010
Author: martinl
Date: 2010-11-06 08:43:12 -0700 (Sat, 06 Nov 2010)
New Revision: 44188
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
grass/branches/develbranch_6/raster/r.proj.seg/main.c
grass/branches/develbranch_6/raster/r.proj/main.c
grass/branches/develbranch_6/vector/v.proj/main.c
Log:
r.proj/v.proj: wxGUI interactivity improved (select input map from location)
(merge r44184-r44186 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2010-11-06 15:01:22 UTC (rev 44187)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2010-11-06 15:43:12 UTC (rev 44188)
@@ -12,11 +12,13 @@
- DriverSelect
- DatabaseSelect
- ColumnSelect
+ - DbaseSelect
- LocationSelect
- MapsetSelect
- SubGroupSelect
- FormatSelect
- GdalSelect
+ - ProjSelect
(C) 2007-2010 by the GRASS Development Team This program is free
software under the GNU General Public License (>=v2). Read the file
@@ -92,7 +94,7 @@
"""!Custom to create a ComboBox with a tree control to display and
select vector maps. Control allows to filter vector maps. If you
don't need this feature use Select class instead
-
+
@ftype filter vector maps based on feature type
"""
Select.__init__(self, parent = parent, id = wx.ID_ANY,
@@ -722,6 +724,16 @@
if self.param:
self.param['value'] = ''
+
+class DbaseSelect(wx.lib.filebrowsebutton.DirBrowseButton):
+ """!Widget for selecting GRASS Database"""
+ def __init__(self, parent, **kwargs):
+ super(DbaseSelect, self).__init__(parent, id = wx.ID_ANY,
+ size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
+ dialogTitle = _('Choose GIS Data Directory'),
+ buttonText = _('Browse'),
+ startDirectory = grass.gisenv()['GISDBASE'],
+ **kwargs)
class LocationSelect(wx.ComboBox):
"""!Widget for selecting GRASS location"""
@@ -729,16 +741,26 @@
gisdbase = None, **kwargs):
super(LocationSelect, self).__init__(parent, id, size = size,
style = wx.CB_READONLY, **kwargs)
-
self.SetName("LocationSelect")
if not gisdbase:
self.gisdbase = grass.gisenv()['GISDBASE']
else:
self.gisdbase = gisdbase
-
+
self.SetItems(utils.GetListOfLocations(self.gisdbase))
+ def UpdateItems(self, dbase):
+ """!Update list of locations
+
+ @param dbase path to GIS database
+ """
+ self.gisdbase = dbase
+ if dbase:
+ self.SetItems(utils.GetListOfLocations(self.gisdbase))
+ else:
+ self.SetItems([])
+
class MapsetSelect(wx.ComboBox):
"""!Widget for selecting GRASS mapset"""
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE,
@@ -747,7 +769,6 @@
style = wx.CB_READONLY, **kwargs)
self.SetName("MapsetSelect")
-
if not gisdbase:
self.gisdbase = grass.gisenv()['GISDBASE']
else:
@@ -761,6 +782,20 @@
if setItems:
self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True)) # selectable
+ def UpdateItems(self, location, dbase = None):
+ """!Update list of mapsets for given location
+
+ @param dbase path to GIS database (None to use currently selected)
+ @param location name of location
+ """
+ if dbase:
+ self.gisdbase = dbase
+ self.location = location
+ if location:
+ self.SetItems(utils.GetListOfMapsets(self.gisdbase, self.location, selectable = True))
+ else:
+ self.SetItems([])
+
class SubGroupSelect(wx.ComboBox):
"""!Widget for selecting subgroups"""
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
@@ -937,7 +972,7 @@
filemask = 'ESRI Shapefile (*.shp)|*.shp'
dsnFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
- size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
+ size=globalvar.DIALOG_GSELECT_SIZE, labelText = '',
dialogTitle=_('Choose input file'),
buttonText=_('Browse'),
startDirectory=os.getcwd(),
@@ -956,7 +991,7 @@
dsnDbFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
- dialogTitle=_('Choose file'),
+ dialogTitle=_('Choose file'),
buttonText=_('Browse'),
startDirectory=os.getcwd(),
changeCallback=self.OnSetDsn)
@@ -1261,3 +1296,45 @@
"""!Get format extension"""
return self.format.GetExtension(self.format.GetStringSelection())
+class ProjSelect(wx.ComboBox):
+ """!Widget for selecting input raster/vector map used by
+ r.proj/v.proj modules."""
+ def __init__(self, parent, isRaster, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE,
+ **kwargs):
+ super(ProjSelect, self).__init__(parent, id, size = size,
+ style = wx.CB_READONLY, **kwargs)
+ self.SetName("ProjSelect")
+ self.isRaster = isRaster
+
+ def UpdateItems(self, dbase, location, mapset):
+ """!Update list of maps
+
+ """
+ if not dbase:
+ dbase = grass.gisenv()['GISDBASE']
+ if not mapset:
+ mapset = grass.gisenv()['MAPSET']
+ if self.isRaster:
+ ret = gcmd.RunCommand('r.proj',
+ quiet = True,
+ read = True,
+ flags = 'l',
+ dbase = dbase,
+ location = location,
+ mapset = mapset)
+ else:
+ ret = gcmd.RunCommand('v.proj',
+ quiet = True,
+ read = True,
+ flags = 'l',
+ dbase = dbase,
+ location = location,
+ mapset = mapset)
+ listMaps = list()
+ if ret:
+ for line in ret.splitlines():
+ listMaps.append(line.strip())
+ utils.ListSortLower(listMaps)
+
+ self.SetItems(listMaps)
+ self.SetValue('')
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2010-11-06 15:01:22 UTC (rev 44187)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2010-11-06 15:43:12 UTC (rev 44188)
@@ -278,6 +278,27 @@
if pGroup:
self.data[win.Insert] = { 'group' : pGroup.get('value', '')}
+ elif name == 'LocationSelect':
+ pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+ if pDbase:
+ self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', '')}
+
+ elif name == 'MapsetSelect':
+ pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+ pLocation = self.task.get_param('location', element='element', raiseError=False)
+ if pDbase and pLocation:
+ self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
+ 'location' : pLocation.get('value', '')}
+
+ elif name == 'ProjSelect':
+ pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+ pLocation = self.task.get_param('location', element='element', raiseError=False)
+ pMapset = self.task.get_param('mapset', element='element', raiseError=False)
+ if pDbase and pLocation and pMapset:
+ self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
+ 'location' : pLocation.get('value', ''),
+ 'mapset' : pMapset.get('value', '')}
+
def UpdateDialog(parent, event, eventId, task):
return UpdateThread(parent, event, eventId, task)
@@ -1337,7 +1358,10 @@
'dbcolumn',
'layer',
'layer_all',
- 'layer_zero') and \
+ 'layer_zero',
+ 'location',
+ 'mapset',
+ 'dbase') and \
p.get('element', '') != 'file':
if p.get('multiple', 'no') == 'yes':
multiple = True
@@ -1347,20 +1371,35 @@
mapsets = [grass.gisenv()['MAPSET'],]
else:
mapsets = None
- selection = gselect.Select(parent=which_panel, id=wx.ID_ANY,
- size=globalvar.DIALOG_GSELECT_SIZE,
- type=p.get('element', ''),
- multiple=multiple, mapsets=mapsets)
+ if self.task.name in ('r.proj', 'v.proj') \
+ and p.get('name', '') == 'input':
+ if self.task.name == 'r.proj':
+ isRaster = True
+ else:
+ isRaster = False
+ selection = gselect.ProjSelect(parent=which_panel,
+ isRaster = isRaster)
+ p['wxId'] = [ selection.GetId(), ]
+ selection.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
+ formatSelector = False
+ selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
+ else:
+ selection = gselect.Select(parent=which_panel, id=wx.ID_ANY,
+ size=globalvar.DIALOG_GSELECT_SIZE,
+ type=p.get('element', ''),
+ multiple=multiple, mapsets=mapsets)
+ formatSelector = True
+ # A select.Select is a combobox with two children: a textctl and a popupwindow;
+ # we target the textctl here
+ p['wxId'] = [selection.GetChildren()[0].GetId(), ]
+ selection.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetValue)
+
if p.get('value','') != '':
selection.SetValue(p['value']) # parameter previously set
which_sizer.Add(item=selection, proportion=0,
flag=wx.ADJUST_MINSIZE| wx.BOTTOM | wx.LEFT | wx.RIGHT, border=5)
- # A select.Select is a combobox with two children: a textctl and a popupwindow;
- # we target the textctl here
- p['wxId'] = [ selection.GetChildren()[0].GetId(), ]
- selection.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetValue)
if p.get('prompt', '') in ('vector', 'group'):
selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
@@ -1380,12 +1419,19 @@
'dbcolumn',
'layer',
'layer_all',
- 'layer_zero'):
+ 'layer_zero',
+ 'location',
+ 'mapset',
+ 'dbase'):
if p.get('multiple', 'no') == 'yes':
win = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
size=globalvar.DIALOG_TEXTCTRL_SIZE)
win.Bind(wx.EVT_TEXT, self.OnSetValue)
else:
+ value = p.get('value', '')
+ if not value:
+ value = p.get('default', '')
+
if p.get('prompt', '') in ('layer',
'layer_all',
'layer_zero'):
@@ -1408,9 +1454,6 @@
win.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
elif p.get('prompt', '') == 'dbdriver':
- value = p.get('value', '')
- if not value:
- value = p.get('default', '')
win = gselect.DriverSelect(parent = which_panel,
choices = p.get('values', []),
value = value)
@@ -1418,9 +1461,6 @@
win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
elif p.get('prompt', '') == 'dbname':
- value = p.get('value', '')
- if not value:
- value = p.get('default', '')
win = gselect.DatabaseSelect(parent = which_panel,
value = value)
win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
@@ -1436,17 +1476,35 @@
size=globalvar.DIALOG_TEXTCTRL_SIZE)
win.Bind(wx.EVT_TEXT, self.OnSetValue)
elif p.get('prompt', '') == 'dbcolumn':
- value = p.get('value', '')
- if not value:
- value = p.get('default', '')
win = gselect.ColumnSelect(parent = which_panel,
value = value,
param = p)
- ### p['wxGetValue'] = win.GetStringSelection
- ### win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
- win.Bind(wx.EVT_TEXT, self.OnSetValue)
+ win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
+ win.Bind(wx.EVT_TEXT, self.OnSetValue)
+
+ elif p.get('prompt', '') == 'location':
+ win = gselect.LocationSelect(parent = which_panel,
+ value = value)
+ win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
+ win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
+
+ elif p.get('prompt', '') == 'mapset':
+ win = gselect.MapsetSelect(parent = which_panel,
+ value = value)
+ win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
+ win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
- p['wxId'] = [ win.GetId(), ]
+ elif p.get('prompt', '') == 'dbase':
+ win = gselect.DbaseSelect(parent = which_panel,
+ changeCallback=self.OnSetValue)
+ win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
+ p['wxId'] = [ win.GetChildren()[1].GetId() ]
+
+ if not p.has_key('wxId'):
+ try:
+ p['wxId'] = [ win.GetId(), ]
+ except AttributeError:
+ pass
which_sizer.Add(item=win, proportion=0,
flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border=5)
@@ -1565,13 +1623,15 @@
pColumn = []
pGroup = None
pSubGroup = None
+ pDbase = None
+ pLocation = None
+ pMapset = None
for p in self.task.params:
if p.get('gisprompt', False) == False:
continue
prompt = p.get('element', '')
-
- if prompt == 'vector':
+ if prompt in ('cell', 'vector'):
name = p.get('name', '')
if name in ('map', 'input'):
pMap = p
@@ -1589,6 +1649,12 @@
pGroup = p
elif prompt == 'subgroup':
pSubGroup = p
+ elif prompt == 'dbase':
+ pDbase = p
+ elif prompt == 'location':
+ pLocation = p
+ elif prompt == 'mapset':
+ pMapset = p
pColumnIds = []
for p in pColumn:
@@ -1616,14 +1682,22 @@
if pGroup and pSubGroup:
pGroup['wxId-bind'] = pSubGroup['wxId']
+
+ if pDbase and pLocation:
+ pDbase['wxId-bind'] = pLocation['wxId']
+
+ if pLocation and pMapset:
+ pLocation['wxId-bind'] = pMapset['wxId']
+ if pLocation and pMapset and pMap:
+ pLocation['wxId-bind'] = pMap['wxId']
+ pMapset['wxId-bind'] = pMap['wxId']
+
#
# determine panel size
#
maxsizes = (0,0)
for section in sections:
- # tabsizer[section].SetSizeHints( tab[section] )
- #tab[section].SetAutoLayout(True)
tab[section].SetSizer( tabsizer[section] )
tabsizer[section].Fit( tab[section] )
tab[section].Layout()
@@ -1635,16 +1709,13 @@
self.constrained_size = (min(600, maxsizes[0]) + 25, min(400, maxsizes[1]) + 25)
for section in sections:
tab[section].SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
- # tab[section].SetMinSize( constrained_size )
-
+
if self.manual_tab.IsLoaded():
self.manual_tab.SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
self.SetSizer( panelsizer )
panelsizer.Fit(self.notebook)
-
- self.hasMain = tab.has_key( _('Required') ) # publish, to enclosing Frame for instance
-
+
self.Bind(EVT_DIALOG_UPDATE, self.OnUpdateDialog)
def OnFileText(self, event):
@@ -1790,7 +1861,8 @@
break
if found:
- if name in ('LayerSelect', 'DriverSelect', 'TableSelect'):
+ if name in ('LayerSelect', 'DriverSelect', 'TableSelect',
+ 'LocationSelect', 'MapsetSelect'):
porf['value'] = me.GetStringSelection()
elif name == 'GdalSelect':
porf['value'] = event.dsn
@@ -1798,7 +1870,7 @@
porf['parameterized'] = me.IsChecked()
else:
porf['value'] = me.GetValue()
-
+
self.OnUpdateValues(event)
event.Skip()
Modified: grass/branches/develbranch_6/raster/r.proj/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.proj/main.c 2010-11-06 15:01:22 UTC (rev 44187)
+++ grass/branches/develbranch_6/raster/r.proj/main.c 2010-11-06 15:43:12 UTC (rev 44188)
@@ -127,38 +127,48 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("raster, projection");
+ module->keywords = _("raster, projection, transformation");
module->description =
_("Re-projects a raster map from one location to the current location.");
inmap = G_define_standard_option(G_OPT_R_INPUT);
inmap->description = _("Name of input raster map to re-project");
inmap->required = NO;
+ inmap->guisection = _("Source");
inlocation = G_define_option();
inlocation->key = "location";
inlocation->type = TYPE_STRING;
inlocation->required = YES;
- inlocation->description = _("Location of input raster map");
+ inlocation->description = _("Location containing input raster map");
+ inlocation->gisprompt = "old,location,location";
+ inlocation->key_desc = "name";
imapset = G_define_option();
imapset->key = "mapset";
imapset->type = TYPE_STRING;
imapset->required = NO;
- imapset->description = _("Mapset of input raster map");
+ imapset->description = _("Mapset containing input raster map");
+ imapset->gisprompt = "old,mapset,mapset";
+ imapset->key_desc = "name";
+ imapset->guisection = _("Source");
indbase = G_define_option();
indbase->key = "dbase";
indbase->type = TYPE_STRING;
indbase->required = NO;
indbase->description = _("Path to GRASS database of input location");
+ indbase->gisprompt = "old,dbase,dbase";
+ indbase->key_desc = "path";
+ indbase->guisection = _("Source");
outmap = G_define_standard_option(G_OPT_R_OUTPUT);
outmap->required = NO;
outmap->description = _("Name for output raster map (default: input)");
+ outmap->guisection = _("Target");
ipolname = make_ipol_list();
-
+
interpol = G_define_option();
interpol->key = "method";
interpol->type = TYPE_STRING;
@@ -166,12 +176,14 @@
interpol->answer = "nearest";
interpol->options = ipolname;
interpol->description = _("Interpolation method to use");
+ interpol->guisection = _("Target");
res = G_define_option();
res->key = "resolution";
res->type = TYPE_DOUBLE;
res->required = NO;
res->description = _("Resolution of output map");
+ res->guisection = _("Target");
list = G_define_flag();
list->key = 'l';
@@ -180,7 +192,7 @@
nocrop = G_define_flag();
nocrop->key = 'n';
nocrop->description = _("Do not perform region cropping optimization");
-
+
/* The parser checks if the map already exists in current mapset,
we switch out the check and do it
* in the module after the parser */
@@ -235,11 +247,17 @@
/* if requested, list the raster maps in source location - MN 5/2001 */
if (list->answer) {
- if (isatty(0)) /* check if on command line */
- G_message(_("Checking location <%s>, mapset <%s>..."),
- inlocation->answer, setname);
- G_list_element("cell", "raster", setname, 0);
- exit(EXIT_SUCCESS); /* leave r.proj after listing */
+ int i;
+ char **list;
+ G_verbose_message(_("Checking location <%s> mapset <%s>"),
+ inlocation->answer, imapset->answer);
+ list = G_list(G_ELEMENT_RASTER, G__getenv("GISDBASE"),
+ G__getenv("LOCATION_NAME"), imapset->answer);
+ for (i = 0; list[i]; i++) {
+ fprintf(stdout, "%s\n", list[i]);
+ }
+ fflush(stdout);
+ exit(EXIT_SUCCESS); /* leave v.proj after listing */
}
if (!inmap->answer)
@@ -357,7 +375,7 @@
G_message(_("East: %f (%f)"), incellhd.east, ieast);
G_message(_("EW-res: %f"), incellhd.ew_res);
G_message(_("NS-res: %f"), incellhd.ns_res);
-
+
G_message(NULL);
G_message(_("Output:"));
G_message(_("Cols: %d (%d)"), outcellhd.cols, ocols);
@@ -369,7 +387,7 @@
G_message(_("EW-res: %f"), outcellhd.ew_res);
G_message(_("NS-res: %f"), outcellhd.ns_res);
G_message(NULL);
-
+
/* open and read the relevant parts of the input map and close it */
G__switch_env();
G_set_window(&incellhd);
Modified: grass/branches/develbranch_6/raster/r.proj.seg/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.proj.seg/main.c 2010-11-06 15:01:22 UTC (rev 44187)
+++ grass/branches/develbranch_6/raster/r.proj.seg/main.c 2010-11-06 15:43:12 UTC (rev 44188)
@@ -138,36 +138,46 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("raster, projection");
- module->description =
+ module->keywords = _("raster, projection, transformation");
+ module->description =
_("Re-projects a raster map from one location to the current location.");
inmap = G_define_standard_option(G_OPT_R_INPUT);
inmap->description = _("Name of input raster map to re-project");
inmap->required = NO;
-
+ inmap->guisection = _("Source");
+
inlocation = G_define_option();
inlocation->key = "location";
inlocation->type = TYPE_STRING;
inlocation->required = YES;
- inlocation->description = _("Location of input raster map");
+ inlocation->description = _("Location containing input raster map");
+ inlocation->gisprompt = "old,location,location";
+ inlocation->key_desc = "name";
imapset = G_define_option();
imapset->key = "mapset";
imapset->type = TYPE_STRING;
imapset->required = NO;
- imapset->description = _("Mapset of input raster map");
+ imapset->description = _("Mapset containing input raster map");
+ imapset->gisprompt = "old,mapset,mapset";
+ imapset->key_desc = "name";
+ imapset->guisection = _("Source");
indbase = G_define_option();
indbase->key = "dbase";
indbase->type = TYPE_STRING;
indbase->required = NO;
indbase->description = _("Path to GRASS database of input location");
+ indbase->gisprompt = "old,dbase,dbase";
+ indbase->key_desc = "path";
+ indbase->guisection = _("Source");
outmap = G_define_standard_option(G_OPT_R_OUTPUT);
outmap->required = NO;
outmap->description = _("Name for output raster map (default: input)");
-
+ outmap->guisection = _("Target");
+
ipolname = make_ipol_list();
interpol = G_define_option();
@@ -177,6 +187,7 @@
interpol->answer = "nearest";
interpol->options = ipolname;
interpol->description = _("Interpolation method to use");
+ interpol->guisection = _("Target");
memory = G_define_option();
memory->key = "memory";
@@ -189,6 +200,7 @@
res->type = TYPE_DOUBLE;
res->required = NO;
res->description = _("Resolution of output map");
+ res->guisection = _("Target");
list = G_define_flag();
list->key = 'l';
@@ -202,13 +214,14 @@
print_bounds->key = 'p';
print_bounds->description =
_("Print input map's bounds in the current projection and exit");
-
+ print_bounds->guisection = _("Target");
+
gprint_bounds = G_define_flag();
gprint_bounds->key = 'g';
gprint_bounds->description =
_("Print input map's bounds in the current projection and exit (shell style)");
+ gprint_bounds->guisection = _("Target");
-
/* The parser checks if the map already exists in current mapset,
we switch out the check and do it
in the module after the parser */
@@ -271,11 +284,17 @@
/* if requested, list the raster maps in source location - MN 5/2001 */
if (list->answer) {
- if (isatty(0)) /* check if on command line */
- G_message(_("Checking location <%s>, mapset <%s>..."),
- inlocation->answer, setname);
- G_list_element("cell", "raster", setname, 0);
- exit(EXIT_SUCCESS); /* leave r.proj after listing */
+ int i;
+ char **list;
+ G_verbose_message(_("Checking location <%s> mapset <%s>"),
+ inlocation->answer, imapset->answer);
+ list = G_list(G_ELEMENT_RASTER, G__getenv("GISDBASE"),
+ G__getenv("LOCATION_NAME"), imapset->answer);
+ for (i = 0; list[i]; i++) {
+ fprintf(stdout, "%s\n", list[i]);
+ }
+ fflush(stdout);
+ exit(EXIT_SUCCESS); /* leave v.proj after listing */
}
if (!inmap->answer)
@@ -417,7 +436,7 @@
G_adjust_Cell_head(&outcellhd, 0, 0);
G_set_window(&outcellhd);
- G_message("");
+ G_message(NULL);
G_message(_("Input:"));
G_message(_("Cols: %d (%d)"), incellhd.cols, icols);
G_message(_("Rows: %d (%d)"), incellhd.rows, irows);
@@ -427,8 +446,8 @@
G_message(_("East: %f (%f)"), incellhd.east, ieast);
G_message(_("EW-res: %f"), incellhd.ew_res);
G_message(_("NS-res: %f"), incellhd.ns_res);
- G_message("");
+ G_message(NULL);
G_message(_("Output:"));
G_message(_("Cols: %d (%d)"), outcellhd.cols, ocols);
G_message(_("Rows: %d (%d)"), outcellhd.rows, orows);
@@ -438,7 +457,7 @@
G_message(_("East: %f (%f)"), outcellhd.east, oeast);
G_message(_("EW-res: %f"), outcellhd.ew_res);
G_message(_("NS-res: %f"), outcellhd.ns_res);
- G_message("");
+ G_message(NULL);
/* open and read the relevant parts of the input map and close it */
G__switch_env();
Modified: grass/branches/develbranch_6/vector/v.proj/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.proj/main.c 2010-11-06 15:01:22 UTC (rev 44187)
+++ grass/branches/develbranch_6/vector/v.proj/main.c 2010-11-06 15:43:12 UTC (rev 44188)
@@ -60,35 +60,45 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("vector, projection");
- module->description = _("Allows projection conversion of vector maps.");
+ module->keywords = _("vector, projection, transformation");
+ module->description = _("Re-projects a vector map from one location to the current location.");
/* set up the options and flags for the command line parser */
mapopt = G_define_standard_option(G_OPT_V_INPUT);
- mapopt->gisprompt = NULL;
mapopt->required = NO;
-
+ mapopt->guisection = _("Source");
+
ilocopt = G_define_option();
ilocopt->key = "location";
ilocopt->type = TYPE_STRING;
ilocopt->required = YES;
ilocopt->description = _("Location containing input vector map");
-
+ ilocopt->gisprompt = "old,location,location";
+ ilocopt->key_desc = "name";
+
isetopt = G_define_option();
isetopt->key = "mapset";
isetopt->type = TYPE_STRING;
isetopt->required = NO;
isetopt->description = _("Mapset containing input vector map");
+ isetopt->gisprompt = "old,mapset,mapset";
+ isetopt->key_desc = "name";
+ isetopt->guisection = _("Source");
ibaseopt = G_define_option();
ibaseopt->key = "dbase";
ibaseopt->type = TYPE_STRING;
ibaseopt->required = NO;
ibaseopt->description = _("Path to GRASS database of input location");
+ ibaseopt->gisprompt = "old,dbase,dbase";
+ ibaseopt->key_desc = "path";
+ ibaseopt->guisection = _("Source");
omapopt = G_define_standard_option(G_OPT_V_OUTPUT);
omapopt->required = NO;
+ omapopt->description = _("Name for output vector map (default: input)");
+ omapopt->guisection = _("Target");
flag.list = G_define_flag();
flag.list->key = 'l';
@@ -100,6 +110,7 @@
flag.transformz->label =
_("Assume z co-ordinate is ellipsoidal height and "
"transform if possible");
+ flag.transformz->guisection = _("Target");
/* The parser checks if the map already exists in current mapset,
we switch out the check and do it
@@ -153,9 +164,16 @@
if (stat >= 0) { /* yes, we can access the mapset */
/* if requested, list the vector maps in source location - MN 5/2001 */
if (flag.list->answer) {
+ int i;
+ char **list;
G_verbose_message(_("Checking location <%s> mapset <%s>"),
iloc_name, iset_name);
- G_list_element("vector", "vector", iset_name, 0);
+ list = G_list(G_ELEMENT_VECTOR, G__getenv("GISDBASE"),
+ G__getenv("LOCATION_NAME"), iset_name);
+ for (i = 0; list[i]; i++) {
+ fprintf(stdout, "%s\n", list[i]);
+ }
+ fflush(stdout);
exit(EXIT_SUCCESS); /* leave v.proj after listing */
}
More information about the grass-commit
mailing list