Portability: remove dirname needs with g_mkdir_with_parents
[viking.git] / src / coords.h
bloba998fd532b1b8a890f5d8d2ed8ee24d0c23c1d5f
1 /*
2 coords.h
3 borrowed from:
4 http://acme.com/software/coords/
5 I (Evan Battaglia <viking@greentorch.org> have only made some small changes such as
6 renaming functions and defining LatLon and UTM structs.
7 */
8 /* coords.h - include file for coords routines
9 **
10 ** Copyright © 2001 by Jef Poskanzer <jef@acme.com>.
11 ** All rights reserved.
13 ** Redistribution and use in source and binary forms, with or without
14 ** modification, are permitted provided that the following conditions
15 ** are met:
16 ** 1. Redistributions of source code must retain the above copyright
17 ** notice, this list of conditions and the following disclaimer.
18 ** 2. Redistributions in binary form must reproduce the above copyright
19 ** notice, this list of conditions and the following disclaimer in the
20 ** documentation and/or other materials provided with the distribution.
22 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 ** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 ** SUCH DAMAGE.
35 #ifndef _VIKING_COORDS_H
36 #define _VIKING_COORDS_H
38 #include <glib.h>
40 struct UTM {
41 gdouble northing;
42 gdouble easting;
43 gchar zone;
44 gchar letter;
47 struct LatLon {
48 gdouble lat;
49 gdouble lon;
52 int a_coords_utm_equal( const struct UTM *utm1, const struct UTM *utm2 );
53 void a_coords_latlon_to_utm ( const struct LatLon *latlon, struct UTM *utm );
54 void a_coords_utm_to_latlon ( const struct UTM *utm, struct LatLon *latlon );
55 double a_coords_utm_diff( const struct UTM *utm1, const struct UTM *utm2 );
56 double a_coords_latlon_diff ( const struct LatLon *ll1, const struct LatLon *ll2 );
58 /**
59 * Convert a double to a string WITHOUT LOCALE.
61 * Following GPX specifications, decimal values are xsd:decimal
62 * So, they must use the period separator, not the localized one.
64 * The returned value must be freed by g_free.
66 char *a_coords_dtostr ( double d );
70 #endif