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

Contents of /navit/navit/search.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations) (download)
Sat Dec 14 12:13:17 2013 UTC (10 years, 3 months ago) by zoff99
File MIME type: text/plain
File size: 6675 byte(s)
lots of fixes and changes, new world map
1 /**
2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library 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 Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License 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 #ifndef NAVIT_SEARCH_H
21 #define NAVIT_SEARCH_H
22
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27
28
29
30 // from maptool.h !!!!! keep in sync
31 // from maptool.h !!!!! keep in sync
32 // ------ STREET INDEX FILE ------
33
34 #define REF_X 1073741834 // lat
35 #define REF_Y 240000000 // lon
36
37 #define STREET_INDEX_STREET_NAME_SIZE 48 // (this value + 16) must be a 2^n number!!!
38 struct streets_index_index_block_start
39 {
40 long long count_of_index_blocks;
41 }__attribute__ ((packed));
42
43 struct streets_index_index_block
44 {
45 char first_letter;
46 long long offset;
47 long long len;
48 }__attribute__ ((packed));
49
50 struct streets_index_data_block
51 {
52 long long town_id;
53 int lat;
54 int lon;
55 char street_type;
56 char street_name[STREET_INDEX_STREET_NAME_SIZE - 1];
57 }__attribute__ ((packed));
58 // ------ STREET INDEX FILE ------
59
60
61 // ------ TOWN INDEX FILE ------
62
63 #define MAX_TOWNNAME_SPLIT 8 // how many parts of a splitstring are we reading?
64 #define TOWN_INDEX_TOWN_NAME_SIZE 52 // (this value + 12) must be a 2^n number!!!
65 struct town_index_index_block_start
66 {
67 long long count_of_index_blocks;
68 }__attribute__ ((packed));
69
70 struct town_index_index_block
71 {
72 long long first_id;
73 long long offset;
74 long long len;
75 }__attribute__ ((packed));
76
77 struct town_index_data_block
78 {
79 long long town_id;
80 int country_id;
81 char town_name[TOWN_INDEX_TOWN_NAME_SIZE];
82 }__attribute__ ((packed));
83
84 struct town_index_data_block_c
85 {
86 long long town_id;
87 int country_id;
88 char town_name[TOWN_INDEX_TOWN_NAME_SIZE * MAX_TOWNNAME_SPLIT];
89 // char town_name_fold[TOWN_INDEX_TOWN_NAME_SIZE * MAX_TOWNNAME_SPLIT];
90 };
91 // ------ TOWN INDEX FILE ------
92 // from maptool.h !!!!! keep in sync
93 // from maptool.h !!!!! keep in sync
94
95
96
97 // from osm.c !!!!! keep in sync
98 // from osm.c !!!!! keep in sync
99 // compression level
100 #define USE_STREET_INDEX_COMPRESSION 1
101
102 // compression
103 #define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
104
105 #define MINIZ_NO_STDIO
106 #define MINIZ_NO_ARCHIVE_APIS
107 #define MINIZ_NO_TIME
108 #define MINIZ_NO_ZLIB_APIS
109 #define MINIZ_NO_MALLOC
110
111 #define MINIZ_HEADER_FILE_ONLY
112 #include "maptool/miniz.c"
113
114 typedef unsigned char uint8;
115 typedef unsigned short uint16;
116 //typedef unsigned int uint;
117 // compression
118
119 // from osm.c !!!!! keep in sync
120 // from osm.c !!!!! keep in sync
121
122 struct street_index_head
123 {
124 FILE *sif; // street index file handle
125 int comp_status; // (streets) 0 -> not initialized, 1 -> initialized, 2 -> closed
126 int t_comp_status; // (towns) 0 -> not initialized, 1 -> initialized, 2 -> closed
127 tinfl_status miniz_status;
128 tinfl_status t_miniz_status;
129 tinfl_decompressor *inflator;
130 tinfl_decompressor *t_inflator;
131 uint infile_size;
132 uint t_infile_size;
133 uint infile_remaining;
134 uint t_infile_remaining;
135 const void *next_in;
136 const void *t_next_in;
137 size_t avail_in;
138 size_t t_avail_in;
139 void *next_out;
140 void *t_next_out;
141 size_t avail_out;
142 size_t t_avail_out;
143 size_t in_bytes;
144 size_t t_in_bytes;
145 size_t out_bytes;
146 size_t t_out_bytes;
147 int data_count;
148 int t_data_count;
149
150 struct streets_index_index_block_start si_ibs;
151 struct streets_index_index_block *si_ib_mem; // mem pointer, to free the mem
152 struct streets_index_index_block *si_ib; // data pointer, to read data
153 // struct streets_index_data_block si_db; // street-index data block
154 struct streets_index_data_block *si_db_ptr; // street-index data block (pointer)
155
156 struct town_index_index_block_start ti_ibs;
157 struct town_index_index_block *ti_ib_mem; // mem pointer, to free the mem
158 struct town_index_index_block *ti_ib; // data pointer, to read data
159 struct town_index_data_block *ti_db_ptr; // town-index data block (pointer)
160 };
161
162
163 void street_index_init_compr(struct street_index_head *sih, long long size);
164 int street_index_read_data(struct street_index_head *sih);
165 void street_index_close_compr(struct street_index_head *sih);
166
167 void town_index_init_compr(struct street_index_head *sih, long long size);
168 int town_index_read_data(struct street_index_head *sih);
169 void town_index_close_compr(struct street_index_head *sih);
170 void town_index_setpos(struct street_index_head *sih, int town_data_block_num);
171
172
173
174
175
176 struct search_list_common
177 {
178 void *parent;
179 struct item unique, item;
180 int selected;
181 struct pcoord *c;
182 char *town_name;
183 char *district_name;
184 char *postal;
185 char *postal_mask;
186 char *county_name;
187 };
188
189 struct search_list_country
190 {
191 struct search_list_common common;
192 char *car;
193 char *iso2;
194 char *iso3;
195 char *name;
196 char *flag;
197 };
198
199 struct search_list_town
200 {
201 struct search_list_common common;
202 struct item itemt;
203 char *county;
204 };
205
206 struct search_list_street
207 {
208 struct search_list_common common;
209 char *name;
210 };
211
212 struct search_list_house_number
213 {
214 struct search_list_common common;
215 char *house_number;
216 int interpolation;
217 };
218
219 struct search_list_result
220 {
221 int id;
222 struct pcoord *c;
223 struct search_list_country *country;
224 struct search_list_town *town;
225 struct search_list_street *street;
226 struct search_list_house_number *house_number;
227 };
228
229 /* prototypes */
230 struct attr;
231 struct mapset;
232 struct search_list;
233 struct search_list_result;
234 struct jni_object;
235 struct search_list *search_list_new(struct mapset *ms);
236 void search_list_search(struct search_list *this_, struct attr *search_attr,
237 int partial);
238 char *search_postal_merge(char *mask, char *new_);
239 char *search_postal_merge_replace(char *mask, char *new_);
240 struct search_list_common *search_list_select(struct search_list *this_,
241 enum attr_type attr_type, int id, int mode);
242 struct search_list_result *search_list_get_result(struct search_list *this_);
243 void search_list_destroy(struct search_list *this_);
244 void search_init(void);
245 GList * search_by_address(GList *result_list, struct mapset *ms, char *addr,
246 int partial, struct jni_object *jni, int search_country_flags,
247 char *search_country_string);
248 void search_full_world(char *addr, int partial, int search_order,
249 struct jni_object *jni, struct coord_geo *search_center,
250 int search_radius);
251 void spill_index();
252
253 /* end of prototypes */
254 #ifdef __cplusplus
255 }
256 #endif
257
258 #endif
259

   
Visit the ZANavi Wiki