[GRASS-dev] [GRASS-SVN] r60414 - in grass/trunk: include/defs lib/gis misc/m.measure raster/r.surf.area vector/v.to.db

Huidae Cho grass4u at gmail.com
Thu May 22 08:15:26 PDT 2014


Hi,

FYI, I renamed G_units_to_meters_factor(_sq) to G_meters_to_units_factor(_sq)
because this function converts meters to units by multiplication, not the
other way around.

Huidae



On Thu, May 22, 2014 at 11:00 AM, <svn_grass at osgeo.org> wrote:

> Author: hcho
> Date: 2014-05-22 08:00:16 -0700 (Thu, 22 May 2014)
> New Revision: 60414
>
> Modified:
>    grass/trunk/include/defs/gis.h
>    grass/trunk/lib/gis/units.c
>    grass/trunk/misc/m.measure/main.c
>    grass/trunk/raster/r.surf.area/area.c
>    grass/trunk/vector/v.to.db/units.c
> Log:
> libgis, r.surf.area, v.to.db, m.measure: Renamed G_units_to_meters_factor*
> to G_meters_to_units_factor*
>
> Modified: grass/trunk/include/defs/gis.h
> ===================================================================
> --- grass/trunk/include/defs/gis.h      2014-05-22 14:42:19 UTC (rev 60413)
> +++ grass/trunk/include/defs/gis.h      2014-05-22 15:00:16 UTC (rev 60414)
> @@ -666,8 +666,8 @@
>  void G_trim_decimal(char *);
>
>  /* units.c */
> -double G_units_to_meters_factor(int);
> -double G_units_to_meters_factor_sq(int);
> +double G_meters_to_units_factor(int);
> +double G_meters_to_units_factor_sq(int);
>  const char *G_get_units_name(int, int, int);
>  int G_units(const char *);
>  int G_is_units_type_spatial(int);
>
> Modified: grass/trunk/lib/gis/units.c
> ===================================================================
> --- grass/trunk/lib/gis/units.c 2014-05-22 14:42:19 UTC (rev 60413)
> +++ grass/trunk/lib/gis/units.c 2014-05-22 15:00:16 UTC (rev 60414)
> @@ -19,7 +19,7 @@
>  #include <grass/glocale.h>
>
>  /*!
> -  \brief Units conversion to meters
> +  \brief Units conversion from meters to units
>
>    Units codes (gis.h):
>     - U_METERS
> @@ -27,14 +27,13 @@
>     - U_MILES
>     - U_FEET
>
> -  Returns a factor which converts the grid unit to meters (by
> -  multiplication).
> +  Returns a factor which converts meters to units (by multiplication).
>
>    \param units units code
>
>    \return factor
>  */
> -double G_units_to_meters_factor(int units)
> +double G_meters_to_units_factor(int units)
>  {
>      switch (units) {
>      case U_METERS:
> @@ -62,7 +61,7 @@
>  }
>
>  /*!
> -  \brief Units conversion to square meters
> +  \brief Units conversion from square meters to square units
>
>    Units codes (gis.h):
>     - U_METERS
> @@ -72,14 +71,14 @@
>     - U_MILES
>     - U_FEET
>
> -  Returns a factor which converts the grid unit to square meters (by
> +  Returns a factor which converts square meters to square units (by
>    multiplication).
>
>    \param units units code
>
>    \return factor
>  */
> -double G_units_to_meters_factor_sq(int units)
> +double G_meters_to_units_factor_sq(int units)
>  {
>      switch (units) {
>      case U_METERS:
>
> Modified: grass/trunk/misc/m.measure/main.c
> ===================================================================
> --- grass/trunk/misc/m.measure/main.c   2014-05-22 14:42:19 UTC (rev 60413)
> +++ grass/trunk/misc/m.measure/main.c   2014-05-22 15:00:16 UTC (rev 60414)
> @@ -82,8 +82,8 @@
>         units_name    = G_get_units_name(G_units(units->answer), 1, 0);
>         sq_units_name = G_get_units_name(G_units(units->answer), 1, 1);
>      }
> -    f    = G_units_to_meters_factor(G_units(units->answer));
> -    sq_f = G_units_to_meters_factor_sq(G_units(units->answer));
> +    f    = G_meters_to_units_factor(G_units(units->answer));
> +    sq_f = G_meters_to_units_factor_sq(G_units(units->answer));
>
>      G_debug(1, "using '%s (%f) %s (%f)'",
>             units_name, f, sq_units_name, sq_f);
>
> Modified: grass/trunk/raster/r.surf.area/area.c
> ===================================================================
> --- grass/trunk/raster/r.surf.area/area.c       2014-05-22 14:42:19 UTC
> (rev 60413)
> +++ grass/trunk/raster/r.surf.area/area.c       2014-05-22 15:00:16 UTC
> (rev 60414)
> @@ -120,5 +120,5 @@
>      if (units == U_UNDEFINED)
>         return value;
>
> -    return value * G_units_to_meters_factor_sq(units);
> +    return value * G_meters_to_units_factor_sq(units);
>  }
>
> Modified: grass/trunk/vector/v.to.db/units.c
> ===================================================================
> --- grass/trunk/vector/v.to.db/units.c  2014-05-22 14:42:19 UTC (rev 60413)
> +++ grass/trunk/vector/v.to.db/units.c  2014-05-22 15:00:16 UTC (rev 60414)
> @@ -7,8 +7,8 @@
>      double f, sq_f;
>
>      rad  = 0;
> -    f    = G_units_to_meters_factor(options.units);
> -    sq_f = G_units_to_meters_factor_sq(options.units);
> +    f    = G_meters_to_units_factor(options.units);
> +    sq_f = G_meters_to_units_factor_sq(options.units);
>
>      if (options.units == U_RADIANS)
>         rad = 1;
>
> _______________________________________________
> grass-commit mailing list
> grass-commit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-commit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140522/712e1f8b/attachment.html>


More information about the grass-dev mailing list