]> err.no Git - mapper/blob - src/osm.h
More map widget integration changes
[mapper] / src / osm.h
1 /*
2  * This file is part of mapper
3  *
4  * Copyright (C) 2007 Kaj-Michael Lang
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef _OSM_H
22 #define _OSM_H
23
24 /* Flags */
25 #define W_ONEWAY        (1 << 1)
26 #define W_ROUNDABOUT    (1 << 2)
27 #define W_LINK          (1 << 3)
28 #define W_AREA          (1 << 4)
29 #define W_NOEXIT        (1 << 5)
30 #define W_NOACCESS      (1 << 6)
31
32 #define ILAT_TURKU 911084432
33 #define ILON_TURKU 265542144
34
35 /* POI category ID's are special, the # is divied 
36  * by 100 and the result is the importance/priority of the poi.
37  * This can be used by the client program to discard 
38  * unimportant poi at different zoom levels.
39  * It limits the categories to 100/priority but... I think that's fine :)
40  */
41 typedef enum {
42         NODE_PLAIN=0,
43         /* Amenities */
44         NODE_POI_START=1,
45
46         NODE_AMENITY_PARKING=100,
47         NODE_AMENITY_FUEL=101,
48         NODE_AMENITY_SPEEDCAM=102,
49
50         NODE_AMENITY_HOSPITAL=120,
51         NODE_AMENITY_PHARMACY=121,
52         NODE_AMENITY_POLICE=130,
53
54         NODE_TOURISM_HOTEL=200,
55         NODE_TOURISM_HOSTEL=201,
56         NODE_TOURISM_MOTEL=202,
57
58         NODE_AMENITY_ATM=205,
59         NODE_AMENITY_BANK=206,
60
61         NODE_AMENITY_POST=210,
62         NODE_AMENITY_POST_BOX=211,
63
64         NODE_TOURISM_INFO=219,
65
66         NODE_AMENITY_TAXI=220,
67         NODE_RAILWAY_STATION=230,
68         NODE_RAILWAY_HALT=231,
69         NODE_AMENITY_BUS_STATION=236,
70         NODE_AMENITY_BOAT=240,
71         NODE_AIRPORT_TERMINAL=250,
72
73         NODE_TOURISM_CAMP_SITE=280,
74         NODE_TOURISM_CARAVAN_SITE=281,
75         NODE_TOURISM_PICNIC_SITE=282,
76
77         NODE_AMENITY_RESTAURANT=300,
78         NODE_AMENITY_FOOD=301,
79         NODE_AMENITY_PUB=302,
80
81         NODE_AMENITY_CINEMA=303,
82         NODE_AMENITY_THEATRE=304,
83         NODE_AMENITY_SHOP=305,
84         NODE_AMENITY_CAFE=306,
85         NODE_AMENITY_TELEPHONE=307,
86         NODE_AMENITY_WC=308,
87         NODE_TOURISM_THEME_PARK=309,
88         NODE_AMENITY_POW=310,
89         NODE_AMENITY_LIBRARY=311,
90         NODE_AMENITY_NIGHTCLUB=312,
91         NODE_AMENITY_SHOP_ADULT=313,
92         NODE_AMENITY_COLLEGE=320,
93         NODE_AMENITY_SCHOOL=321,
94         NODE_AMENITY_TOWNHALL=325,
95         NODE_TOURISM_ATTRACTION=330,
96
97         NODE_HISTORIC_MUSEUM=340,
98         NODE_HISTORIC_CASTLE=341,
99
100         NODE_AMENITY_SHOP_SUPERMARKET=350,
101         NODE_AMENITY_SHOPPING_CENTER=351,
102         NODE_AMENITY_SHOP_ALCOHOL=352,
103         NODE_AMENITY_SHOP_FLOWERS=353,
104         NODE_AMENITY_SHOP_BAKERY=354,
105
106         /* Sport */
107         NODE_SPORT_CENTER=400,
108         NODE_SPORT_STADIUM=401,
109         NODE_SPORT_SKIING=402,
110         NODE_SPORT_SWIMMING=403,
111         NODE_SPORT_FOOTBALL=404,
112         NODE_SPORT_SOCCER=405,
113         NODE_SPORT_GOLF=406,
114         NODE_SPORT_TENNIS=407,
115         NODE_SPORT_BOWLING=408,
116         NODE_SPORT_RUGBY=409,   
117         NODE_SPORT_CLIMBING=410,
118         NODE_SPORT_MOTOR=411,
119         NODE_SPORT_HOCKEY=412,
120         NODE_SPORT_BASKETBALL=414,
121         NODE_SPORT_CANOE=415,
122         NODE_SPORT_BASEBALL=416,
123         NODE_SPORT_SKATING=417,
124         NODE_SPORT_SKATEBOARD=418,
125         NODE_SPORT_RACQUET=419,
126         NODE_SPORT_CROQUET=420,
127         NODE_SPORT_CRICKET=421,
128         NODE_SPORT_PELOTA=422,
129         NODE_SPORT_TABLE_TENNIS=423,
130         NODE_SPORT_GYMNASTICS=424,
131         NODE_SPORT_CYCLING=425,
132         NODE_SPORT_BOWLS=426,
133         NODE_SPORT_ATHLETICS=427,
134         NODE_SPORT_SHOOTING=430,
135         NODE_SPORT_PAINTBALL=431,
136         NODE_SPORT_DOG=435,
137         NODE_SPORT_HORSES=436,
138         NODE_SPORT_OTHER=450,
139
140         NODE_AMENITY_GENERIC=900,
141         /* */
142         NODE_POI_END=999,
143         /* Places */
144         NODE_PLACE_START=1000,
145         NODE_PLACE_SUBURB=1001, /* http://wiki.openstreetmap.org/index.php/Proposed_features/Suburb */
146         NODE_PLACE_LOCALITY=1002, /* http://wiki.openstreetmap.org/index.php/Proposed_features/Locality */
147         NODE_PLACE_HAMLET=1049,
148         NODE_PLACE_VILLAGE=1050,
149         NODE_PLACE_ISLAND=1051,
150         NODE_PLACE_TOWN=1099,
151         NODE_PLACE_CITY=1100,
152         NODE_PLACE_AREA=1200,
153         NODE_PLACE_COUNTRY=1490,
154         NODE_PLACE_END=1500,
155
156         /* Other */
157         NODE_TRAFFIC_SIGNALS=2000,
158         NODE_GATE=2001,
159         NODE_TOLLBOOTH=2002,
160         NODE_JUNCTION=2003,
161
162         NODE_TYPE_MAX=9000
163 } node_type_t;
164
165 typedef enum {
166         WAY_UNWAYED=0,
167         WAY_ROAD_START,
168         WAY_MOTORWAY,
169         WAY_TRUNK,
170         WAY_PRIMARY,
171         WAY_SECONDARY,
172         WAY_TERTIARY,
173         WAY_UNCLASSIFIED,
174         WAY_RESIDENTIAL,
175         WAY_SERVICE,
176         WAY_TRACK,
177         WAY_FOOTWAY,
178         WAY_CYCLEWAY,
179         WAY_ROAD_END,
180
181         /* Non-roads */
182         WAY_OTHER_START,
183         WAY_RAIL,
184         WAY_RUNWAY,
185         WAY_TAXIWAY,
186         WAY_WATER,
187         WAY_WATER_RIVER,
188         WAY_WATER_STREAM,
189         WAY_WATER_CANAL,
190         WAY_OTHER_WAY,
191         WAY_OTHER_END
192 } way_type_t;
193
194 /* Route waypoint types */
195 typedef enum {
196         WPT_START,
197         WPT_STOP,
198         WPT_END
199 } waypoint_type_t;
200
201 /* A place (city,town,village,suburb) */
202 typedef struct _osm_place osm_place;
203 struct _osm_place {
204         guint32 id;
205         node_type_t type;
206         gchar *name;
207         gint32 lat;
208         gint32 lon;
209         gdouble dist;
210         guint32 isin_p;
211         guint32 isin_c;
212 };
213
214 /* Way node */
215 typedef struct _osm_way_node osm_way_node;
216 struct _osm_way_node {
217         guint32 id;
218         guint32 flags;
219         gint32 lat;
220         gint32 lon;
221 };
222
223 /* Way */
224 typedef struct _osm_way osm_way;
225 struct _osm_way {
226         guint32 id;
227         guint32 isin_c;
228         guint32 isin_p;
229         gint16 type;
230         guint32 flags;
231         guint16 nodecnt;
232         guint32 f;
233         guint32 t;
234         gint8 speed;
235         gdouble dist;
236         gdouble distance;
237         gchar *name;
238         gchar *ref;
239         gchar *int_ref;
240         osm_way_node *node_f;
241         osm_way_node *node_t;
242         gint8 direction;
243         GList *nodes;
244 };
245
246 /* Route waypoint */
247 typedef struct _osm_waypoint osm_waypoint;
248 struct _osm_waypoint {
249         osm_way *way;
250         waypoint_type_t type;
251 };
252
253 /* Location: way/street we are on, city/town/village/hamlet and suburb */
254 /* With helpers, speed and heading at last known location */
255 typedef struct _osm_location osm_location;
256 struct _osm_location {
257         osm_way *street;
258         osm_place *primary;
259         osm_place *secondary;
260         gboolean changed;
261         gboolean valid;
262         gint32 lat;
263         gint32 lon;
264         gfloat heading;
265         gfloat speed;
266
267         time_t last_valid;
268         gint nfcnt;
269 };
270
271 #endif