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

Contents of /navit/navit/navit.h

Parent Directory Parent Directory | Revision Log Revision Log


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

   
Visit the ZANavi Wiki