source: subversion/applications/rendering/gosmore/libgosm.h @ 18363

Last change on this file since 18363 was 18363, checked in by nic, 10 years ago

Routing: No longer cycling up oneways. Reasonable dismounting
Osm2Gosmore() now has access to all tags.

  • Property svn:executable set to *
File size: 22.3 KB
Line 
1#ifndef LIBGOSM_H
2#define LIBGOSM_H
3
4#include <math.h>
5#include <stdlib.h>
6#include <string.h>
7#include <ctype.h>
8#include <stdio.h>
9#include <limits.h>
10
11#ifdef _WIN32_WCE
12#include <windows.h>
13#define lrint(x) int ((x) < 0 ? (x) - 0.5 : (x) + 0.5)
14typedef int intptr_t;
15#define strncasecmp _strnicmp
16#define stricmp _stricmp
17#endif
18
19#ifndef _WIN32
20#include <libxml/xmlreader.h>
21#include <inttypes.h>
22#define stricmp strcasecmp
23typedef long long __int64;
24#endif
25#ifndef M_PI
26#define M_PI 3.14159265358979323846 // Not in math ??
27#endif
28
29#if __FreeBSD__ || __APPLE__  // Thanks to Ted Mielczarek & Dmitry
30#define fopen64(x,y) fopen(x,y)
31#endif
32
33#ifndef TRUE
34#define TRUE 1
35#define FALSE 0
36#endif
37
38// this definitions have been changes to prevent compiler warnings
39// copied verbatim for /usr/include/limits.h
40#ifndef INT_MAX
41#define INT_MAX       2147483647
42#endif
43
44#ifndef INT_MIN
45#define INT_MIN       (-INT_MAX - 1)
46#endif
47
48#define Sqr(x) ((x)*(x))
49inline int isqrt (int x) { return lrint (sqrt (x)); } // Optimize this ?
50
51#define TILEBITS (18)
52#define TILESIZE (1<<TILEBITS)
53
54#define RESTRICTIONS M (access) M (motorcar) M (bicycle) M (foot) M (goods) \
55  M (hgv) M (horse) M (motorcycle) M (psv) M (moped) M (mofa) \
56  M (motorboat) M (boat) \
57  M (oneway) M (roundabout)
58
59#define M(field) field ## R,
60enum {
61  STYLE_BITS = 10, RESTRICTIONS bicycleOneway, layerBit1, layerBit2, layerBit3
62};
63#undef M
64
65// Below is a list of the tags that the user may add. It should also include
66// any tags that gosmore.cpp may test for directly, e.g.
67// StyleNr(w) == highway_traffic_signals .
68// See http://etricceline.de/osm/Europe/En/tags.htm for the most popular tags
69// The fields are k, v, short name and the additional tags.
70#define STYLES \
71 s (gosmore_note, yes,        "note"            , "") \
72 s (highway, residential,     "residential"     , "") \
73 s (highway, unclassified,    "unclassified"    , "") \
74 s (highway, tertiary,        "tertiary"        , "") \
75 s (highway, secondary,       "secondary"       , "") \
76 s (highway, primary,         "primary"         , "") \
77 s (highway, trunk,           "trunk"           , "") \
78 s (highway, footway,         "footway"         , "") \
79 s (highway, service,         "service"         , "") \
80 s (highway, track,           "track"           , "") \
81 s (highway, cycleway,        "cycleway"        , "") \
82 s (highway, pedestrian,      "pedestrian"      , "") \
83 s (highway, steps,           "steps"           , "") \
84 s (highway, bridleway,       "bridleway"       , "") \
85 s (railway, rail,            "railway"         , "") \
86 s (railway, station,         "railway station" , "") \
87 s (highway, mini_roundabout, "mini roundabout" , "") \
88 s (highway, traffic_signals, "traffic signals" , "") \
89 s (highway, bus_stop,        "bus stop"        , "") \
90 s (amenity, parking,         "parking"         , "") \
91 s (amenity, fuel,            "fuel"            , "") \
92 s (amenity, school,          "school"          , "") \
93 s (place,   village,         "village"         , "") \
94 s (place,   suburb,          "suburb"          , "") \
95 s (shop,    supermarket,     "supermarket"     , "") \
96 s (religion, christian,      "church"          , \
97               "  <tag k='amenity' v='place_of_worship' />\n") \
98 s (religion, jewish,         "synagogue"       , \
99               "  <tag k='amenity' v='place_of_worship' />\n") \
100 s (religion, muslim,         "mosque"          , \
101               "  <tag k='amenity' v='place_of_worship' />\n") \
102 s (amenity, pub,             "pub"             , "") \
103 s (amenity, restaurant,      "restaurant"      , "") \
104 s (power,   tower,           "power tower"     , "") \
105 s (waterway, stream,         "stream"          , "") \
106 s (amenity, grave_yard,      "grave yard"      , "") \
107 s (amenity, crematorium,     "crematorium"     , "") \
108 s (amenity, shelter,         "shelter"         , "") \
109 s (tourism, picnic_site,     "picnic site"     , "") \
110 s (leisure, common,          "common area"     , "") \
111 s (amenity, park_bench,      "park bench"      , "") \
112 s (tourism, viewpoint,       "viewpoint"       , "") \
113 s (tourism, artwork,         "artwork"         , "") \
114 s (tourism, museum,          "museum"          , "") \
115 s (tourism, theme_park,      "theme park"      , "") \
116 s (tourism, zoo,             "zoo"             , "") \
117 s (leisure, playground,      "playground"      , "") \
118 s (leisure, park,            "park"            , "") \
119 s (leisure, nature_reserve,  "nature reserve"  , "") \
120 s (leisure, miniature_golf,  "miniature golf"  , "") \
121 s (leisure, golf_course,     "golf course"     , "") \
122 s (leisure, sports_centre,   "sports centre"   , "") \
123 s (leisure, stadium,         "stadium"         , "") \
124 s (leisure, pitch,           "pitch"           , "") \
125 s (leisure, track,           "track"           , "") \
126 s (sport,   athletics,       "athletics"       , "") \
127 s (sport,   10pin,           "10 pin"          , "") \
128 s (sport,   boules,          "boules"          , "") \
129 s (sport,   bowls,           "bowls"           , "") \
130 s (sport,   baseball,        "baseball"        , "") \
131 s (sport,   basketball,      "basketball"      , "") \
132 s (sport,   cricket,         "cricket"         , "") \
133 s (sport,   cricket_nets,    "cricket nets"    , "") \
134 s (sport,   croquet,         "croquet"         , "") \
135 s (sport,   dog_racing,      "dog racing"      , "") \
136 s (sport,   equestrian,      "equestrian"      , "") \
137 s (sport,   football,        "football"        , "") \
138 s (sport,   soccer,          "soccer"          , "") \
139 s (sport,   climbing,        "climbing"        , "") \
140 s (sport,   gymnastics,      "gymnastics"      , "") \
141 s (sport,   hockey,          "hockey"          , "") \
142 s (sport,   horse_racing,    "horse racing"    , "") \
143 s (sport,   motor,           "motor sport"     , "") \
144 s (sport,   pelota,          "pelota"          , "") \
145 s (sport,   rugby,           "rugby"           , "") \
146 s (sport,   australian_football, "australian football" , "") \
147 s (sport,   skating,         "skating"         , "") \
148 s (sport,   skateboard,      "skateboard"      , "") \
149 s (sport,   handball,        "handball"        , "") \
150 s (sport,   table_tennis,    "table tennis"    , "") \
151 s (sport,   tennis,          "tennis"          , "") \
152 s (sport,   racquet,         "racquet"         , "") \
153 s (sport,   badminton,       "badminton"       , "") \
154 s (sport,   paintball,       "paintball"       , "") \
155 s (sport,   shooting,        "shooting"        , "") \
156 s (sport,   volleyball,      "volleyball"      , "") \
157 s (sport,   beachvolleyball, "beach volleyball" , "") \
158 s (sport,   archery,         "archery"         , "") \
159 s (sport,   skiing,          "skiing"          , "") \
160 s (sport,   rowing,          "rowing"          , "") \
161 s (sport,   sailing,         "sailing"         , "") \
162 s (sport,   diving,          "diving"          , "") \
163 s (sport,   swimming,        "swimming"        , "") \
164 s (leisure, swimming_pool,   "swimming pool"   , "") \
165 s (leisure, water_park,      "water park"      , "") \
166 s (leisure, marina,          "marina"          , "") \
167 s (leisure, slipway,         "slipway"         , "") \
168 s (leisure, fishing,         "fishing"         , "") \
169 s (shop,    bakery,          "bakery"          , "") \
170 s (shop,    butcher,         "butcher"         , "") \
171 s (shop,    florist,         "florist"         , "") \
172 s (shop,    groceries,       "groceries"       , "") \
173 s (shop,    beverages,       "liquor / wine"   , "") \
174 s (shop,    clothes,         "clothing shop"   , "") \
175 s (shop,    shoes,           "shoe shop"       , "") \
176 s (shop,    jewelry,         "jewelry store"   , "") \
177 s (shop,    books,           "bookshop"        , "") \
178 s (shop,    newsagent,       "newsagent"       , "") \
179 s (shop,    furniture,       "furniture store" , "") \
180 s (shop,    hifi,            "Hi-Fi store"     , "") \
181 s (shop,    electronics,     "electronics store" , "") \
182 s (shop,    computer,        "computer shop"   , "") \
183 s (shop,    video,           "video rental"    , "") \
184 s (shop,    toys,            "toy shop"        , "") \
185 s (shop,    motorcycle,      "motorcycle"      , "") \
186 s (shop,    car_repair,      "car repair"      , "") \
187 s (shop,    doityourself,    "doityourself"    , "") \
188 s (shop,    garden_centre,   "garden centre"   , "") \
189 s (shop,    outdoor,         "outdoor"         , "") \
190 s (shop,    bicycle,         "bicycle shop"    , "") \
191 s (shop,    dry_cleaning,    "dry cleaning"    , "") \
192 s (shop,    laundry,         "laundry"         , "") \
193 s (shop,    hairdresser,     "hairdresser"     , "") \
194 s (shop,    travel_agency,   "travel_agency"   , "") \
195 s (shop,    convenience,     "convenience"     , "") \
196 s (shop,    mall,            "mall"            , "") \
197 s (shop,    department_store, "department store" , "") \
198 s (amenity, biergarten,      "biergarten"      , "") \
199 s (amenity, nightclub,       "nightclub"       , "") \
200 s (amenity, bar,             "bar"             , "") \
201 s (amenity, cafe,            "cafe"            , "") \
202 s (amenity, fast_food,       "fast food"       , "") \
203 s (amenity, ice_cream,       "icecream"        , "") \
204 s (amenity, bicycle_rental,  "bicycle rental"  , "") \
205 s (amenity, car_rental,      "car rental"      , "") \
206 s (amenity, car_sharing,     "car sharing"     , "") \
207 s (amenity, car_wash,        "car wash"        , "") \
208 s (amenity, taxi,            "taxi"            , "") \
209 s (amenity, telephone,       "telephone"       , "") \
210 s (amenity, post_office,     "post office"     , "") \
211 s (amenity, post_box,        "post box"        , "") \
212 s (tourism, information,     "tourist info"    , "") \
213 s (amenity, toilets,         "toilets"         , "") \
214 s (amenity, recycling,       "recycling"       , "") \
215 s (amenity, fire_station,    "fire station"    , "") \
216 s (amenity, police,          "police"          , "") \
217 s (amenity, courthouse,      "courthouse"      , "") \
218 s (amenity, prison,          "prison"          , "") \
219 s (amenity, public_building, "public building" , "") \
220 s (amenity, townhall,        "townhall"        , "") \
221 s (amenity, cinema,          "cinema"          , "") \
222 s (amenity, arts_centre,     "arts centre"     , "") \
223 s (amenity, theatre,         "theatre"         , "") \
224 s (tourism, hotel,           "hotel"           , "") \
225 s (tourism, motel,           "motel"           , "") \
226 s (tourism, guest_house,     "guest house"     , "") \
227 s (tourism, hostel,          "hostel"          , "") \
228 s (tourism, chalet,          "chalet"          , "") \
229 s (tourism, camp_site,       "camp site"       , "") \
230 s (tourism, caravan_site,    "caravan site"    , "") \
231 s (amenity, pharmacy,        "pharmacy"        , "") \
232 s (amenity, dentist,         "dentist"         , "") \
233 s (amenity, doctor,          "doctor"          , "") \
234 s (amenity, hospital,        "hospital"        , "") \
235 s (amenity, bank,            "bank"            , "") \
236 s (amenity, bureau_de_change, "bureau de change" , "") \
237 s (amenity, atm,             "atm"            , "") \
238 s (amenity, drinking_water,  "drinking water"  , "") \
239 s (amenity, fountain,        "fountain"        , "") \
240 s (natural, spring,          "spring"          , "") \
241 s (amenity, university,      "university"      , "") \
242 s (amenity, college,         "college"         , "") \
243 s (amenity, kindergarten,    "kindergarten"    , "") \
244 s (highway, living_street,   "living street"   , "") \
245 s (highway, motorway,        "motorway"        , "") \
246 s (highway, motorway_link,   "mway link"       , "") \
247 s (highway, trunk_link,      "trunk link"      , "") \
248 s (highway, primary_link,    "primary_link"    , "") \
249 s (barrier, bollard,         "bollard"         , "") /* First barrier ! */ \
250 s (barrier, gate,            "gate"            , "") \
251 s (barrier, stile,           "stile"           , "") \
252 s (barrier, cattle_grid,     "cattle_grid"     , "") \
253 s (barrier, toll_booth,      "toll_booth"      , "") /* Last barrier ! */ \
254 s (man_made, beacon,         "beacon"          , "" ) \
255 s (man_made, survey_point,   "survey point"    , "" ) \
256 s (man_made, tower,          "tower"           , "" ) \
257 s (man_made, water_tower,    "water tower"     , "" ) \
258 s (man_made, gasometer,      "gasometer"       , "" ) \
259 s (man_made, reservoir_covered, "covered reservoir", "" ) \
260 s (man_made, lighthouse,     "lighthouse"      , "" ) \
261 s (man_made, windmill,       "windmill"        , "" ) \
262 s (man_made, pier,           "pier"            , "" ) \
263 s (man_made, pipeline,       "pipeline"        , "" ) \
264 s (man_made, wastewater_plant, "wastewater plant" , "" ) \
265 s (man_made, crane,          "crane"           , "" ) \
266 s (building, yes,            "building"        , "") \
267 s (landuse, forest,          "forest"          , "") \
268 s (landuse, residential,     "residential area", "") \
269 s (landuse, industrial,      "industrial area" , "") \
270 s (landuse, retail,          "retail area"     , "") \
271 s (landuse, commercial,      "commercial area" , "") \
272 s (landuse, construction,    "construction area" , "") \
273 s (landuse, reservoir,       "reservoir"       , "") \
274 s (natural, water,           "lake / dam"      , "") \
275 s (landuse, basin,           "basin"           , "") \
276 s (landuse, landfill,        "landfill"        , "") \
277 s (landuse, quarry,          "quarry"          , "") \
278 s (landuse, cemetery,        "cemetery"        , "") \
279 s (landuse, allotments,      "allotments"      , "") \
280 s (landuse, farm,            "farmland"        , "") \
281 s (landuse, farmyard,        "farmyard"        , "") \
282 s (landuse, military,        "military area"   , "") \
283 s (religion, bahai,          "bahai"           , \
284               "  <tag k='amenity' v='place_of_worship' />\n") \
285 s (religion, buddhist,       "buddhist"        , \
286               "  <tag k='amenity' v='place_of_worship' />\n") \
287 s (religion, hindu,          "hindu"           , \
288               "  <tag k='amenity' v='place_of_worship' />\n") \
289 s (religion, jain,           "jainism"         , \
290               "  <tag k='amenity' v='place_of_worship' />\n") \
291 s (religion, sikh,           "sikhism"         , \
292               "  <tag k='amenity' v='place_of_worship' />\n") \
293 s (religion, shinto,         "shinto"          , \
294               "  <tag k='amenity' v='place_of_worship' />\n") \
295 s (religion, taoist,         "taoism"          , \
296               "  <tag k='amenity' v='place_of_worship' />\n") \
297 /* Types for the cyclenet code in RebuildPak. Without the code for QUERY_STRING will
298  * fail to report the correct road type. Has to include all types in elemstyles.xml */ \
299 s (cyclenethighway, unclassified, "unclassified","") \
300 s (cyclenethighway, tertiary, "tertiary"       , "") \
301 s (cyclenethighway, secondary, "secondary"     , "") \
302 s (cyclenethighway, secondary_link, "sec link" , "") \
303 s (cyclenethighway, primary, "primary"         , "") \
304 s (cyclenethighway, primary_link, "primary_link","") \
305 s (cyclenethighway, trunk,   "trunk"           , "") \
306 s (cyclenethighway, trunk_link, "trunk link"   , "") \
307 s (cyclenethighway, footway, "footway"         , "") \
308 s (cyclenethighway, service, "service"         , "") \
309 s (cyclenethighway, steps,   "steps"           , "") \
310 s (cyclenethighway, motorway, "motorway"       , "") \
311 s (cyclenethighway, motorway_link, "mway link" , "") \
312 /* relations must be last and restriction_no_right_turn must be first */ \
313 s (restriction, no_right_turn, ""              , "") \
314 s (restriction, no_left_turn, ""               , "") \
315 s (restriction, no_u_turn, ""                  , "") \
316 s (restriction, no_straight_on, ""             , "") \
317 /* restriction_no_straight_on must be the last "no_" restriction */ \
318 s (restriction, only_right_turn, ""            , "") \
319 s (restriction, only_left_turn, ""             , "") \
320 s (restriction, only_straight_on, ""           , "") \
321 /* restriction_only_straight_on must be the last restriction */
322
323#define XXXFSDFSF \
324 s (sport,   orienteering,    "orienteering"    , "") \
325 s (sport,   gym,             "gym"             , "") \
326 /* sport=golf isn't a golf course, so what is it ? */ \
327
328#define s(k,v,shortname,extraTags) k ## _ ## v,
329enum { STYLES firstElemStyle }; // highway_residential, ...
330#undef s
331
332struct styleStruct {
333  int  x[16], lineWidth, lineRWidth, lineColour, lineColourBg, dashed;
334  int  scaleMax, areaColour, dummy /* pad to 8 for 64 bit compatibility */;
335  double aveSpeed[layerBit1], invSpeed[layerBit1];
336};
337
338struct ndType {
339  int wayPtr, lat, lon, other[2];
340};
341/* This struct takes up a lot of space, but compressing is possible: If
342other is encoded as byte offset from the current position, it should typically
343be close to 0. So it can be Huffman encoded. Then the struct will no longer
344have a fixed size, and the final position of an nd will not be known during
345the first pass. So we over estimate the space needed between 2 nds and we can
346do multiple passes until all the excess has been removed.
347
348The difference between lat and wayPtr->clat will normally also be quite
349small and can also be Huffman coded. The same applies to lon.
350
351C code can be generated for these non dynamic Huffman decoders and the C
352compiler can then optimize it for efficient decompression. Not only will this
353save (flash) storage, but it will also increase the size of maps that can be
354loaded and reduce the paging that is so slow on mobile devices.
355*/
356
357struct wayType {
358  int bits, destination;
359  int clat, clon, dlat, dlon; /* Centre coordinates and (half)diameter */
360};
361
362inline int Layer (wayType *w) { return w->bits >> 29; }
363
364inline int Latitude (double lat)
365{ /* Mercator projection onto a square means we have to clip
366     everything beyond N85.05 and S85.05 */
367  return lat > 85.051128779 ? 2147483647 : lat < -85.051128779 ? -2147483647 :
368    lrint (log (tan (M_PI / 4 + lat * M_PI / 360)) / M_PI * 2147483648.0);
369}
370
371inline int Longitude (double lon)
372{
373  return lrint (lon / 180 * 2147483648.0);
374}
375
376inline double LatInverse (int lat)
377{
378  return (atan (exp (lat / 2147483648.0 * M_PI)) - M_PI / 4) / M_PI * 360;
379}
380
381inline double LonInverse (int lon)
382{
383  return lon / 2147483648.0 * 180;
384}
385
386/*---------- Global variables -----------*/
387#define searchCnt 40
388extern wayType *gosmSway[searchCnt];
389extern int *hashTable, bucketsMin1, pakHead;
390extern char *gosmData, *gosmSstr[searchCnt];
391/* gosmSstr is no longer nul terminated. If it's a problem, use
392string s (gosmSstr[i], strcspn (gosmSstr[i], "\n")); ... s.c_str() ... */
393
394extern ndType *ndBase;
395extern styleStruct *style;
396
397inline wayType *Way (ndType *nd) { return (wayType *)(nd->wayPtr+gosmData); }
398
399inline int StyleNr (wayType *w) { return w->bits & ((2 << STYLE_BITS) - 1); }
400
401inline styleStruct *Style (wayType *w) { return &style[StyleNr (w)]; }
402
403unsigned inline ZEnc (int lon, int lat)
404{ // Input as bits : lon15,lon14,...lon0 and lat15,lat14,...,lat0
405  int t = (lon << 16) | lat;
406  t = (t & 0xff0000ff) | ((t & 0x00ff0000) >> 8) | ((t & 0x0000ff00) << 8);
407  t = (t & 0xf00ff00f) | ((t & 0x0f000f00) >> 4) | ((t & 0x00f000f0) << 4);
408  t = (t & 0xc3c3c3c3) | ((t & 0x30303030) >> 2) | ((t & 0x0c0c0c0c) << 2);
409  return (t & 0x99999999) | ((t & 0x44444444) >> 1) | ((t & 0x22222222) << 1);
410} // Output as bits : lon15,lat15,lon14,lat14,...,lon0,lat0
411
412inline int Hash (int lon, int lat, int lowz = 0)
413{ /* All the normal tiles (that make up a super tile) are mapped to sequential
414     buckets thereby improving caching and reducing the number of disk tracks
415     required to render / route through a super tile sized area.
416     The map to sequential buckets is a 2-D Hilbert curve. */
417  if (lowz) {
418    lon >>= 7;
419    lat >>= 7;
420  }
421 
422  int t = ZEnc (lon >> TILEBITS, ((unsigned) lat) >> TILEBITS);
423  int s = ((((unsigned)t & 0xaaaaaaaa) >> 1) | ((t & 0x55555555) << 1)) ^ ~t;
424  // s=ZEnc(lon,lat)^ZEnc(lat,lon), so it can be used to swap lat and lon.
425  #define SUPERTILEBITS (TILEBITS + 8)
426  for (int lead = 1 << (SUPERTILEBITS * 2 - TILEBITS * 2); lead; lead >>= 2) {
427    if (!(t & lead)) t ^= ((t & (lead << 1)) ? s : ~s) & (lead - 1);
428  }
429
430  return (((((t & 0xaaaaaaaa) >> 1) ^ t) + (lon >> SUPERTILEBITS) * 0x00d20381
431    + (lat >> SUPERTILEBITS) * 0x75d087d9) &
432    (lowz ? bucketsMin1 >> 7 : bucketsMin1)) + (lowz ? bucketsMin1 + 1 : 0);
433}
434
435int TagCmp (char *a, char *b); 
436
437struct OsmItr { // Iterate over all the objects in a square
438  ndType *nd[1]; /* Readonly. Either can be 'from' or 'to', but you */
439  /* can be guaranteed that nodes will be in hs[0] */
440 
441  int slat, slon, left, right, top, bottom, tsize; /* Private */
442  ndType *end;
443 
444  OsmItr (int l, int t, int r, int b)
445  {
446    tsize = r - l > 10000000 ? TILESIZE << 7 : TILESIZE;
447    left = l & (~(tsize - 1));
448    right = (r + tsize - 1) & (~(tsize-1));
449    top = t & (~(tsize - 1));
450    bottom = (b + tsize - 1) & (~(tsize-1));
451   
452    slat = top;
453    slon = left - tsize;
454    nd[0] = end = NULL;
455  }
456};
457
458int Next (OsmItr &itr); /* Friend of osmItr */
459
460struct routeNodeType {
461  ndType *nd;
462  routeNodeType *shortest;
463  int heapIdx, dir, remain; // Dir is 0 or 1
464  // if heapIdx is negative, the node is not in the heap and best = -heapIdx.
465};
466/* The data is split over two structures (routeNodeType and routeHeapType).
467  Some of these fields may cause fewer cache misses if their are in
468  routeHeapType */
469struct routeHeapType {
470  routeNodeType *r;
471  int best;
472};
473
474extern routeNodeType *route, *shortest;
475extern routeHeapType *routeHeap;
476extern int routeHeapSize, tlat, tlon, flat, flon, rlat, rlon;
477
478void Route (int recalculate, int plon, int plat, int Vehicle, int fast);
479void GosmFreeRoute (void);
480
481int JunctionType (ndType *nd);
482
483void GosmSearch (int clon, int clat, char *key);
484
485int GosmInit (void *d, long size);
486
487// *** EVERYTHING AFTER THIS POINT IS NOT IN THE WINDOWS BUILDS ***
488
489#ifndef _WIN32
490
491void GosmLoadAltStyle(const char* elemstylefile, const char* iconscsvfile);
492
493// struct to hold mappings between elemstyles.xml and stylesrec
494// these are needed when the osm file is converted to a pak file
495typedef struct {
496  char style_k[80];
497  char style_v[80];
498  int ruleNr;
499  int defaultRestrict;
500} elemstyleMapping;
501
502// reads the elemstyles.xml file into srec, with the mapping between
503// srec and elemstyles.xml stored in map, and the list of maximum
504// speeds for each vehicle type in maxspeeds. styleCnt representing
505// the location of the first elemstyle. Returns the final styleCnt.
506int LoadElemstyles(/* in */ const char *elemstylesfname, 
507                   const char *iconsfname,
508                   /* out */ styleStruct *srec, elemstyleMapping *map);
509
510// creates a new pakfile from an osmdata file read from standard in
511int RebuildPak(const char* pakfile, const char* elemstylefile, 
512               const char* iconscsvfile, const char* masterpakfile, 
513               const int bbox[4]);
514
515#endif // #ifndef _WIN32
516
517#endif
Note: See TracBrowser for help on using the repository browser.