navit  0.5.3-trunk
transform.h
Go to the documentation of this file.
1 
20 #ifndef NAVIT_TRANSFORM_H
21 #define NAVIT_TRANSFORM_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 #include "coord.h"
27 
28 #define TRANSFORM_ERR_BUF_SPACE -1
29 
30 /* prototypes */
31 enum attr_type;
32 enum item_type;
33 enum map_datum;
34 enum projection;
35 struct attr;
36 struct attr_iter;
37 struct coord;
38 struct coord_geo;
39 struct coord_geo_cart;
40 struct map_selection;
41 struct pcoord;
42 struct point;
43 struct transformation;
44 struct transformation *transform_new(struct pcoord *center, int scale, int yaw);
45 int transform_get_hog(struct transformation *this_);
46 void transform_set_hog(struct transformation *this_, int hog);
47 int transform_get_attr(struct transformation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
48 int transform_set_attr(struct transformation *this_, struct attr *attr);
50 void transform_set_order_base(struct transformation *this_, int order_base);
52 void transform_to_geo(enum projection pro, const struct coord *c, struct coord_geo *g);
53 void transform_from_geo(enum projection pro, const struct coord_geo *g, struct coord *c);
54 void transform_from_to_count(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to, int count);
55 void transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to);
56 void transform_geo_to_cart(struct coord_geo *geo, navit_float a, navit_float b, struct coord_geo_cart *cart);
57 void transform_cart_to_geo(struct coord_geo_cart *cart, navit_float a, navit_float b, struct coord_geo *geo);
58 void transform_utm_to_geo(const double UTMEasting, const double UTMNorthing, int ZoneNumber, int NorthernHemisphere, struct coord_geo *geo);
59 void transform_datum(struct coord_geo *from, enum map_datum from_datum, struct coord_geo *to, enum map_datum to_datum);
60 int transform_point(struct transformation *t, enum projection pro, struct coord *c, struct point *p);
61 int transform_point_buf(struct transformation *t, enum projection pro, struct coord *c, struct point *p, long result_size, int count, int mindist, int width, int *width_return);
62 int transform_reverse(struct transformation *t, struct point *p, struct coord *c);
65 void transform_set_projection(struct transformation *this_, enum projection pro);
66 struct map_selection *transform_get_selection(struct transformation *this_, enum projection pro, int order);
67 struct coord *transform_center(struct transformation *this_);
68 struct coord *transform_get_center(struct transformation *this_);
69 void transform_set_center(struct transformation *this_, struct coord *c);
70 void transform_set_yaw(struct transformation *t, int yaw);
71 int transform_get_yaw(struct transformation *this_);
72 void transform_set_pitch(struct transformation *this_, int pitch);
73 int transform_get_pitch(struct transformation *this_);
74 void transform_set_roll(struct transformation *this_, int roll);
75 int transform_get_roll(struct transformation *this_);
76 void transform_set_distance(struct transformation *this_, int distance);
77 int transform_get_distance(struct transformation *this_);
78 void transform_set_scales(struct transformation *this_, int xscale, int yscale, int wscale);
80 void transform_set_screen_center(struct transformation *t, struct point *p);
81 void transform_get_size(struct transformation *t, int *width, int *height);
82 void transform_setup(struct transformation *t, struct pcoord *c, int scale, int yaw);
84 long transform_get_scale(struct transformation *t);
85 void transform_set_scale(struct transformation *t, long scale);
86 int transform_get_order(struct transformation *t);
87 double transform_scale(int y);
88 double transform_distance(enum projection pro, struct coord *c1, struct coord *c2);
89 void transform_project(enum projection pro, struct coord *c, int distance, int angle, struct coord *res);
90 double transform_polyline_length(enum projection pro, struct coord *c, int count);
91 int transform_distance_sq(struct coord *c1, struct coord *c2);
93 int transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2);
94 int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt);
95 navit_float transform_distance_line_sq_float(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt);
96 int transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos);
97 int transform_douglas_peucker(struct coord *in, int count, int dist_sq, struct coord *out);
98 int transform_douglas_peucker_float(struct coord *in, int count, navit_float dist_sq, struct coord *out);
99 void transform_print_deg(double deg);
100 int transform_get_angle_delta(struct coord *c1, struct coord *c2, int dir);
101 int transform_within_border(struct transformation *this_, struct point *p, int border);
102 int transform_within_dist_point(struct coord *ref, struct coord *c, int dist);
103 int transform_within_dist_line(struct coord *ref, struct coord *c0, struct coord *c1, int dist);
104 int transform_within_dist_polyline(struct coord *ref, struct coord *c, int count, int close, int dist);
105 int transform_within_dist_polygon(struct coord *ref, struct coord *c, int count, int dist);
106 int transform_within_dist_item(struct coord *ref, enum item_type type, struct coord *c, int count, int dist);
107 void transform_copy(struct transformation *src, struct transformation *dst);
108 void transform_destroy(struct transformation *t);
109 /* end of prototypes */
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif
attr_type
Definition: attr.h:34
double navit_float
Definition: coord.h:79
struct tcoord center
Definition: garmin_img.c:2
unsigned short width
Definition: garmin_img.c:3
char type[3]
Definition: garmin_img.c:2
unsigned short height
Definition: garmin_img.c:4
static double c2
Definition: geod_for.c:27
static double c1
Definition: geod_for.c:27
item_type
Definition: item.h:29
unsigned char p[5]
Definition: mg.h:2
pos
Definition: startup.py:3
static struct pcoord c
Definition: popup.c:375
map_datum
Definition: projection.h:31
projection
Definition: projection.h:23
static double dist_sq(double x1, double y1, double x2, double y2)
Definition: quadtree.c:61
Definition: config_.c:47
Definition: attr.h:157
A cartesian coordinate.
Definition: coord.h:103
A WGS84 coordinate.
Definition: coord.h:97
Definition: coord.h:34
int y
Definition: coord.h:36
Used to select data from a map.
Definition: map.h:58
int order
Definition: map.h:64
Definition: coord.h:52
Definition: point.h:23
The parameters needed to transform a map for display.
Definition: transform.c:64
int order_base
Definition: transform.c:91
int yaw
Definition: transform.c:65
enum projection pro
Definition: transform.c:87
navit_float scale
Definition: transform.c:88
int transform_get_pitch(struct transformation *this_)
Definition: transform.c:798
void transform_set_screen_center(struct transformation *t, struct point *p)
Definition: transform.c:844
void transform_get_size(struct transformation *t, int *width, int *height)
Definition: transform.c:848
enum projection transform_get_projection(struct transformation *this_)
Definition: transform.c:706
navit_float transform_distance_sq_float(struct coord *c1, struct coord *c2)
Definition: transform.c:1139
int transform_point(struct transformation *t, enum projection pro, struct coord *c, struct point *p)
Definition: transform.c:548
void transform_setup(struct transformation *t, struct pcoord *c, int scale, int yaw)
int transform_within_dist_line(struct coord *ref, struct coord *c0, struct coord *c1, int dist)
Definition: transform.c:1417
int transform_within_dist_point(struct coord *ref, struct coord *c, int dist)
Definition: transform.c:1403
void transform_to_geo(enum projection pro, const struct coord *c, struct coord_geo *g)
Transform the coordinates of a geographical point from a coord representation to a geographical (lat,...
Definition: transform.c:273
int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt)
Determines the point on a line segment that is closest to a reference point, and its distance from th...
Definition: transform.c:1165
double transform_polyline_length(enum projection pro, struct coord *c, int count)
Definition: transform.c:1097
int transform_douglas_peucker_float(struct coord *in, int count, navit_float dist_sq, struct coord *out)
Definition: transform.c:1288
void transform_print_deg(double deg)
Definition: transform.c:1312
int transform_get_distance(struct transformation *this_)
Definition: transform.c:824
int transform_get_order(struct transformation *t)
Definition: transform.c:953
void transform_copy(struct transformation *src, struct transformation *dst)
Definition: transform.c:1498
int transform_within_dist_polyline(struct coord *ref, struct coord *c, int count, int close, int dist)
Definition: transform.c:1461
void transform_from_geo(enum projection pro, const struct coord_geo *g, struct coord *c)
Transform the coordinates of a geographical point from a geographical (lat, long) representation to a...
Definition: transform.c:309
void transform_set_hog(struct transformation *this_, int hog)
Definition: transform.c:208
int transformation_get_order_base(struct transformation *this_)
Definition: transform.c:243
int transform_point_buf(struct transformation *t, enum projection pro, struct coord *c, struct point *p, long result_size, int count, int mindist, int width, int *width_return)
Definition: transform.c:553
void transform_set_pitch(struct transformation *this_, int pitch)
Definition: transform.c:794
int transform_reverse(struct transformation *t, struct point *p, struct coord *c)
Definition: transform.c:686
struct transformation * transform_dup(struct transformation *t)
Definition: transform.c:253
int transform_get_roll(struct transformation *this_)
Definition: transform.c:811
void transform_set_order_base(struct transformation *this_, int order_base)
Definition: transform.c:247
void transform_geo_to_cart(struct coord_geo *geo, navit_float a, navit_float b, struct coord_geo_cart *cart)
Transforms geodetic to Cartesian coordinates.
Definition: transform.c:355
int transform_get_attr(struct transformation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition: transform.c:217
struct coord * transform_get_center(struct transformation *this_)
Definition: transform.c:776
struct transformation * transform_new(struct pcoord *center, int scale, int yaw)
Definition: transform.c:190
void transform_set_yaw(struct transformation *t, int yaw)
Definition: transform.c:785
void transform_set_roll(struct transformation *this_, int roll)
Definition: transform.c:802
int transform_get_hog(struct transformation *this_)
Definition: transform.c:204
void transform_set_scale(struct transformation *t, long scale)
Definition: transform.c:947
void transform_set_distance(struct transformation *this_, int distance)
Definition: transform.c:819
double transform_pixels_to_map_distance(struct transformation *transformation, int pixels)
Definition: transform.c:690
int transform_douglas_peucker(struct coord *in, int count, int dist_sq, struct coord *out)
Definition: transform.c:1266
int transform_get_yaw(struct transformation *this_)
Definition: transform.c:790
int transform_within_border(struct transformation *this_, struct point *p, int border)
Definition: transform.c:1391
int transform_get_angle_delta(struct coord *c1, struct coord *c2, int dir)
Gets the bearing from one point to another.
Definition: transform.c:1373
int transform_distance_sq(struct coord *c1, struct coord *c2)
Determines the squared Mercator distance between two points.
Definition: transform.c:1129
int transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos)
Determines the point on a polyline that is closest to a reference point, and its distance from the re...
Definition: transform.c:1245
void transform_destroy(struct transformation *t)
Definition: transform.c:1502
void transform_cart_to_geo(struct coord_geo_cart *cart, navit_float a, navit_float b, struct coord_geo *geo)
Transforms Cartesian to geodetic coordinates.
Definition: transform.c:375
void transform_set_scales(struct transformation *this_, int xscale, int yscale, int wscale)
Definition: transform.c:828
void transform_project(enum projection pro, struct coord *c, int distance, int angle, struct coord *res)
Definition: transform.c:1081
void transform_set_projection(struct transformation *this_, enum projection pro)
Definition: transform.c:710
void transform_setup_source_rect(struct transformation *t)
Definition: transform.c:857
struct map_selection * transform_get_selection(struct transformation *this_, enum projection pro, int order)
Definition: transform.c:737
void transform_set_center(struct transformation *this_, struct coord *c)
Definition: transform.c:780
double transform_distance(enum projection pro, struct coord *c1, struct coord *c2)
Calculates the distance between two points.
Definition: transform.c:1037
void transform_from_to_count(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to, int count)
Definition: transform.c:324
void transform_utm_to_geo(const double UTMEasting, const double UTMNorthing, int ZoneNumber, int NorthernHemisphere, struct coord_geo *geo)
Converts UTM coords to lat/long.
Definition: transform.c:398
void transform_set_screen_selection(struct transformation *t, struct map_selection *sel)
Definition: transform.c:834
struct coord * transform_center(struct transformation *this_)
Definition: transform.c:771
long transform_get_scale(struct transformation *t)
Definition: transform.c:943
int transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2)
Definition: transform.c:1145
navit_float transform_distance_line_sq_float(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt)
Definition: transform.c:1203
void transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to)
Definition: transform.c:337
int transform_within_dist_polygon(struct coord *ref, struct coord *c, int count, int dist)
Definition: transform.c:1473
int transform_within_dist_item(struct coord *ref, enum item_type type, struct coord *c, int count, int dist)
Definition: transform.c:1490
int transform_set_attr(struct transformation *this_, struct attr *attr)
Definition: transform.c:231
double transform_scale(int y)
Definition: transform.c:1001
void transform_datum(struct coord_geo *from, enum map_datum from_datum, struct coord_geo *to, enum map_datum to_datum)