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

Contents of /navit/navit/navit.h

Parent Directory Parent Directory | Revision Log Revision Log


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

   
Visit the ZANavi Wiki