[GRASS-SVN] r59424 - grass/trunk/gui/wxpython/rlisetup
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 27 07:44:22 PDT 2014
Author: lucadelu
Date: 2014-03-27 07:44:22 -0700 (Thu, 27 Mar 2014)
New Revision: 59424
Modified:
grass/trunk/gui/wxpython/rlisetup/wizard.py
Log:
g.gui.rlisetup: all features of r.li.setup have been ported to g.gui.rlisetup, please testing is really welcome
Modified: grass/trunk/gui/wxpython/rlisetup/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/rlisetup/wizard.py 2014-03-27 14:41:50 UTC (rev 59423)
+++ grass/trunk/gui/wxpython/rlisetup/wizard.py 2014-03-27 14:44:22 UTC (rev 59424)
@@ -303,7 +303,7 @@
self._circle(self.moving.width, self.moving.height)
cl = float(self.CIR_CL) / float(self.rasterinfo['cols'])
rl = float(self.CIR_RL) / float(self.rasterinfo['rows'])
- fil.write("SAMPLEAREA -1|-1|%r|%r" % (rl, cl))
+ fil.write("MASKEDSAMPLEAREA -1|-1|%r|%r" % (rl, cl))
fil.write("|%s" % self.moving.height)
fil.write("\nMOVINGWINDOW\n")
##KMWINR = samplingtype moving, regionbox=keyboard, shape=rectangle
@@ -354,20 +354,20 @@
#elif self.samplingareapage.samplingtype == SamplingType.UNITS and self.samplingareapage.regionbox=='mouse':
##MUNITSC = samplingtype=units, regionbox=mouse, shape=cirlce
- elif self.samplingareapage.samplingtype == SamplingType.MUNITSC:
- print "not added"
-
##MUNITSR = samplingtype=units, regionbox=mouse, shape=rectangle
- elif self.samplingareapage.samplingtype == SamplingType.MUNITSR:
+ elif self.samplingareapage.samplingtype in [SamplingType.MUNITSR,
+ SamplingType.MUNITSC]:
+ # get the raster region into rastregion
+ grass.use_temp_region()
+ grass.run_command('g.region', rast=self.startpage.rast)
+ rastregion = grass.region()
+ s_n = rastregion['n']
+ s_w = rastregion['w']
+ rows = float(self.rasterinfo['rows'])
+ cols = float(self.rasterinfo['cols'])
for tregion in self.msAreaList:
- rows = float(self.rasterinfo['rows'])
- cols = float(self.rasterinfo['cols'])
- # get the raster region into rastregion
- grass.use_temp_region()
- grass.run_command('g.region', rast=self.startpage.rast)
- rastregion = grass.region()
- s_n = rastregion['n']
- s_w = rastregion['w']
+ if self.samplingareapage.samplingtype == SamplingType.MUNITSC:
+ tregion = tregion.region
abs_y = abs(round((float(s_n) - tregion['n']) / tregion['nsres']))
abs_x = abs(round((float(s_w) - tregion['w']) / tregion['ewres']))
abs_rl = abs(round((tregion['n'] - tregion['s']) / tregion['nsres']))
@@ -378,13 +378,17 @@
rl = float(abs_rl) / float(rows)
cl = float(abs_cl) / float(cols)
sarea = str(x) + "|" + str(y) + "|" + str(rl) + "|" + str(cl)
- fil.write("SQUAREAREA %s\n" % sarea)
+ if self.samplingareapage.samplingtype == SamplingType.MUNITSR:
+ fil.write("SQUAREAREA %s\n" % sarea)
+ elif self.samplingareapage.samplingtype == SamplingType.MUNITSC:
+ fil.write("MASKEDSAMPLEAREA %s" % sarea)
+ fil.write("|%s\n" % self.msAreaList[0].raster)
elif self.samplingareapage.samplingtype == SamplingType.REGIONS:
+ rows = float(self.rasterinfo['rows'])
+ cols = float(self.rasterinfo['cols'])
for marea in self.msAreaList:
gregion = marea.region
- rows = float(self.rasterinfo['rows'])
- cols = float(self.rasterinfo['cols'])
abs_y = self.SF_Y + abs(round((self.SF_N - gregion['n']) / self.SF_NSRES))
abs_x = self.SF_X + abs(round((self.SF_W - gregion['w']) / self.SF_EWRES))
abs_rl = abs(round(gregion['n'] - gregion['s']) / self.SF_NSRES)
@@ -912,8 +916,8 @@
def RegionDraw(self, regtype):
"""!Set the next page to units or drawunits"""
#TODO add only to commit the last changes, remove after more testing
- if self.radioBox.GetSelection() == 2:
- self.regionBox.EnableItem(1, False)
+# if self.radioBox.GetSelection() == 2:
+# self.regionBox.EnableItem(1, False)
if regtype == 0:
self.regionbox = 'keyboard'
if self.samplingtype == SamplingType.UNITS:
More information about the grass-commit
mailing list