[GRASS-SVN] r56327 - in grass/trunk: include lib/gis lib/raster raster/r.resamp.bspline raster/r.resamp.interp vector/v.sample vector/v.surf.bspline
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 20 05:49:35 PDT 2013
Author: martinl
Date: 2013-05-20 05:49:35 -0700 (Mon, 20 May 2013)
New Revision: 56327
Modified:
grass/trunk/include/raster.h
grass/trunk/lib/gis/parser_standard_options.c
grass/trunk/lib/raster/interp.c
grass/trunk/lib/raster/sample.c
grass/trunk/raster/r.resamp.bspline/main.c
grass/trunk/raster/r.resamp.interp/main.c
grass/trunk/vector/v.sample/main.c
grass/trunk/vector/v.surf.bspline/main.c
Log:
rasterlib: rename interpolation methods (bilinear->linear, bicubic->cubic)
update modules
Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/include/raster.h 2013-05-20 12:49:35 UTC (rev 56327)
@@ -15,13 +15,11 @@
/*! \brief Interpolation methods
For G_get_raster_sample(), INTERP_TYPE
-
- \todo Rename to use prefix INTERP_
*/
-#define UNKNOWN 0
-#define NEAREST 1 /* nearest neighbor interpolation */
-#define BILINEAR 2 /* bilinear interpolation */
-#define CUBIC 3 /* cubic interpolation */
+#define INTERP_UNKNOWN 0
+#define INTERP_NEAREST 1 /* nearest neighbor interpolation */
+#define INTERP_LINEAR 2 /* linear interpolation */
+#define INTERP_CUBIC 3 /* cubic interpolation */
/*** typedefs ***/
typedef int RASTER_MAP_TYPE;
Modified: grass/trunk/lib/gis/parser_standard_options.c
===================================================================
--- grass/trunk/lib/gis/parser_standard_options.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/lib/gis/parser_standard_options.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -308,12 +308,12 @@
Opt->type = TYPE_STRING;
Opt->required = NO;
Opt->description = _("Sampling interpolation method");
- Opt->options = "nearest,bilinear,bicubic";
+ Opt->options = "nearest,linear,cubic";
G_asprintf((char **) &(Opt->descriptions),
- "nearest;%s;bilinear;%s;bicubic;%s",
+ "nearest;%s;linear;%s;cubic;%s",
_("Nearest-neighbor interpolation"),
- _("Bilinear interpolation"),
- _("Bicubic interpolation"));
+ _("Linear interpolation"),
+ _("Cubic interpolation"));
break;
/*g3d maps */
Modified: grass/trunk/lib/raster/interp.c
===================================================================
--- grass/trunk/lib/raster/interp.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/lib/raster/interp.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -194,20 +194,20 @@
{
int interp_type;
- interp_type = UNKNOWN;
+ interp_type = INTERP_UNKNOWN;
if (option->answer) {
if (strcmp(option->answer, "nearest") == 0) {
- interp_type = NEAREST;
+ interp_type = INTERP_NEAREST;
}
- else if (strcmp(option->answer, "bilinear") == 0) {
- interp_type = BILINEAR;
+ else if (strcmp(option->answer, "linear") == 0) {
+ interp_type = INTERP_LINEAR;
}
- else if (strcmp(option->answer, "bicubic") == 0) {
- interp_type = CUBIC;
+ else if (strcmp(option->answer, "cubic") == 0) {
+ interp_type = INTERP_CUBIC;
}
}
- if (interp_type == UNKNOWN)
+ if (interp_type == INTERP_UNKNOWN)
G_fatal_error(_("Unknown interpolation method: %s"), option->answer);
return interp_type;
Modified: grass/trunk/lib/raster/sample.c
===================================================================
--- grass/trunk/lib/raster/sample.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/lib/raster/sample.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -54,15 +54,15 @@
double retval;
switch (itype) {
- case NEAREST:
+ case INTERP_NEAREST:
retval =
Rast_get_sample_nearest(fd, window, cats, north, east, usedesc);
break;
- case BILINEAR:
+ case INTERP_LINEAR:
retval =
Rast_get_sample_bilinear(fd, window, cats, north, east, usedesc);
break;
- case CUBIC:
+ case INTERP_CUBIC:
retval =
Rast_get_sample_cubic(fd, window, cats, north, east, usedesc);
break;
Modified: grass/trunk/raster/r.resamp.bspline/main.c
===================================================================
--- grass/trunk/raster/r.resamp.bspline/main.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/raster/r.resamp.bspline/main.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -115,13 +115,10 @@
_("Length of each spline step in the north-south direction. Default: 1.5 * nsres.");
stepN_opt->guisection = _("Settings");
- method_opt = G_define_option();
- method_opt->key = "method";
- method_opt->type = TYPE_STRING;
- method_opt->required = NO;
+ method_opt = G_define_standard_option(G_OPT_R_INTERP_TYPE);
method_opt->description = _("Spline interpolation algorithm");
- method_opt->options = "bilinear,bicubic";
- method_opt->answer = "bicubic";
+ method_opt->options = "linear,cubic";
+ method_opt->answer = "cubic";
method_opt->guisection = _("Settings");
lambda_f_opt = G_define_option();
@@ -158,7 +155,7 @@
inrast = in_opt->answer;
outrast = out_opt->answer;
- if (!strcmp(method_opt->answer, "bilinear"))
+ if (!strcmp(method_opt->answer, "linear"))
interp_method = P_BILINEAR;
else
interp_method = P_BICUBIC;
Modified: grass/trunk/raster/r.resamp.interp/main.c
===================================================================
--- grass/trunk/raster/r.resamp.interp/main.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/raster/r.resamp.interp/main.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -81,22 +81,18 @@
rastin = G_define_standard_option(G_OPT_R_INPUT);
rastout = G_define_standard_option(G_OPT_R_OUTPUT);
- method = G_define_option();
- method->key = "method";
- method->type = TYPE_STRING;
- method->required = NO;
- method->description = _("Interpolation method");
- method->options = "nearest,bilinear,bicubic,lanczos";
- method->answer = "bilinear";
+ method = G_define_standard_option(G_OPT_R_INTERP_TYPE);
+ method->options = "nearest,linear,cubic,lanczos";
+ method->answer = "linear";
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
if (G_strcasecmp(method->answer, "nearest") == 0)
neighbors = 1;
- else if (G_strcasecmp(method->answer, "bilinear") == 0)
+ else if (G_strcasecmp(method->answer, "linear") == 0)
neighbors = 2;
- else if (G_strcasecmp(method->answer, "bicubic") == 0)
+ else if (G_strcasecmp(method->answer, "cubic") == 0)
neighbors = 4;
else if (G_strcasecmp(method->answer, "lanczos") == 0)
neighbors = 5;
Modified: grass/trunk/vector/v.sample/main.c
===================================================================
--- grass/trunk/vector/v.sample/main.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/vector/v.sample/main.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -45,7 +45,7 @@
int main(int argc, char **argv)
{
double scale, predicted, actual;
- INTERP_TYPE method = UNKNOWN;
+ INTERP_TYPE method = INTERP_UNKNOWN;
int fdrast; /* file descriptor for raster map is int */
struct Cell_head window;
struct GModule *module;
Modified: grass/trunk/vector/v.surf.bspline/main.c
===================================================================
--- grass/trunk/vector/v.surf.bspline/main.c 2013-05-20 12:35:20 UTC (rev 56326)
+++ grass/trunk/vector/v.surf.bspline/main.c 2013-05-20 12:49:35 UTC (rev 56327)
@@ -152,13 +152,10 @@
_("Length of each spline step in the north-south direction");
stepN_opt->guisection = _("Settings");
- type_opt = G_define_option();
- type_opt->key = "method";
- type_opt->type = TYPE_STRING;
- type_opt->required = NO;
+ type_opt = G_define_standard_option(G_OPT_R_INTERP_TYPE);
type_opt->description = _("Spline interpolation algorithm");
- type_opt->options = "bilinear,bicubic";
- type_opt->answer = "bilinear";
+ type_opt->options = "linear,cubic";
+ type_opt->answer = "linear";
type_opt->guisection = _("Settings");
lambda_f_opt = G_define_option();
@@ -206,7 +203,7 @@
if (!vector && !map && !cross_corr_flag->answer)
G_fatal_error(_("No raster or vector or cross-validation output"));
- if (!strcmp(type_opt->answer, "bilinear"))
+ if (!strcmp(type_opt->answer, "linear"))
bilin = P_BILINEAR;
else
bilin = P_BICUBIC;
More information about the grass-commit
mailing list