<div dir="ltr">Hi,<div><br></div><div>FYI, I renamed <span style="font-family:arial,sans-serif;font-size:13px">G_units_to_meters_factor</span>(_sq) to <span style="font-family:arial,sans-serif;font-size:13px">G_meters_to_units_factor</span>(_sq) because this function converts meters to units by multiplication, not the other way around.</div>
<div><br></div><div>Huidae</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 22, 2014 at 11:00 AM, <span dir="ltr"><<a href="mailto:svn_grass@osgeo.org" target="_blank">svn_grass@osgeo.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: hcho<br>
Date: 2014-05-22 08:00:16 -0700 (Thu, 22 May 2014)<br>
New Revision: 60414<br>
<br>
Modified:<br>
grass/trunk/include/defs/gis.h<br>
grass/trunk/lib/gis/units.c<br>
grass/trunk/misc/m.measure/main.c<br>
grass/trunk/raster/r.surf.area/area.c<br>
grass/trunk/vector/v.to.db/units.c<br>
Log:<br>
libgis, r.surf.area, v.to.db, m.measure: Renamed G_units_to_meters_factor* to G_meters_to_units_factor*<br>
<br>
Modified: grass/trunk/include/defs/gis.h<br>
===================================================================<br>
--- grass/trunk/include/defs/gis.h 2014-05-22 14:42:19 UTC (rev 60413)<br>
+++ grass/trunk/include/defs/gis.h 2014-05-22 15:00:16 UTC (rev 60414)<br>
@@ -666,8 +666,8 @@<br>
void G_trim_decimal(char *);<br>
<br>
/* units.c */<br>
-double G_units_to_meters_factor(int);<br>
-double G_units_to_meters_factor_sq(int);<br>
+double G_meters_to_units_factor(int);<br>
+double G_meters_to_units_factor_sq(int);<br>
const char *G_get_units_name(int, int, int);<br>
int G_units(const char *);<br>
int G_is_units_type_spatial(int);<br>
<br>
Modified: grass/trunk/lib/gis/units.c<br>
===================================================================<br>
--- grass/trunk/lib/gis/units.c 2014-05-22 14:42:19 UTC (rev 60413)<br>
+++ grass/trunk/lib/gis/units.c 2014-05-22 15:00:16 UTC (rev 60414)<br>
@@ -19,7 +19,7 @@<br>
#include <grass/glocale.h><br>
<br>
/*!<br>
- \brief Units conversion to meters<br>
+ \brief Units conversion from meters to units<br>
<br>
Units codes (gis.h):<br>
- U_METERS<br>
@@ -27,14 +27,13 @@<br>
- U_MILES<br>
- U_FEET<br>
<br>
- Returns a factor which converts the grid unit to meters (by<br>
- multiplication).<br>
+ Returns a factor which converts meters to units (by multiplication).<br>
<br>
\param units units code<br>
<br>
\return factor<br>
*/<br>
-double G_units_to_meters_factor(int units)<br>
+double G_meters_to_units_factor(int units)<br>
{<br>
switch (units) {<br>
case U_METERS:<br>
@@ -62,7 +61,7 @@<br>
}<br>
<br>
/*!<br>
- \brief Units conversion to square meters<br>
+ \brief Units conversion from square meters to square units<br>
<br>
Units codes (gis.h):<br>
- U_METERS<br>
@@ -72,14 +71,14 @@<br>
- U_MILES<br>
- U_FEET<br>
<br>
- Returns a factor which converts the grid unit to square meters (by<br>
+ Returns a factor which converts square meters to square units (by<br>
multiplication).<br>
<br>
\param units units code<br>
<br>
\return factor<br>
*/<br>
-double G_units_to_meters_factor_sq(int units)<br>
+double G_meters_to_units_factor_sq(int units)<br>
{<br>
switch (units) {<br>
case U_METERS:<br>
<br>
Modified: grass/trunk/misc/m.measure/main.c<br>
===================================================================<br>
--- grass/trunk/misc/m.measure/main.c 2014-05-22 14:42:19 UTC (rev 60413)<br>
+++ grass/trunk/misc/m.measure/main.c 2014-05-22 15:00:16 UTC (rev 60414)<br>
@@ -82,8 +82,8 @@<br>
units_name = G_get_units_name(G_units(units->answer), 1, 0);<br>
sq_units_name = G_get_units_name(G_units(units->answer), 1, 1);<br>
}<br>
- f = G_units_to_meters_factor(G_units(units->answer));<br>
- sq_f = G_units_to_meters_factor_sq(G_units(units->answer));<br>
+ f = G_meters_to_units_factor(G_units(units->answer));<br>
+ sq_f = G_meters_to_units_factor_sq(G_units(units->answer));<br>
<br>
G_debug(1, "using '%s (%f) %s (%f)'",<br>
units_name, f, sq_units_name, sq_f);<br>
<br>
Modified: grass/trunk/raster/r.surf.area/area.c<br>
===================================================================<br>
--- grass/trunk/raster/r.surf.area/area.c 2014-05-22 14:42:19 UTC (rev 60413)<br>
+++ grass/trunk/raster/r.surf.area/area.c 2014-05-22 15:00:16 UTC (rev 60414)<br>
@@ -120,5 +120,5 @@<br>
if (units == U_UNDEFINED)<br>
return value;<br>
<br>
- return value * G_units_to_meters_factor_sq(units);<br>
+ return value * G_meters_to_units_factor_sq(units);<br>
}<br>
<br>
Modified: grass/trunk/vector/v.to.db/units.c<br>
===================================================================<br>
--- grass/trunk/vector/v.to.db/units.c 2014-05-22 14:42:19 UTC (rev 60413)<br>
+++ grass/trunk/vector/v.to.db/units.c 2014-05-22 15:00:16 UTC (rev 60414)<br>
@@ -7,8 +7,8 @@<br>
double f, sq_f;<br>
<br>
rad = 0;<br>
- f = G_units_to_meters_factor(options.units);<br>
- sq_f = G_units_to_meters_factor_sq(options.units);<br>
+ f = G_meters_to_units_factor(options.units);<br>
+ sq_f = G_meters_to_units_factor_sq(options.units);<br>
<br>
if (options.units == U_RADIANS)<br>
rad = 1;<br>
<br>
_______________________________________________<br>
grass-commit mailing list<br>
<a href="mailto:grass-commit@lists.osgeo.org">grass-commit@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-commit" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-commit</a><br>
</blockquote></div><br></div>