[GRASS-SVN] r65632 - grass/trunk/raster/r.horizon
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 19 08:44:21 PDT 2015
Author: annakrat
Date: 2015-07-19 08:44:21 -0700 (Sun, 19 Jul 2015)
New Revision: 65632
Modified:
grass/trunk/raster/r.horizon/main.c
Log:
r.horizon: revert r65619, reorganize options in gui tabs, fix crash when step is not provided in raster mode
Modified: grass/trunk/raster/r.horizon/main.c
===================================================================
--- grass/trunk/raster/r.horizon/main.c 2015-07-19 15:38:14 UTC (rev 65631)
+++ grass/trunk/raster/r.horizon/main.c 2015-07-19 15:44:21 UTC (rev 65632)
@@ -192,7 +192,7 @@
"counterclockwise with east=0, north=90 etc. The output is the horizon height in radians.");
parm.elevin = G_define_standard_option(G_OPT_R_ELEV);
- parm.elevin->guisection = _("Input options");
+ parm.elevin->guisection = _("Input");
parm.direction = G_define_option();
@@ -201,16 +201,15 @@
parm.direction->required = NO;
parm.direction->description =
_("Direction in which you want to know the horizon height");
- parm.direction->guisection = _("Input options");
+ parm.direction->guisection = _("Input");
parm.step = G_define_option();
parm.step->key = "step";
parm.step->type = TYPE_DOUBLE;
parm.step->required = NO;
- parm.step->answer = "0";
parm.step->description =
_("Angle step size for multidirectional horizon [degrees]");
- parm.step->guisection = _("Input options");
+ parm.step->guisection = _("Input");
parm.start = G_define_option();
parm.start->key = "start";
@@ -219,7 +218,7 @@
parm.start->required = NO;
parm.start->description =
_("Start angle for multidirectional horizon [degrees]");
- parm.start->guisection = _("Input options");
+ parm.start->guisection = _("Raster mode");
parm.end = G_define_option();
parm.end->key = "end";
@@ -228,7 +227,7 @@
parm.end->required = NO;
parm.end->description =
_("End angle for multidirectional horizon [degrees]");
- parm.end->guisection = _("Input options");
+ parm.end->guisection = _("Raster mode");
parm.bufferzone = G_define_option();
parm.bufferzone->key = "bufferzone";
@@ -236,7 +235,7 @@
parm.bufferzone->required = NO;
parm.bufferzone->description =
_("For horizon rasters, read from the DEM an extra buffer around the present region");
- parm.bufferzone->guisection = _("Input options");
+ parm.bufferzone->guisection = _("Raster mode");
parm.e_buff = G_define_option();
parm.e_buff->key = "e_buff";
@@ -244,7 +243,7 @@
parm.e_buff->required = NO;
parm.e_buff->description =
_("For horizon rasters, read from the DEM an extra buffer eastward the present region");
- parm.e_buff->guisection = _("Input options");
+ parm.e_buff->guisection = _("Raster mode");
parm.w_buff = G_define_option();
parm.w_buff->key = "w_buff";
@@ -252,7 +251,7 @@
parm.w_buff->required = NO;
parm.w_buff->description =
_("For horizon rasters, read from the DEM an extra buffer westward the present region");
- parm.w_buff->guisection = _("Input options");
+ parm.w_buff->guisection = _("Raster mode");
parm.n_buff = G_define_option();
parm.n_buff->key = "n_buff";
@@ -260,7 +259,7 @@
parm.n_buff->required = NO;
parm.n_buff->description =
_("For horizon rasters, read from the DEM an extra buffer northward the present region");
- parm.n_buff->guisection = _("Input options");
+ parm.n_buff->guisection = _("Raster mode");
parm.s_buff = G_define_option();
parm.s_buff->key = "s_buff";
@@ -268,7 +267,7 @@
parm.s_buff->required = NO;
parm.s_buff->description =
_("For horizon rasters, read from the DEM an extra buffer southward the present region");
- parm.s_buff->guisection = _("Input options");
+ parm.s_buff->guisection = _("Raster mode");
parm.maxdistance = G_define_option();
parm.maxdistance->key = "maxdistance";
@@ -276,18 +275,18 @@
parm.maxdistance->required = NO;
parm.maxdistance->description =
_("The maximum distance to consider when finding the horizon height");
- parm.maxdistance->guisection = _("Input options");
+ parm.maxdistance->guisection = _("Optional");
parm.horizon = G_define_standard_option(G_OPT_R_BASENAME_OUTPUT);
parm.horizon->required = NO;
- parm.horizon->guisection = _("Output options");
+ parm.horizon->guisection = _("Raster mode");
parm.coord = G_define_standard_option(G_OPT_M_COORDS);
parm.coord->description =
_("Coordinate for which you want to calculate the horizon");
- parm.coord->guisection = _("Output options");
+ parm.coord->guisection = _("Point mode");
parm.dist = G_define_option();
parm.dist->key = "distance";
@@ -295,7 +294,7 @@
parm.dist->answer = DIST;
parm.dist->required = NO;
parm.dist->description = _("Sampling distance step coefficient (0.5-1.5)");
- parm.dist->guisection = _("Output options");
+ parm.dist->guisection = _("Optional");
parm.output = G_define_standard_option(G_OPT_F_OUTPUT);
parm.output->key = "file";
@@ -303,6 +302,7 @@
parm.output->answer = "-";
parm.output->description =
_("Name of file for output (use output=- for stdout)");
+ parm.output->guisection = _("Point mode");
flag.degreeOutput = G_define_flag();
flag.degreeOutput->key = 'd';
@@ -400,9 +400,14 @@
_("You didn't specify a horizon raster name. Aborting."));
}
horizon = parm.horizon->answer;
- if (parm.step->answer != NULL)
+ if (parm.step->answer != NULL) {
str_step = parm.step->answer;
- sscanf(parm.step->answer, "%lf", &step);
+ sscanf(parm.step->answer, "%lf", &step);
+ }
+ else {
+ step = 0;
+ str_step = "0";
+ }
sscanf(parm.start->answer, "%lf", &start);
sscanf(parm.end->answer, "%lf", &end);
if (start < 0.0) {
@@ -613,7 +618,7 @@
}
}
z100[i][j] = zmax;
- G_debug(1,"%d %d %lf\n", i, j, z100[i][j]);
+ G_debug(3,"%d %d %lf\n", i, j, z100[i][j]);
}
}
@@ -955,14 +960,14 @@
jp100 = floor(jp / 100.);
/*test the new position with low resolution */
if ((ip100 != iold100) || (jp100 != jold100)) {
- G_debug(1,"ip:%d jp:%d iold100:%d jold100:%d\n",ip,jp, iold100,jold100);
+ G_debug(2,"ip:%d jp:%d iold100:%d jold100:%d\n",ip,jp, iold100,jold100);
/* replace with approximate version
curvature_diff = EARTHRADIUS*(1.-cos(length/EARTHRADIUS));
*/
curvature_diff = 0.5 * length * length * invEarth;
z2 = z_orig + curvature_diff + length * tanh0;
zp100 = z100[jp100][ip100];
- G_debug(1,"ip:%d jp:%d z2:%lf zp100:%lf \n",ip,jp,z2,zp100);
+ G_debug(2,"ip:%d jp:%d z2:%lf zp100:%lf \n",ip,jp,z2,zp100);
if (zp100 <= z2)
/*skip to the next lowres cell */
@@ -995,11 +1000,11 @@
}
mindel = min(delx, dely);
- G_debug(1,"%d %d %d %lf %lf\n",ip, jp, mindel,xg0, yg0);
+ G_debug(2,"%d %d %d %lf %lf\n",ip, jp, mindel,xg0, yg0);
yy0 = yy0 + (mindel * stepsinangle);
xx0 = xx0 + (mindel * stepcosangle);
- G_debug(1," %lf %lf\n",xx0,yy0);
+ G_debug(2," %lf %lf\n",xx0,yy0);
return (3);
}
@@ -1252,7 +1257,7 @@
if (z_orig != UNDEFZ) {
- G_debug(1,"**************new line %d %d\n", i, j);
+ G_debug(4,"**************new line %d %d\n", i, j);
shadow_angle = horizon_height();
if (degreeOutput) {
More information about the grass-commit
mailing list