62c45f5a901c1bd32a5f23a1ee0253d9c9e830a6
[navit-package] / navit / coord.h
1 #ifndef NAVIT_COORD_H
2 #define NAVIT_COORD_H
3 #include "projection.h"
4
5 /*! A integer mercator coordinate */
6 struct coord {
7         int x; /*!< X-Value */
8         int y; /*!< Y-Value */
9 };
10
11 /*! A integer mercator coordinate carrying its projection */
12 struct pcoord {
13         enum projection pro;
14         int x; /*!< X-Value */
15         int y; /*!< Y-Value */
16 };
17
18 struct coord_rect {
19         struct coord lu;
20         struct coord rl;
21 };
22
23 //! A double mercator coordinate
24 struct coord_d {
25         double x; /*!< X-Value */
26         double y; /*!< Y-Value */
27 };
28
29 //! A WGS84 coordinate
30 struct coord_geo {
31         double lng; /*!< Longitude */
32         double lat; /*!< Latitude */
33 };
34
35 //! A cartesian coordinate 
36 struct coord_geo_cart {
37         double x; /*!< X-Value */
38         double y; /*!< Y-Value */
39         double z; /*!< Z-Value */
40 };
41
42 enum projection;
43
44 struct coord * coord_get(unsigned char **p);
45 struct coord * coord_new(int x, int y);
46 void coord_destroy(struct coord *c);
47 int coord_parse(const char *c_str, enum projection pro, struct coord *c_ret);
48 struct coord_rect * coord_rect_new(struct coord *lu, struct coord *rl);
49 void coord_rect_destroy(struct coord_rect *r);
50 int coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2);
51 int coord_rect_contains(struct coord_rect *r, struct coord *c);
52 void coord_rect_extend(struct coord_rect *r, struct coord *c);
53
54
55 #endif