[GRASS-SVN] r30221 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Feb 17 21:29:23 EST 2008
Author: cmbarton
Date: 2008-02-17 21:29:22 -0500 (Sun, 17 Feb 2008)
New Revision: 30221
Modified:
grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
grass/trunk/gui/wxpython/gui_modules/menudata.py
Log:
Extending new map calculator to r3.mapcalc
Modified: grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py 2008-02-18 02:28:58 UTC (rev 30220)
+++ grass/trunk/gui/wxpython/gui_modules/mcalc_builder.py 2008-02-18 02:29:22 UTC (rev 30221)
@@ -40,19 +40,26 @@
and run r.mapcalc statements
"""
def __init__(self, parent, id, title, pos=wx.DefaultPosition,
- size=wx.DefaultSize, style=wx.TAB_TRAVERSAL|wx.DEFAULT_FRAME_STYLE):
+ size=wx.DefaultSize, style=wx.TAB_TRAVERSAL|wx.DEFAULT_FRAME_STYLE,
+ dimension=2):
- wx.Frame.__init__(self, parent, id, title, pos=pos, size=size, style=style)
+ wx.Frame.__init__(self, parent, id, title, pos, size,
+ style)
self.Centre(wx.BOTH)
- self.SetTitle(_("GRASS Map Calculator") )
+ if dimension == 3:
+ self.SetTitle(_("GRASS 3D Map Calculator") )
+ else:
+ self.SetTitle(_("GRASS Map Calculator") )
+
#
# variables
#
self.parent = parent
self.heading = 'mapcalc statement'
self.newmap = ''
+ self.dimension = dimension
self.funct_list = [
'abs(x)',
'acos(x)',
@@ -94,6 +101,15 @@
'nsres()',
'null()'
]
+
+ if self.dimension == 3:
+ indx = self.funct_list.index('y()') +1
+ self.funct_list.insert(indx, 'z()')
+ indx = self.funct_list.index('nsres()') +1
+ self.funct_list.insert(indx, 'tbres()')
+ maplabel = 'volume'
+ else:
+ maplabel = 'map'
#
# Buttons
@@ -164,9 +180,9 @@
#
# Map and function insertion text and ComboBoxes
- self.newmaplabel = wx.StaticText(self, -1, 'Name of new map to create')
+ self.newmaplabel = wx.StaticText(self, -1, 'Name of new %s to create' % maplabel)
self.newmaptxt = wx.TextCtrl(self, wx.ID_ANY, size=(250,-1))
- self.mapsellabel = wx.StaticText(self, -1, 'Insert existing map')
+ self.mapsellabel = wx.StaticText(self, -1, 'Insert existing %s' % maplabel)
self.mapselect = gselect.Select(self, wx.ID_ANY, size=(250,-1),
type='cell', multiple=False)
self.functlabel = wx.StaticText(self, -1, 'Insert mapcalc function')
@@ -373,7 +389,11 @@
try:
mctxt = self.text_mcalc.GetValue().strip().replace("\n"," ")
mctxt = mctxt.replace(" ","")
- cmdlist = ["r.mapcalc"," %s=%s" % (self.newmap,mctxt)]
+ if self.dimension == 3:
+ cmdlist = ["r3.mapcalc"," %s=%s" % (self.newmap,mctxt)]
+ else:
+ cmdlist = ["r.mapcalc"," %s=%s" % (self.newmap,mctxt)]
+
p = gcmd.Command(cmdlist)
if p.returncode == 0:
wx.MessageBox("Map %s created successfully" % self.newmap)
Modified: grass/trunk/gui/wxpython/gui_modules/menudata.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menudata.py 2008-02-18 02:28:58 UTC (rev 30220)
+++ grass/trunk/gui/wxpython/gui_modules/menudata.py 2008-02-18 02:29:22 UTC (rev 30221)
@@ -502,7 +502,7 @@
)),
("","","", ""),
("3D MASK", "Create 3D mask for grid3D operations", "self.OnMenuCmd", "r3.mask"),
- ("3D map calculator", "Map calculator for volumetric map algebra", "self.OnMenuCmd", "r3.mapcalculator"),
+ ("3D map calculator", "Map calculator for volumetric map algebra", "self.Disp3DMapCalculator", ""),
("Cross section", "Create 2D raster cross section from grid3d volume", "self.OnMenuCmd", "r3.cross.rast"),
("Interpolate volume from points", "Interpolate volume from vector points using splines", "self.OnMenuCmd", "v.vol.rst"),
("","","", ""),
More information about the grass-commit
mailing list