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

Diff of /navit/navit/search.c

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

Revision 28 Revision 29
494static struct pcoord * 494static struct pcoord *
495search_house_number_coordinate(struct item *item, struct interpolation *inter) 495search_house_number_coordinate(struct item *item, struct interpolation *inter)
496{ 496{
497 struct pcoord *ret=g_new(struct pcoord, 1); 497 struct pcoord *ret=g_new(struct pcoord, 1);
498 ret->pro = map_projection(item->map); 498 ret->pro = map_projection(item->map);
499
500 // dbg(0,"001t: %s\n", item_to_name(item->type));
501
499 if (item_is_point(*item)) 502 if (item_is_point(*item))
500 { 503 {
501 struct coord c; 504 struct coord c;
502 if (item_coord_get(item, &c, 1)) 505 if (item_coord_get(item, &c, 1))
503 { 506 {
520 hn_length = atoi(inter->last) - atoi(inter->first); 523 hn_length = atoi(inter->last) - atoi(inter->first);
521 if (inter->rev) 524 if (inter->rev)
522 hn_pos = atoi(inter->last) - atoi(inter->curr); 525 hn_pos = atoi(inter->last) - atoi(inter->curr);
523 else 526 else
524 hn_pos = atoi(inter->curr) - atoi(inter->first); 527 hn_pos = atoi(inter->curr) - atoi(inter->first);
528
525 if (count) 529 if (count)
526 { 530 {
527 int i, distance_sum = 0, hn_distance; 531 int i, distance_sum = 0, hn_distance;
528 int *distances = g_alloca(sizeof(int) * (count - 1)); 532 int *distances = g_alloca(sizeof(int) * (count - 1));
529 dbg(1, "count=%d hn_length=%d hn_pos=%d (%s of %s-%s)\n", count, hn_length, hn_pos, inter->curr, inter->first, inter->last); 533 dbg(1, "count=%d hn_length=%d hn_pos=%d (%s of %s-%s)\n", count, hn_length, hn_pos, inter->curr, inter->first, inter->last);
559{ 563{
560 struct search_list_house_number *ret=g_new0(struct search_list_house_number, 1); 564 struct search_list_house_number *ret=g_new0(struct search_list_house_number, 1);
561 struct attr attr; 565 struct attr attr;
562 char *hn; 566 char *hn;
563 567
564 // dbg(0,"@@@@ enter @@@@\n"); 568 //dbg(0,"@@@@ enter @@@@\n");
565 569
566 ret->common.item = ret->common.unique = *item; 570 ret->common.item = ret->common.unique = *item;
567 //if (item_attr_get(item, attr_street_name, &attr)) 571 //if (item_attr_get(item, attr_street_name, &attr))
568 // dbg(0,"xx1 %s\n",attr.u.str); 572 // dbg(0,"xx1 %s\n",attr.u.str);
569 if (item_attr_get(item, attr_house_number, &attr)) 573 if (item_attr_get(item, attr_house_number, &attr))
574 {
570 ret->house_number = map_convert_string(item->map, attr.u.str); 575 ret->house_number = map_convert_string(item->map, attr.u.str);
576 }
571 else 577 else
572 { 578 {
573 //if (item_attr_get(item, attr_street_name, &attr)) 579 //if (item_attr_get(item, attr_street_name, &attr))
574 // dbg(0,"xx2 %s\n",attr.u.str); 580 // dbg(0,"xx2 %s\n",attr.u.str);
575 for (;;) 581 for (;;)
604 ret->house_number = map_convert_string(item->map, hn); 610 ret->house_number = map_convert_string(item->map, hn);
605 break; 611 break;
606 } 612 }
607 } 613 }
608 } 614 }
609 //dbg(0,"interpolate 33");
610 search_list_common_new(item, &ret->common); 615 search_list_common_new(item, &ret->common);
611 ret->common.c = search_house_number_coordinate(item, ret->interpolation ? inter : NULL); 616 ret->common.c = search_house_number_coordinate(item, ret->interpolation ? inter : NULL);
612 //dbg(0,"interpolate 44");
613 return ret; 617 return ret;
614} 618}
615 619
616static void search_list_house_number_destroy(struct search_list_house_number *this_) 620static void search_list_house_number_destroy(struct search_list_house_number *this_)
617{ 621{
932 //dbg(0,"case 3 XXXX 5\n"); 936 //dbg(0,"case 3 XXXX 5\n");
933 break; 937 break;
934 } 938 }
935 // CASE END ********* 939 // CASE END *********
936 940
941 //dbg(0,"case end\n");
937 942
938 if (p) 943 if (p)
939 { 944 {
940 if (search_add_result(le, p)) 945 if (search_add_result(le, p))
941 { 946 {
1055 1060
1056 //dbg(0,"enter\n"); 1061 //dbg(0,"enter\n");
1057 1062
1058 while ((slr = search_list_get_result(sl))) 1063 while ((slr = search_list_get_result(sl)))
1059 { 1064 {
1065
1060 if (offline_search_break_searching == 1) 1066 if (offline_search_break_searching == 1)
1061 { 1067 {
1062 break; 1068 break;
1063 } 1069 }
1064 1070
1065 // does the streetname of the housenumber match the street we want? 1071 // does the streetname of the housenumber match the street we want?
1066 if (slr != NULL) 1072 if (slr != NULL)
1067 { 1073 {
1068 if (slr->street != NULL) 1074 if (slr->street != NULL)
1075 {
1069 if ((street_name != NULL) && (slr->street->name != NULL)) 1076 if ((street_name != NULL) && (slr->street->name != NULL))
1070 { 1077 {
1071
1072 if (strcmp(slr->street->name, street_name) == 0) 1078 if (strcmp(slr->street->name, street_name) == 0)
1073 { 1079 {
1074 char *buffer; 1080 char *buffer;
1075 // coords of result 1081 // coords of result
1076 c.x = slr->house_number->common.c->x; 1082 c.x = slr->house_number->common.c->x;
1097 android_return_search_result(jni,buffer); 1103 android_return_search_result(jni,buffer);
1098#endif 1104#endif
1099 g_free(buffer); 1105 g_free(buffer);
1100 } 1106 }
1101 } 1107 }
1102 } 1108 }
1103 } 1109 }
1110 }
1104 1111
1105 //dbg(0,"return 2\n");
1106 return result_list; 1112 return result_list;
1107} 1113}
1108 1114
1109static GList * 1115static GList *
1110search_address__street(GList *result_list, struct search_list *sl, GList *phrases, GList *exclude1, GList *exclude2, GList *exclude3, int partial, struct jni_object *jni) 1116search_address__street(GList *result_list, struct search_list *sl, GList *phrases, GList *exclude1, GList *exclude2, GList *exclude3, int partial, struct jni_object *jni)
1184 //dbg(0,"s=%s\n",tmp->data); 1190 //dbg(0,"s=%s\n",tmp->data);
1185 1191
1186 attr2.type = attr_house_number; 1192 attr2.type = attr_house_number;
1187 attr2.u.str = tmp->data; 1193 attr2.u.str = tmp->data;
1188 search_list_search(sl, &attr2, partial); 1194 search_list_search(sl, &attr2, partial);
1189
1190 result_list = search_address_housenumber_real(result_list, sl, buffer2, phrases, exclude1, exclude2, exclude3, partial, jni); 1195 result_list = search_address_housenumber_real(result_list, sl, buffer2, phrases, exclude1, exclude2, exclude3, partial, jni);
1191 } 1196 }
1192 tmp = g_list_next(tmp); 1197 tmp = g_list_next(tmp);
1193 } 1198 }
1194#endif 1199#endif

Legend:
Removed from v.28  
changed lines
  Added in v.29

   
Visit the ZANavi Wiki