123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /**
- * \file wind_format.c
- *
- * \brief GIS Library - Window formatting functions.
- *
- * (C) 2001-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2008
- */
- #include <stdio.h>
- #include <grass/gis.h>
- static int format_double(double, char *);
- /**
- * \brief Northing to ASCII.
- *
- * Converts the double representation of the <b>north</b> coordinate to
- * its ASCII representation (into <b>buf</b>).
- *
- * \param[in] north northing
- * \param[in,out] buf buffer to hold formatted string
- * \param[in] projection
- * \return always returns 0
- */
- int G_format_northing(double north, char *buf, int projection)
- {
- if (projection == PROJECTION_LL)
- G_lat_format(north, buf);
- else
- format_double(north, buf);
- return 0;
- }
- /**
- * \brief Easting to ASCII.
- *
- * Converts the double representation of the <b>east</b> coordinate to
- * its ASCII representation (into <b>buf</b>).
- *
- * \param[in] east easting
- * \param[in,out] buf buffer to hold formatted string
- * \param[in] projection
- * \return always returns 0
- */
- int G_format_easting(double east, char *buf, int projection)
- {
- if (projection == PROJECTION_LL)
- G_lon_format(east, buf);
- else
- format_double(east, buf);
- return 0;
- }
- /**
- * \brief Resolution to ASCII.
- *
- * Converts the double representation of the <b>resolution</b> to its
- * ASCII representation (into <b>buf</b>).
- *
- * \param[in] resolution
- * \param[in,out] buf buffer to hold formatted string
- * \param[in] projection
- * \return always returns 0
- */
- int G_format_resolution(double res, char *buf, int projection)
- {
- if (projection == PROJECTION_LL)
- G_llres_format(res, buf);
- else
- format_double(res, buf);
- return 0;
- }
- static int format_double(double value, char *buf)
- {
- sprintf(buf, "%.8f", value);
- G_trim_decimal(buf);
- return 0;
- }
|