137 |
struct relation_chain_s *next; |
struct relation_chain_s *next; |
138 |
} relation_chain_t; |
} relation_chain_t; |
139 |
|
|
140 |
|
/* two of these hash tables are used, one for nodes and one for ways */ |
141 |
|
/* currently relations aren't used often enough to justify the use */ |
142 |
|
/* of a hash table */ |
143 |
|
|
144 |
|
/* the current hash table uses 16 bits. each table thus is */ |
145 |
|
/* 256 kbytes (2^16 * sizeof(void*)) in size */ |
146 |
|
#define ID2HASH(a) ((unsigned short)(a) ^ (unsigned short)((a)>>16)) |
147 |
|
|
148 |
|
typedef struct hash_item_s { |
149 |
|
union { |
150 |
|
node_t *node; |
151 |
|
way_t *way; |
152 |
|
relation_t *relation; |
153 |
|
} data; |
154 |
|
|
155 |
|
struct hash_item_s *next; |
156 |
|
} hash_item_t; |
157 |
|
|
158 |
|
typedef struct { |
159 |
|
hash_item_t *hash[65536]; |
160 |
|
} hash_table_t; |
161 |
|
|
162 |
typedef enum { |
typedef enum { |
163 |
ILLEGAL=0, NODE, WAY, RELATION, NODE_ID, WAY_ID, RELATION_ID |
ILLEGAL=0, NODE, WAY, RELATION, NODE_ID, WAY_ID, RELATION_ID |
164 |
} type_t; |
} type_t; |
180 |
typedef struct osm_s { |
typedef struct osm_s { |
181 |
bounds_t *bounds; // original bounds as they appear in the file |
bounds_t *bounds; // original bounds as they appear in the file |
182 |
user_t *user; |
user_t *user; |
183 |
|
|
184 |
node_t *node; |
node_t *node; |
185 |
|
hash_table_t *node_hash; |
186 |
|
|
187 |
way_t *way; |
way_t *way; |
188 |
|
hash_table_t *way_hash; |
189 |
|
|
190 |
|
// hashing relations doesn't yet make much sense as relations are quite rare |
191 |
relation_t *relation; |
relation_t *relation; |
192 |
|
|
193 |
} osm_t; |
} osm_t; |
194 |
|
|
195 |
#include <libxml/parser.h> |
#include <libxml/parser.h> |