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

Contents of /navit/navit/search.h

Parent Directory Parent Directory | Revision Log Revision Log


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

   
Visit the ZANavi Wiki