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

Contents of /navit/navit/navit.h

Parent Directory Parent Directory | Revision Log Revision Log


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

   
Visit the ZANavi Wiki