/[zanavi_public1]/navit/navit/navit.h
ZANavi

Contents of /navit/navit/navit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50 - (show annotations) (download)
Wed Jun 22 07:33:35 2016 UTC (7 years, 9 months ago) by zoff99
File MIME type: text/plain
File size: 15153 byte(s)
v2.0.51
1 /**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 /**
21 * Navit, a modular navigation system.
22 * Copyright (C) 2005-2008 Navit Team
23 *
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU Library General Public License
26 * version 2 as published by the Free Software Foundation.
27 *
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU Library General Public License for more details.
32 *
33 * You should have received a copy of the GNU Library General Public
34 * License along with this program; if not, write to the
35 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
36 * Boston, MA 02110-1301, USA.
37 */
38
39 #ifndef NAVIT_NAVIT_H
40 #define NAVIT_NAVIT_H
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 extern struct gui *main_loop_gui;
47 // defined in glib.h.
48 #ifndef __G_LIST_H__
49 struct _GList;
50 typedef struct _GList GList;
51 #endif
52
53
54 // color codes for colour attribute in OS;
55 #define __c_black "000000"
56 #define __c_gray "808080"
57 #define __c_maroon "800000"
58 #define __c_olive "808000"
59 #define __c_green "008000"
60 #define __c_teal "008080"
61 #define __c_navy "000080"
62 #define __c_purple "800080"
63
64 #define __c_white "FFFFFF"
65 #define __c_silver "C0C0C0"
66 #define __c_red "FF0000"
67 #define __c_yellow "FFFF00"
68 #define __c_lime "00FF00"
69 #define __c_aqua "00FFFF"
70 #define __c_blue "0000FF"
71 #define __c_fuchsia "FF00FF"
72
73 #define __c_brown "A52A2A"
74
75
76 // --------------------------------------------
77 // --
78 // minimum binfile map version needed for this version of ZANavi to work
79 #define NEED_MIN_BINFILE_MAPVERSION 4
80 // --
81 // --------------------------------------------
82
83 #define ROAD_ANGLE_IS_STRAIGHT_ABS 10
84 #define ROAD_ANGLE_DISTANCE_FOR_STRAIGHT 78
85
86 // --------------------------------------------
87 // --
88 // if the turn angle is greater than this (in degrees) in bicycle mode, then speak a turn command
89 #define ROAD_ANGLE_MIN_FOR_TURN_BICYCLEMODE 65
90 #define ROAD_ANGLE_MIN__FOR_TURN_BICYCLEMODE_ONLY_1_POSSIBILITY 25
91
92 #define ROAD_ANGLE_MIN_FOR_TURN_BICYCLEMODE_CYC_2_CYC 65
93 #define ROAD_ANGLE_MIN_FOR_TURN_BICYCLEMODE_CYC_2_CYC__2 25
94 // --
95 // --------------------------------------------
96
97
98 extern int allow_gui_internal;
99 extern int draw_display_at_speed;
100 extern int routing_mode; // 0-> normal highway routing
101 // 1-> normal roads routing
102 // 2-> future use
103 extern int offline_search_filter_duplicates;
104 extern int offline_search_break_searching;
105 extern char *navit_maps_dir;
106 extern char *navit_share_dir;
107 extern char* navit_data_dir;
108 extern int cancel_drawing_global;
109 extern int disable_map_drawing;
110 extern int global_speak_streetnames;
111
112 extern int allow_large_mapfiles;
113 extern int cache_size_file; /* cache size in bytes */
114 extern int draw_polylines_fast; // 1 -> dont draw circles at the end of polylines 0-> do draw circles
115
116 extern int limit_order_corrected;
117 extern int shift_order;
118 extern int global_search_street_size_factor;
119 extern int hold_drawing;
120 extern int global_stop_demo_vehicle;
121 extern int global_show_route_rectangles;
122 extern int global_traffic_light_delay;
123 extern int global_clinedrawing_active;
124 extern int global_draw_multipolygons;
125 extern int global_have_dpi_value;
126 extern float global_dpi_factor;
127 extern int global_order_level_for_fast_draw;
128 extern int global_show_english_labels;
129 extern int global_routing_engine;
130 extern float global_overspill_factor;
131
132 extern long long draw_lines_count_2;
133 extern long long draw_lines_count_3;
134 extern long long draw_lines_count_4;
135 extern int poi_on_map_count;
136 extern int label_on_map_count;
137 extern int label_district_on_map_count;
138 extern int label_major_on_map_count;
139 extern int poi_icon_on_map_count;
140
141
142 extern int mapdraw_time[11 + 5];
143 extern int cur_mapdraw_time_index;
144
145 extern int route_status_previous;
146 extern long long global_route_memory_size;
147 extern int global_old_vehicle_speed;
148 extern int global_old_vehicle_speed_for_autozoom;
149
150 extern int global_avoid_sharp_turns_flag;
151 extern int global_avoid_sharp_turns_min_angle;
152 extern int global_avoid_sharp_turns_min_penalty;
153
154 extern int global_search_radius_for_housenumbers;
155 extern int global_vehicle_profile;
156 extern int global_cycle_lanes_prio;
157 extern int global_cycle_track_prio;
158
159 extern double global_v_pos_lat;
160 extern double global_v_pos_lng;
161 extern double global_v_pos_dir;
162
163 extern int global_demo_vehicle;
164 extern int global_demo_vehicle_short_switch;
165 extern long global_last_spoken;
166 extern long global_last_spoken_base;
167 extern float global_road_speed_factor;
168
169 extern float global_level0_announcement;
170 extern float global_level1_announcement;
171 extern float global_level2_announcement;
172 extern float global_levelx_announcement_factor;
173 extern float global_b_level0_announcement;
174 extern float global_b_level1_announcement;
175 extern float global_b_level2_announcement;
176 extern float global_b_levelx_announcement_factor;
177
178 extern int global_driven_away_from_route;
179
180 extern int global_enhance_cycleway;
181 extern int global_tracking_show_real_gps_pos;
182 extern int global_show_maps_debug_view;
183 extern int global_cancel_preview_map_drawing;
184
185
186 #define MAX_DEBUG_COORDS 100
187
188 extern struct coord global_debug_route_seg_winner_start;
189 extern struct coord global_debug_route_seg_winner_end;
190 extern struct coord global_debug_seg_winner_start;
191 extern struct coord global_debug_seg_winner_end;
192 extern struct coord global_debug_route_seg_winner_p_start;
193 extern struct coord global_debug_seg_winner_p_start;
194 extern struct coord global_debug_seg_route_start;
195 extern struct coord global_debug_seg_route_end;
196 extern struct coord global_debug_trlast_start;
197 extern struct coord global_debug_trlast_end;
198 extern struct coord *global_debug_coord_list;
199 extern int global_debug_coord_list_items;
200 extern int global_has_gpsfix;
201 extern int global_pos_is_underground;
202
203 extern GList *global_all_cbs;
204
205 #include "coord.h"
206
207
208 #define MAX_SHARP_TURN_LIST_ENTRIES 500
209
210 struct global_sharp_turn
211 {
212 int dir;
213 int angle;
214 struct coord c1;
215 struct coord cs;
216 struct coord ce;
217 };
218
219
220 extern int global_sharp_turn_list_count;
221 extern struct global_sharp_turn *global_sharp_turn_list;
222
223
224
225
226 #define MAX_FREETEXT_LIST_ENTRIES 500
227 #define MAX_FREETEXT_ENTRY_LEN 300
228
229 struct global_freetext
230 {
231 struct coord c1;
232 char text[MAX_FREETEXT_ENTRY_LEN];
233 };
234
235
236 extern int global_freetext_list_count;
237 extern struct global_freetext *global_freetext_list;
238
239
240
241 // #ifndef MAPTOOL
242 extern GHashTable *global_transform_hash;
243 extern GHashTable *global_transform_hash2;
244 // #endif
245
246
247 /* prototypes */
248 enum attr_type;
249 struct attr;
250 struct attr_iter;
251 struct callback;
252 struct coord_rect;
253 struct displaylist;
254 struct graphics;
255 struct gui;
256 struct mapset;
257 struct message;
258 struct navigation;
259 struct navit;
260 struct pcoord;
261 struct point;
262 struct route;
263 struct tracking;
264 struct transformation;
265 struct vehicleprofile;
266 struct command_table;
267 void navit_add_mapset(struct navit *this_, struct mapset *ms);
268 struct mapset *navit_get_mapset(struct navit *this_);
269 struct tracking *navit_get_tracking(struct navit *this_);
270 char *navit_get_user_data_directory(int create);
271 void navit_draw_async(struct navit *this_, int async);
272 void navit_draw(struct navit *this_);
273 int navit_get_ready(struct navit *this_);
274 void navit_draw_displaylist(struct navit *this_);
275 void navit_handle_resize(struct navit *this_, int w, int h);
276 int navit_get_width(struct navit *this_);
277 int navit_get_height(struct navit *this_);
278 int navit_ignore_button(struct navit *this_);
279 void navit_ignore_graphics_events(struct navit *this_, int ignore);
280 void navit_set_timeout(struct navit *this_);
281 int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback);
282 void navit_handle_motion(struct navit *this_, struct point *p);
283 void navit_zoom_in(struct navit *this_, int factor, struct point *p);
284 void navit_zoom_out(struct navit *this_, int factor, struct point *p);
285 void navit_zoom_in_cursor(struct navit *this_, int factor);
286 void navit_zoom_out_cursor(struct navit *this_, int factor);
287 struct navit *navit_new(struct attr *parent, struct attr **attrs);
288 void navit_add_message(struct navit *this_, char *message);
289 struct message *navit_get_messages(struct navit *this_);
290 struct graphics *navit_get_graphics(struct navit *this_);
291 struct vehicleprofile *navit_get_vehicleprofile(struct navit *this_);
292 GList *navit_get_vehicleprofiles(struct navit *this_);
293 void navit_set_destination(struct navit *this_, struct pcoord *c, const char *description, int async);
294 void navit_set_destinations(struct navit *this_, struct pcoord *c, int count, const char *description, int async);
295 int navit_check_route(struct navit *this_);
296 void navit_textfile_debug_log(struct navit *this_, const char *fmt, ...);
297 void navit_textfile_debug_log_at(struct navit *this_, struct pcoord *pc, const char *fmt, ...);
298 int navit_speech_estimate(struct navit *this_, char *str);
299 void navit_say(struct navit *this_, char *text);
300 void navit_speak(struct navit *this_);
301 void navit_window_roadbook_destroy(struct navit *this_);
302 void navit_window_roadbook_new(struct navit *this_);
303 void navit_reload_maps(struct navit *this_);
304 void navit_predraw(struct navit *this_);
305 void navit_init(struct navit *this_);
306 void navit_zoom_to_rect(struct navit *this_, struct coord_rect *r);
307 void navit_zoom_to_route(struct navit *this_, int orientation);
308 void navit_set_center_no_draw(struct navit *this_, struct pcoord *center, int set_timeout);
309 void navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout);
310 void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orientation);
311 void navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout);
312 int navit_set_attr(struct navit *this_, struct attr *attr);
313 int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
314 int navit_add_attr(struct navit *this_, struct attr *attr);
315 int navit_remove_attr(struct navit *this_, struct attr *attr);
316 struct attr_iter *navit_attr_iter_new(void);
317 void navit_attr_iter_destroy(struct attr_iter *iter);
318 void navit_add_callback(struct navit *this_, struct callback *cb);
319 void navit_remove_callback(struct navit *this_, struct callback *cb);
320 void navit_set_position(struct navit *this_, struct pcoord *c);
321 struct gui *navit_get_gui(struct navit *this_);
322 struct transformation *navit_get_trans(struct navit *this_);
323 struct route *navit_get_route(struct navit *this_);
324 struct navigation *navit_get_navigation(struct navit *this_);
325 struct displaylist *navit_get_displaylist(struct navit *this_);
326 void navit_layout_switch(struct navit *n);
327 int navit_set_vehicle_by_name(struct navit *n, const char *name);
328 void navit_layer_set_active(struct navit *this, char *name, int active, int draw);
329 void navit_motion(void *data, struct point *p);
330 void displaylist_shift_order_in_map_layers(struct navit *this_, int shift_value);
331 void displaylist_shift_for_dpi_value_in_layers(struct navit *this_, double factor);
332 int navit_is_demo_vehicle();
333 void navit_zoom_to_scale_no_draw(struct navit *this_, int new_scale);
334 void navit_zoom_to_scale(struct navit *this_, int new_scale);
335
336
337 void navit_set_cursors(struct navit *this_);
338
339 #include "vehicle.h"
340 int navit_add_vehicle(struct navit *this_, struct vehicle *v);
341
342 int navit_set_layout_by_name(struct navit *n, const char *name);
343 void navit_disable_suspend(void);
344 int navit_block(struct navit *this_, int block);
345 void navit_destroy(struct navit *this_);
346 void navit_command_add_table(struct navit*this_, struct command_table *commands, int count);
347 //
348 // extern static int navit_get_cursor_pnt(struct navit *this_, struct point *p, int keep_orientation, int *dir);
349 int navit_get_cur_pnt(struct navit *this_, struct point *p);
350
351
352 #include "point.h"
353 #include "item.h"
354 #include "attr.h"
355
356 extern struct coord global_vehicle_pos_onscreen;
357 extern struct coord_geo global_last_vehicle_pos_geo;
358 // extern struct coord_geo global_cur_vehicle_pos_geo;
359 extern double ggggg_lat;
360 extern double ggggg_lon;
361
362
363 //! The navit_vehicule
364 struct navit_vehicle
365 {
366 int follow;
367 /*! Limit of the follow counter. See navit_add_vehicle */
368 int follow_curr;
369 /*! Deprecated : follow counter itself. When it reaches 'update' counts, map is recentered*/
370 struct coord coord;
371 int dir;
372 int speed;
373 struct coord last; /*< Position of the last update of this vehicle */
374 struct vehicle *vehicle;
375 struct attr callback;
376 int animate_cursor;
377 };
378
379 struct navit
380 {
381 struct attr self;
382 GList *mapsets;
383 GList *layouts;
384 struct gui *gui;
385 struct layout *layout_current;
386 struct graphics *gra;
387 struct action *action;
388 struct transformation *trans, *trans_cursor;
389 struct compass *compass;
390 struct route *route;
391 struct navigation *navigation;
392 struct speech *speech;
393 struct tracking *tracking;
394 int ready;
395 struct window *win;
396 struct displaylist *displaylist;
397 int tracking_flag;
398 int orientation;
399 int recentdest_count;
400 int osd_configuration;
401 GList *vehicles;
402 GList *windows_items;
403 struct navit_vehicle *vehicle;
404 struct callback_list *attr_cbl;
405 struct callback *nav_speech_cb, *roadbook_callback, *popup_callback, *route_cb, *progress_cb;
406 struct datawindow *roadbook_window;
407 struct map *former_destination;
408 struct point pressed, last, current;
409 int button_pressed, moved, popped, zoomed;
410 int center_timeout;
411 int autozoom_secs;
412 int autozoom_min;
413 int autozoom_active;
414 struct event_timeout *button_timeout, *motion_timeout;
415 struct callback *motion_timeout_callback;
416 int ignore_button;
417 int ignore_graphics_events;
418 struct log *textfile_debug_log;
419 struct pcoord destination;
420 int destination_valid;
421 int blocked;
422 int w, h;
423 int drag_bitmap;
424 int use_mousewheel;
425 struct messagelist *messages;
426 struct callback *resize_callback, *button_callback, *motion_callback, *predraw_callback;
427 struct vehicleprofile *vehicleprofile;
428 GList *vehicleprofiles;
429 int pitch;
430 int follow_cursor;
431 int prevTs;
432 int graphics_flags;
433 int zoom_min, zoom_max;
434 int radius;
435 struct bookmarks *bookmarks;
436 int flags;
437 /* 1=No graphics ok */
438 /* 2=No gui ok */
439 int border;
440 int imperial;
441 };
442
443 // global navit struct, needed almost everywhere
444 struct navit *global_navit;
445
446 // dirty global var for waypoint bitmap
447 struct graphics_image *global_img_waypoint;
448
449 char* g_strdup_printf_4_str(const char *format, const char *str1, const char *str2, const char *str3, const char *str4);
450 char* g_strdup_printf_2_str(const char *format, const char *str1, const char *str2);
451
452 /* end of prototypes */
453 #ifdef __cplusplus
454 }
455 #endif
456
457 #endif
458

   
Visit the ZANavi Wiki