summaryrefslogtreecommitdiff
path: root/navit/map/binfile
diff options
context:
space:
mode:
authormdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2013-02-06 21:52:35 +0000
committermdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2013-02-06 21:52:35 +0000
commit174e5548a085bcdd3b59c2326a4639b5cf28aa61 (patch)
tree69e0cd8da65c3dbb4d24394537a0e8843f9f28f8 /navit/map/binfile
parent97b1a0757495e136f689cbb95034dfd5b1ef74d2 (diff)
downloadnavit-174e5548a085bcdd3b59c2326a4639b5cf28aa61.tar.gz
Add:map_binfile:Utilize maptool experimental feature to speed up the town search.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5368 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/map/binfile')
-rw-r--r--navit/map/binfile/binfile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c
index 32399cab1..d72915bb1 100644
--- a/navit/map/binfile/binfile.c
+++ b/navit/map/binfile/binfile.c
@@ -148,6 +148,7 @@ struct map_rect_priv {
char *url;
struct attr attrs[8];
int status;
+ struct map_search_priv *msp;
#ifdef DEBUG_SIZE
int size;
#endif
@@ -176,6 +177,7 @@ static void setup_pos(struct map_rect_priv *mr);
static void map_binfile_close(struct map_priv *m);
static int map_binfile_open(struct map_priv *m);
static void map_binfile_destroy(struct map_priv *m);
+static int case_cmp(char *name, char *match, int partial);
static void lfh_to_cpu(struct zip_lfh *lfh) {
dbg_assert(lfh != NULL);
@@ -1694,6 +1696,24 @@ map_parse_country_binfile(struct map_rect_priv *mr)
{
if (binfile_attr_get(mr->item.priv_data, attr_zipfile_ref, &at))
{
+ if(mr->msp) {
+ struct attr *attr=&mr->msp->search;
+ if(attr->type==attr_town_name || attr->type==attr_district_name || attr->type==attr_town_or_district_name) {
+ struct attr af, al;
+ if(binfile_attr_get(mr->item.priv_data, attr_first_key, &af)) {
+ if(case_cmp(af.u.str,attr->u.str,1)>0) {
+ dbg(1,"Skipping index item with first_key='%s'\n", af.u.str);
+ return;
+ }
+ }
+ if(binfile_attr_get(mr->item.priv_data, attr_last_key, &al)) {
+ if(case_cmp(al.u.str,attr->u.str,1)<0) {
+ dbg(1,"Skipping index item with first_key='%s', last_key='%s'\n", af.u.str, al.u.str);
+ return;
+ }
+ };
+ }
+ }
push_zipfile_tile(mr, at.u.num, 0, 0, 0);
}
}
@@ -1999,6 +2019,7 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search,
if (!map_rec)
break;
map_rec->country_id = item->id_lo;
+ map_rec->msp = msp;
msp->mr = map_rec;
return msp;
break;