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

Contents of /navit/navit/navit.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 41 - (show annotations) (download)
Tue Aug 11 18:50:37 2015 UTC (8 years, 7 months ago) by zoff99
File MIME type: text/plain
File size: 15038 byte(s)
many fixes, and new features
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
183
184 #define MAX_DEBUG_COORDS 100
185
186 extern struct coord global_debug_route_seg_winner_start;
187 extern struct coord global_debug_route_seg_winner_end;
188 extern struct coord global_debug_seg_winner_start;
189 extern struct coord global_debug_seg_winner_end;
190 extern struct coord global_debug_route_seg_winner_p_start;
191 extern struct coord global_debug_seg_winner_p_start;
192 extern struct coord global_debug_seg_route_start;
193 extern struct coord global_debug_seg_route_end;
194 extern struct coord global_debug_trlast_start;
195 extern struct coord global_debug_trlast_end;
196 extern struct coord *global_debug_coord_list;
197 extern int global_debug_coord_list_items;
198 extern int global_has_gpsfix;
199 extern int global_pos_is_underground;
200
201 extern GList *global_all_cbs;
202
203 #include "coord.h"
204
205
206 #define MAX_SHARP_TURN_LIST_ENTRIES 500
207
208 struct global_sharp_turn
209 {
210 int dir;
211 int angle;
212 struct coord c1;
213 struct coord cs;
214 struct coord ce;
215 };
216
217
218 extern int global_sharp_turn_list_count;
219 extern struct global_sharp_turn *global_sharp_turn_list;
220
221
222
223
224 #define MAX_FREETEXT_LIST_ENTRIES 500
225 #define MAX_FREETEXT_ENTRY_LEN 300
226
227 struct global_freetext
228 {
229 struct coord c1;
230 char text[MAX_FREETEXT_ENTRY_LEN];
231 };
232
233
234 extern int global_freetext_list_count;
235 extern struct global_freetext *global_freetext_list;
236
237
238
239
240 extern GHashTable *global_transform_hash;
241 extern GHashTable *global_transform_hash2;
242
243 /* prototypes */
244 enum attr_type;
245 struct attr;
246 struct attr_iter;
247 struct callback;
248 struct coord_rect;
249 struct displaylist;
250 struct graphics;
251 struct gui;
252 struct mapset;
253 struct message;
254 struct navigation;
255 struct navit;
256 struct pcoord;
257 struct point;
258 struct route;
259 struct tracking;
260 struct transformation;
261 struct vehicleprofile;
262 struct command_table;
263 void navit_add_mapset(struct navit *this_, struct mapset *ms);
264 struct mapset *navit_get_mapset(struct navit *this_);
265 struct tracking *navit_get_tracking(struct navit *this_);
266 char *navit_get_user_data_directory(int create);
267 void navit_draw_async(struct navit *this_, int async);
268 void navit_draw(struct navit *this_);
269 int navit_get_ready(struct navit *this_);
270 void navit_draw_displaylist(struct navit *this_);
271 void navit_handle_resize(struct navit *this_, int w, int h);
272 int navit_get_width(struct navit *this_);
273 int navit_get_height(struct navit *this_);
274 int navit_ignore_button(struct navit *this_);
275 void navit_ignore_graphics_events(struct navit *this_, int ignore);
276 void navit_set_timeout(struct navit *this_);
277 int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback);
278 void navit_handle_motion(struct navit *this_, struct point *p);
279 void navit_zoom_in(struct navit *this_, int factor, struct point *p);
280 void navit_zoom_out(struct navit *this_, int factor, struct point *p);
281 void navit_zoom_in_cursor(struct navit *this_, int factor);
282 void navit_zoom_out_cursor(struct navit *this_, int factor);
283 struct navit *navit_new(struct attr *parent, struct attr **attrs);
284 void navit_add_message(struct navit *this_, char *message);
285 struct message *navit_get_messages(struct navit *this_);
286 struct graphics *navit_get_graphics(struct navit *this_);
287 struct vehicleprofile *navit_get_vehicleprofile(struct navit *this_);
288 GList *navit_get_vehicleprofiles(struct navit *this_);
289 void navit_set_destination(struct navit *this_, struct pcoord *c, const char *description, int async);
290 void navit_set_destinations(struct navit *this_, struct pcoord *c, int count, const char *description, int async);
291 int navit_check_route(struct navit *this_);
292 void navit_textfile_debug_log(struct navit *this_, const char *fmt, ...);
293 void navit_textfile_debug_log_at(struct navit *this_, struct pcoord *pc, const char *fmt, ...);
294 int navit_speech_estimate(struct navit *this_, char *str);
295 void navit_say(struct navit *this_, char *text);
296 void navit_speak(struct navit *this_);
297 void navit_window_roadbook_destroy(struct navit *this_);
298 void navit_window_roadbook_new(struct navit *this_);
299 void navit_reload_maps(struct navit *this_);
300 void navit_predraw(struct navit *this_);
301 void navit_init(struct navit *this_);
302 void navit_zoom_to_rect(struct navit *this_, struct coord_rect *r);
303 void navit_zoom_to_route(struct navit *this_, int orientation);
304 void navit_set_center_no_draw(struct navit *this_, struct pcoord *center, int set_timeout);
305 void navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout);
306 void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orientation);
307 void navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout);
308 int navit_set_attr(struct navit *this_, struct attr *attr);
309 int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
310 int navit_add_attr(struct navit *this_, struct attr *attr);
311 int navit_remove_attr(struct navit *this_, struct attr *attr);
312 struct attr_iter *navit_attr_iter_new(void);
313 void navit_attr_iter_destroy(struct attr_iter *iter);
314 void navit_add_callback(struct navit *this_, struct callback *cb);
315 void navit_remove_callback(struct navit *this_, struct callback *cb);
316 void navit_set_position(struct navit *this_, struct pcoord *c);
317 struct gui *navit_get_gui(struct navit *this_);
318 struct transformation *navit_get_trans(struct navit *this_);
319 struct route *navit_get_route(struct navit *this_);
320 struct navigation *navit_get_navigation(struct navit *this_);
321 struct displaylist *navit_get_displaylist(struct navit *this_);
322 void navit_layout_switch(struct navit *n);
323 int navit_set_vehicle_by_name(struct navit *n, const char *name);
324 void navit_layer_set_active(struct navit *this, char *name, int active, int draw);
325 void navit_motion(void *data, struct point *p);
326 void displaylist_shift_order_in_map_layers(struct navit *this_, int shift_value);
327 void displaylist_shift_for_dpi_value_in_layers(struct navit *this_, double factor);
328 int navit_is_demo_vehicle();
329 void navit_zoom_to_scale_no_draw(struct navit *this_, int new_scale);
330 void navit_zoom_to_scale(struct navit *this_, int new_scale);
331
332
333 void navit_set_cursors(struct navit *this_);
334
335 #include "vehicle.h"
336 int navit_add_vehicle(struct navit *this_, struct vehicle *v);
337
338 int navit_set_layout_by_name(struct navit *n, const char *name);
339 void navit_disable_suspend(void);
340 int navit_block(struct navit *this_, int block);
341 void navit_destroy(struct navit *this_);
342 void navit_command_add_table(struct navit*this_, struct command_table *commands, int count);
343 //
344 // extern static int navit_get_cursor_pnt(struct navit *this_, struct point *p, int keep_orientation, int *dir);
345 int navit_get_cur_pnt(struct navit *this_, struct point *p);
346
347
348 #include "point.h"
349 #include "item.h"
350 #include "attr.h"
351
352 extern struct coord global_vehicle_pos_onscreen;
353 extern struct coord_geo global_last_vehicle_pos_geo;
354 // extern struct coord_geo global_cur_vehicle_pos_geo;
355 extern double ggggg_lat;
356 extern double ggggg_lon;
357
358
359 //! The navit_vehicule
360 struct navit_vehicle
361 {
362 int follow;
363 /*! Limit of the follow counter. See navit_add_vehicle */
364 int follow_curr;
365 /*! Deprecated : follow counter itself. When it reaches 'update' counts, map is recentered*/
366 struct coord coord;
367 int dir;
368 int speed;
369 struct coord last; /*< Position of the last update of this vehicle */
370 struct vehicle *vehicle;
371 struct attr callback;
372 int animate_cursor;
373 };
374
375 struct navit
376 {
377 struct attr self;
378 GList *mapsets;
379 GList *layouts;
380 struct gui *gui;
381 struct layout *layout_current;
382 struct graphics *gra;
383 struct action *action;
384 struct transformation *trans, *trans_cursor;
385 struct compass *compass;
386 struct route *route;
387 struct navigation *navigation;
388 struct speech *speech;
389 struct tracking *tracking;
390 int ready;
391 struct window *win;
392 struct displaylist *displaylist;
393 int tracking_flag;
394 int orientation;
395 int recentdest_count;
396 int osd_configuration;
397 GList *vehicles;
398 GList *windows_items;
399 struct navit_vehicle *vehicle;
400 struct callback_list *attr_cbl;
401 struct callback *nav_speech_cb, *roadbook_callback, *popup_callback, *route_cb, *progress_cb;
402 struct datawindow *roadbook_window;
403 struct map *former_destination;
404 struct point pressed, last, current;
405 int button_pressed, moved, popped, zoomed;
406 int center_timeout;
407 int autozoom_secs;
408 int autozoom_min;
409 int autozoom_active;
410 struct event_timeout *button_timeout, *motion_timeout;
411 struct callback *motion_timeout_callback;
412 int ignore_button;
413 int ignore_graphics_events;
414 struct log *textfile_debug_log;
415 struct pcoord destination;
416 int destination_valid;
417 int blocked;
418 int w, h;
419 int drag_bitmap;
420 int use_mousewheel;
421 struct messagelist *messages;
422 struct callback *resize_callback, *button_callback, *motion_callback, *predraw_callback;
423 struct vehicleprofile *vehicleprofile;
424 GList *vehicleprofiles;
425 int pitch;
426 int follow_cursor;
427 int prevTs;
428 int graphics_flags;
429 int zoom_min, zoom_max;
430 int radius;
431 struct bookmarks *bookmarks;
432 int flags;
433 /* 1=No graphics ok */
434 /* 2=No gui ok */
435 int border;
436 int imperial;
437 };
438
439 // global navit struct, needed almost everywhere
440 struct navit *global_navit;
441
442 // dirty global var for waypoint bitmap
443 struct graphics_image *global_img_waypoint;
444
445 char* g_strdup_printf_4_str(const char *format, const char *str1, const char *str2, const char *str3, const char *str4);
446 char* g_strdup_printf_2_str(const char *format, const char *str1, const char *str2);
447
448 /* end of prototypes */
449 #ifdef __cplusplus
450 }
451 #endif
452
453 #endif
454

   
Visit the ZANavi Wiki