/[zanavi_public1]/navit/navit/navigation.c
ZANavi

Diff of /navit/navit/navigation.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 47 Revision 48
44#include <glib.h> 44#include <glib.h>
45#include "debug.h" 45#include "debug.h"
46#include "profile.h" 46#include "profile.h"
47#include "navigation.h" 47#include "navigation.h"
48#include "coord.h" 48#include "coord.h"
49#include "item.h" 49
50#include "route.h" 50#include "route.h"
51#include "transform.h" 51#include "transform.h"
52#include "mapset.h" 52#include "mapset.h"
53#include "projection.h" 53#include "projection.h"
54#include "map.h" 54#include "map.h"
100 char *fullname; 100 char *fullname;
101 char *abbrev; 101 char *abbrev;
102 int sex; 102 int sex;
103} suffixes[] = { { "weg", NULL, 1 }, { "platz", "pl.", 1 }, { "ring", NULL, 1 }, { "allee", NULL, 2 }, { "gasse", NULL, 2 }, { "straße", "str.", 2 }, { "strasse", NULL, 2 }, }; 103} suffixes[] = { { "weg", NULL, 1 }, { "platz", "pl.", 1 }, { "ring", NULL, 1 }, { "allee", NULL, 2 }, { "gasse", NULL, 2 }, { "straße", "str.", 2 }, { "strasse", NULL, 2 }, };
104 104
105struct navigation
106{
107 struct route *route;
108 struct map *map;
109 struct item_hash *hash;
110 struct vehicleprofile *vehicleprofile;
111 struct navigation_itm *first;
112 struct navigation_itm *last;
113 struct navigation_command *cmd_first;
114 struct navigation_command *cmd_last;
115 struct callback_list *callback_speech;
116 struct callback_list *callback;
117 struct navit *navit;
118 struct speech *speech;
119 int level_last;
120 struct item item_last;
121 int turn_around;
122 int turn_around_limit;
123 int distance_turn;
124 struct callback *route_cb;
125 int announce[route_item_last - route_item_first + 1][3];
126 int tell_street_name;
127 int delay;
128 int curr_delay;
129 struct navigation_itm *previous;
130 struct navigation_command *cmd_previous;
131};
132 105
133int distances[] = { 1, 2, 3, 4, 5, 10, 25, 50, 75, 100, 150, 200, 250, 300, 400, 500, 750, -1 }; 106int distances[] = { 1, 2, 3, 4, 5, 10, 25, 50, 75, 100, 150, 200, 250, 300, 400, 500, 750, -1 };
134 107
135 108
136 109
256 char *destination; 229 char *destination;
257}; 230};
258// -- NEW 002 -- 231// -- NEW 002 --
259 232
260 233
261/**
262 * @brief Holds a way that one could possibly drive from a navigation item
263 */
264struct navigation_way
265{
266 struct navigation_way *next; /**< Pointer to a linked-list of all navigation_ways from this navigation item */
267 short dir; /**< The direction -1 or 1 of the way */
268 short angle2; /**< The angle one has to steer to drive from the old item to this street */
269 int flags; /**< The flags of the way */
270 struct item item; /**< The item of the way */
271 char *name1; // = streetname
272 char *name2; // = streetname systematic (road number e.g.: E51)
273
274// -- NEW 002 --
275// char *name_systematic; /**< The road number ({@code street_name_systematic} attribute, OSM: {@code ref}) */
276 char *exit_ref; /**< Exit_ref if found on the first node of the way*/
277 char *exit_label; /**< Exit_label if found on the first node of the way*/
278 struct street_destination *s_destination; /**< The destination this way leads to (OSM: {@code destination}) */
279 char *street_dest_text; /* selected destination to display in GUI */
280// -- NEW 002 --
281
282};
283
284struct navigation_itm
285{
286 struct navigation_way way;
287 int angle_end;
288 struct coord start, end;
289 int time;
290 int length;
291 int speed;
292 int dest_time;
293 int dest_length;
294 int told; /**< Indicates if this item's announcement has been told earlier and should not be told again*/
295 int streetname_told; /**< Indicates if this item's streetname has been told in speech navigation*/
296 int dest_count;
297 struct navigation_itm *next;
298 struct navigation_itm *prev;
299};
300
301
302
303
304
305
306
307
308
309
310 234
311 235
312 236
313static void navigation_flush(struct navigation *this_); 237static void navigation_flush(struct navigation *this_);
314 238
2733 if (direction < 0) 2657 if (direction < 0)
2734 { 2658 {
2735 if (angle_delta(curr->prev->angle_end, w->angle2) < 0) 2659 if (angle_delta(curr->prev->angle_end, w->angle2) < 0)
2736 { 2660 {
2737 count++; 2661 count++;
2662
2663#ifdef NAVIT_DEBUG_COORD_DIE2TE_LIST
2664// ------- DEBUG ---------
2665// ------- DEBUG ---------
2666// ------- DEBUG ---------
2667 if ((global_debug_coord_list_items + 2) > MAX_DEBUG_COORDS)
2668 {
2669 global_debug_coord_list_items = 0;
2670 }
2671
2672 struct coord c2[5];
2673
2674 if (navigation_get_real_item_first_coord(w, c2))
2675 {
2676 global_debug_coord_list[global_debug_coord_list_items].x = c2[0].x;
2677 global_debug_coord_list[global_debug_coord_list_items].y = c2[0].y;
2678 global_debug_coord_list_items++;
2679 global_debug_coord_list[global_debug_coord_list_items].x = c2[1].x;
2680 global_debug_coord_list[global_debug_coord_list_items].y = c2[1].y;
2681 global_debug_coord_list_items++;
2682 }
2683// ------- DEBUG ---------
2684// ------- DEBUG ---------
2685// ------- DEBUG ---------
2686#endif
2687
2688
2738 break; 2689 break;
2739 } 2690 }
2740 } 2691 }
2741 else if (direction > 0) 2692 else if (direction > 0)
2742 { 2693 {
2743 if (angle_delta(curr->prev->angle_end, w->angle2) > 0) 2694 if (angle_delta(curr->prev->angle_end, w->angle2) > 0)
2744 { 2695 {
2745 count++; 2696 count++;
2697#ifdef NAVIT_DEBUG_COORD_DIE2TE_LIST
2698// ------- DEBUG ---------
2699// ------- DEBUG ---------
2700// ------- DEBUG ---------
2701 if ((global_debug_coord_list_items + 2) > MAX_DEBUG_COORDS)
2702 {
2703 global_debug_coord_list_items = 0;
2704 }
2705
2706 struct coord c2[5];
2707
2708 if (navigation_get_real_item_first_coord(w, c2))
2709 {
2710 global_debug_coord_list[global_debug_coord_list_items].x = c2[0].x;
2711 global_debug_coord_list[global_debug_coord_list_items].y = c2[0].y;
2712 global_debug_coord_list_items++;
2713 global_debug_coord_list[global_debug_coord_list_items].x = c2[1].x;
2714 global_debug_coord_list[global_debug_coord_list_items].y = c2[1].y;
2715 global_debug_coord_list_items++;
2716 }
2717// ------- DEBUG ---------
2718// ------- DEBUG ---------
2719// ------- DEBUG ---------
2720#endif
2721
2746 break; 2722 break;
2747 } 2723 }
2748 } 2724 }
2749 } 2725 }
2750 } 2726 }
5267#ifdef NAVIT_DEBUG_COORD_LIST 5243#ifdef NAVIT_DEBUG_COORD_LIST
5268 int need_clear = 1; 5244 int need_clear = 1;
5269#endif 5245#endif
5270 5246
5271 5247
5272
5273#if 1 5248#if 1
5274// ------------------- jandegr ------------------- 5249// ------------------- jandegr -------------------
5275 5250
5276 struct navigation_way *candidate_way; 5251 struct navigation_way *candidate_way;
5277 5252
5633 case 1: 5608 case 1:
5634 d = get_distance(nav, distance, attr_navigation_short, 0); 5609 d = get_distance(nav, distance, attr_navigation_short, 0);
5635 break; 5610 break;
5636 case 0: 5611 case 0:
5637 skip_roads = count_possible_turns(nav, cmd->prev ? cmd->prev->itm : nav->first, cmd->itm, cmd->delta); 5612 skip_roads = count_possible_turns(nav, cmd->prev ? cmd->prev->itm : nav->first, cmd->itm, cmd->delta);
5613
5614 dbg(0, "count_possible_turns:1:%d", skip_roads);
5615
5638 if ((skip_roads > 0) && ((global_vehicle_profile != 1) && (global_vehicle_profile != 2))) 5616 if ((skip_roads > 0) && ((global_vehicle_profile != 1) && (global_vehicle_profile != 2)))
5639 { 5617 {
5640 if (get_count_str(skip_roads + 1)) 5618 if (get_count_str(skip_roads + 1))
5641 { 5619 {
5620
5621// marker -1- //
5622
5642#ifdef HAVE_API_ANDROID 5623#ifdef HAVE_API_ANDROID
5643#ifdef NAVIT_SAY_DEBUG_PRINT 5624#ifdef NAVIT_SAY_DEBUG_PRINT
5644 android_send_generic_text(1,"+*#O:Take the %1$s road to the %2$s\n"); 5625 android_send_generic_text(1,"+*#O:Take the %1$s road to the %2$s\n");
5645 gchar* xy=g_strdup_printf("+*#1:%s\n", get_count_str(skip_roads + 1)); 5626 gchar* xy=g_strdup_printf("+*#1:%s\n", get_count_str(skip_roads + 1));
5646 android_send_generic_text(1,xy); 5627 android_send_generic_text(1,xy);
5679 5660
5680 break; 5661 break;
5681 5662
5682 case -2: 5663 case -2:
5683 skip_roads = count_possible_turns(nav, cmd->prev->itm, cmd->itm, cmd->delta); 5664 skip_roads = count_possible_turns(nav, cmd->prev->itm, cmd->itm, cmd->delta);
5665
5666 dbg(0, "count_possible_turns:2:%d", skip_roads);
5667
5684 if ((skip_roads > 0) && ((global_vehicle_profile != 1) && (global_vehicle_profile != 2))) 5668 if ((skip_roads > 0) && ((global_vehicle_profile != 1) && (global_vehicle_profile != 2)))
5685 { 5669 {
5686 // TRANSLATORS: First argument is the how manieth street to take, second the direction 5670 // TRANSLATORS: First argument is the how manieth street to take, second the direction
5687 // TRANSLATORS: EXAMPLE: ... then take the second road to the right 5671 // TRANSLATORS: EXAMPLE: ... then take the second road to the right
5688 if (get_count_str(skip_roads + 1)) 5672 if (get_count_str(skip_roads + 1))
5689 { 5673 {
5674
5675// marker -2- //
5676
5690#ifdef HAVE_API_ANDROID 5677#ifdef HAVE_API_ANDROID
5691#ifdef NAVIT_SAY_DEBUG_PRINT 5678#ifdef NAVIT_SAY_DEBUG_PRINT
5692 android_send_generic_text(1,"+*#O:then take the %1$s road to the %2$s\n"); 5679 android_send_generic_text(1,"+*#O:then take the %1$s road to the %2$s\n");
5693 gchar* xy=g_strdup_printf("+*#1:%s\n", get_count_str(skip_roads + 1)); 5680 gchar* xy=g_strdup_printf("+*#1:%s\n", get_count_str(skip_roads + 1));
5694 android_send_generic_text(1,xy); 5681 android_send_generic_text(1,xy);

Legend:
Removed from v.47  
changed lines
  Added in v.48

   
Visit the ZANavi Wiki