1 |
zoff99 |
2 |
/**
|
2 |
zoff99 |
27 |
* ZANavi, Zoff Android Navigation system.
|
3 |
|
|
* Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
|
4 |
|
|
*
|
5 |
|
|
* This program is free software; you can redistribute it and/or
|
6 |
|
|
* modify it under the terms of the GNU 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 General Public License for more details.
|
13 |
|
|
*
|
14 |
|
|
* You should have received a copy of the GNU General Public License
|
15 |
|
|
* 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 |
|
|
/**
|
21 |
zoff99 |
2 |
* Navit, a modular navigation system.
|
22 |
|
|
* Copyright (C) 2005-2008 Navit Team
|
23 |
|
|
*
|
24 |
|
|
* This program is free software; you can redistribute it and/or
|
25 |
|
|
* modify it under the terms of the GNU Library General Public License
|
26 |
|
|
* version 2 as published by the Free Software Foundation.
|
27 |
|
|
*
|
28 |
|
|
* This program is distributed in the hope that it will be useful,
|
29 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
30 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
31 |
|
|
* GNU Library General Public License for more details.
|
32 |
|
|
*
|
33 |
|
|
* You should have received a copy of the GNU Library General Public
|
34 |
|
|
* License along with this program; if not, write to the
|
35 |
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
36 |
|
|
* Boston, MA 02110-1301, USA.
|
37 |
|
|
*/
|
38 |
|
|
|
39 |
|
|
#ifndef NAVIT_ATTR_H
|
40 |
|
|
#define NAVIT_ATTR_H
|
41 |
|
|
|
42 |
|
|
#ifdef __cplusplus
|
43 |
|
|
extern "C" {
|
44 |
|
|
#endif
|
45 |
|
|
|
46 |
|
|
#include "projection.h"
|
47 |
|
|
|
48 |
|
|
enum item_type;
|
49 |
|
|
|
50 |
|
|
enum attr_type {
|
51 |
|
|
#define ATTR2(x,y) attr_##y=x,
|
52 |
|
|
#define ATTR(x) attr_##x,
|
53 |
|
|
#include "attr_def.h"
|
54 |
|
|
#undef ATTR2
|
55 |
|
|
#undef ATTR
|
56 |
|
|
};
|
57 |
|
|
|
58 |
|
|
#define AF_ONEWAY (1<<0)
|
59 |
|
|
#define AF_ONEWAYREV (1<<1)
|
60 |
|
|
#define AF_NOPASS (AF_ONEWAY|AF_ONEWAYREV)
|
61 |
|
|
#define AF_ONEWAYMASK (AF_ONEWAY|AF_ONEWAYREV)
|
62 |
|
|
#define AF_SEGMENTED (1<<2)
|
63 |
|
|
#define AF_ROUNDABOUT (1<<3)
|
64 |
|
|
#define AF_ROUNDABOUT_VALID (1<<4)
|
65 |
|
|
#define AF_ONEWAY_EXCEPTION (1<<5)
|
66 |
|
|
#define AF_SPEED_LIMIT (1<<6)
|
67 |
|
|
#define AF_RESERVED1 (1<<7)
|
68 |
|
|
#define AF_SIZE_OR_WEIGHT_LIMIT (1<<8)
|
69 |
|
|
#define AF_THROUGH_TRAFFIC_LIMIT (1<<9)
|
70 |
|
|
#define AF_TOLL (1<<10)
|
71 |
|
|
#define AF_SEASONAL (1<<11)
|
72 |
|
|
#define AF_UNPAVED (1<<12)
|
73 |
|
|
#define AF_FORD (1<<13)
|
74 |
|
|
#define AF_UNDERGROUND (1<<14)
|
75 |
zoff99 |
27 |
#define AF_BRIDGE (1<<15) // NEW !!
|
76 |
zoff99 |
2 |
#define AF_DANGEROUS_GOODS (1<<19)
|
77 |
|
|
#define AF_EMERGENCY_VEHICLES (1<<20)
|
78 |
|
|
#define AF_TRANSPORT_TRUCK (1<<21)
|
79 |
|
|
#define AF_DELIVERY_TRUCK (1<<22)
|
80 |
|
|
#define AF_PUBLIC_BUS (1<<23)
|
81 |
|
|
#define AF_TAXI (1<<24)
|
82 |
|
|
#define AF_HIGH_OCCUPANCY_CAR (1<<25)
|
83 |
|
|
#define AF_CAR (1<<26)
|
84 |
|
|
#define AF_MOTORCYCLE (1<<27)
|
85 |
|
|
#define AF_MOPED (1<<28)
|
86 |
|
|
#define AF_HORSE (1<<29)
|
87 |
|
|
#define AF_BIKE (1<<30)
|
88 |
|
|
#define AF_PEDESTRIAN (1<<31)
|
89 |
|
|
|
90 |
|
|
#define AF_PBH (AF_PEDESTRIAN|AF_BIKE|AF_HORSE)
|
91 |
|
|
#define AF_MOTORIZED_FAST (AF_MOTORCYCLE|AF_CAR|AF_HIGH_OCCUPANCY_CAR|AF_TAXI|AF_PUBLIC_BUS|AF_DELIVERY_TRUCK|AF_TRANSPORT_TRUCK|AF_EMERGENCY_VEHICLES)
|
92 |
|
|
#define AF_ALL (AF_PBH|AF_MOPED|AF_MOTORIZED_FAST)
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
#define AF_DG_ANY (1<<0)
|
96 |
|
|
#define AF_DG_WATER_HARMFUL (1<<1)
|
97 |
|
|
#define AF_DG_EXPLOSIVE (1<<2)
|
98 |
|
|
#define AF_DG_FLAMMABLE (1<<3)
|
99 |
|
|
|
100 |
|
|
/* Values for attributes that could carry relative values */
|
101 |
|
|
#define ATTR_REL_MAXABS 0x40000000
|
102 |
|
|
#define ATTR_REL_RELSHIFT 0x60000000
|
103 |
|
|
|
104 |
|
|
enum attr_position_valid {
|
105 |
|
|
attr_position_valid_invalid,
|
106 |
|
|
attr_position_valid_static,
|
107 |
|
|
attr_position_valid_extrapolated_time,
|
108 |
|
|
attr_position_valid_extrapolated_spatial,
|
109 |
|
|
attr_position_valid_valid,
|
110 |
|
|
};
|
111 |
|
|
|
112 |
|
|
#define ATTR_IS_INT(x) ((x) >= attr_type_int_begin && (x) <= attr_type_int_end)
|
113 |
|
|
#define ATTR_IS_DOUBLE(x) ((x) >= attr_type_double_begin && (x) <= attr_type_double_end)
|
114 |
|
|
#define ATTR_IS_STRING(x) ((x) >= attr_type_string_begin && (x) <= attr_type_string_end)
|
115 |
|
|
#define ATTR_IS_OBJECT(x) ((x) >= attr_type_object_begin && (x) <= attr_type_object_end)
|
116 |
|
|
#define ATTR_IS_ITEM(x) ((x) >= attr_type_item_begin && (x) <= attr_type_item_end)
|
117 |
|
|
#define ATTR_IS_COORD_GEO(x) ((x) >= attr_type_coord_geo_begin && (x) <= attr_type_coord_geo_end)
|
118 |
|
|
#define ATTR_IS_NUMERIC(x) (ATTR_IS_INT(x) || ATTR_IS_DOUBLE(x))
|
119 |
|
|
#define ATTR_IS_COLOR(x) ((x) >= attr_type_color_begin && (x) <= attr_type_color_end)
|
120 |
|
|
#define ATTR_IS_PCOORD(x) ((x) >= attr_type_pcoord_begin && (x) <= attr_type_pcoord_end)
|
121 |
|
|
#define ATTR_IS_COORD(x) ((x) >= attr_type_coord_begin && (x) <= attr_type_coord_end)
|
122 |
|
|
#define ATTR_IS_GROUP(x) ((x) >= attr_type_group_begin && (x) <= attr_type_group_end)
|
123 |
|
|
|
124 |
|
|
#define ATTR_DEF_STR(x,y) (&(struct attr){attr_##x,{y}})
|
125 |
|
|
#define ATTR_DEF_INT(x,y) (&(struct attr){attr_##x,{(char *)(y)}})
|
126 |
|
|
#define ATTR_DEF_ITEMS(x,...) (&(struct attr){attr_##x,{(char *)((enum item_type[]){__VA_ARGS__ , type_none})}})
|
127 |
|
|
#define ATTR_LIST(...) (struct attr *[]) { __VA_ARGS__, NULL}
|
128 |
|
|
|
129 |
|
|
struct attr {
|
130 |
|
|
enum attr_type type;
|
131 |
|
|
union {
|
132 |
|
|
char *str;
|
133 |
|
|
void *data;
|
134 |
|
|
long num;
|
135 |
|
|
struct item *item;
|
136 |
|
|
enum item_type item_type;
|
137 |
|
|
enum projection projection;
|
138 |
|
|
double * numd;
|
139 |
|
|
struct color *color;
|
140 |
|
|
struct coord_geo *coord_geo;
|
141 |
|
|
struct navit *navit;
|
142 |
|
|
struct callback *callback;
|
143 |
|
|
struct callback_list *callback_list;
|
144 |
|
|
struct vehicle *vehicle;
|
145 |
|
|
struct layout *layout;
|
146 |
|
|
struct layer *layer;
|
147 |
|
|
struct map *map;
|
148 |
|
|
struct mapset *mapset;
|
149 |
|
|
struct log *log;
|
150 |
|
|
struct route *route;
|
151 |
|
|
struct navigation *navigation;
|
152 |
|
|
struct coord *coord;
|
153 |
|
|
struct pcoord *pcoord;
|
154 |
|
|
struct gui *gui;
|
155 |
|
|
struct graphics *graphics;
|
156 |
|
|
struct tracking *tracking;
|
157 |
|
|
struct itemgra *itemgra;
|
158 |
|
|
struct plugin *plugin;
|
159 |
|
|
struct plugins *plugins;
|
160 |
|
|
struct polygon *polygon;
|
161 |
|
|
struct polyline *polyline;
|
162 |
|
|
struct circle *circle;
|
163 |
|
|
struct text *text;
|
164 |
|
|
struct icon *icon;
|
165 |
|
|
struct image *image;
|
166 |
|
|
struct arrows *arrows;
|
167 |
|
|
struct element *element;
|
168 |
|
|
struct speech *speech;
|
169 |
|
|
struct cursor *cursor;
|
170 |
|
|
struct displaylist *displaylist;
|
171 |
|
|
struct transformation *transformation;
|
172 |
|
|
struct vehicleprofile *vehicleprofile;
|
173 |
|
|
struct roadprofile *roadprofile;
|
174 |
|
|
struct bookmarks *bookmarks;
|
175 |
|
|
struct range {
|
176 |
|
|
short min, max;
|
177 |
|
|
} range;
|
178 |
|
|
int *dash;
|
179 |
|
|
enum item_type *item_types;
|
180 |
|
|
enum attr_type *attr_types;
|
181 |
|
|
long long *num64;
|
182 |
|
|
struct attr *attrs;
|
183 |
|
|
} u;
|
184 |
|
|
};
|
185 |
|
|
|
186 |
|
|
struct attr_iter;
|
187 |
|
|
/* prototypes */
|
188 |
|
|
enum attr_type attr_from_name(const char *name);
|
189 |
|
|
char *attr_to_name(enum attr_type attr);
|
190 |
|
|
struct attr *attr_new_from_text(const char *name, const char *value);
|
191 |
|
|
char *attr_to_text(struct attr *attr, struct map *map, int pretty);
|
192 |
|
|
struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
|
193 |
|
|
int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter);
|
194 |
|
|
struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr);
|
195 |
|
|
struct attr **attr_generic_add_attr(struct attr **attrs, struct attr *attr);
|
196 |
|
|
struct attr **attr_generic_remove_attr(struct attr **attrs, struct attr *attr);
|
197 |
|
|
enum attr_type attr_type_begin(enum attr_type type);
|
198 |
|
|
int attr_data_size(struct attr *attr);
|
199 |
|
|
void *attr_data_get(struct attr *attr);
|
200 |
|
|
void attr_data_set(struct attr *attr, void *data);
|
201 |
|
|
void attr_data_set_le(struct attr *attr, void *data);
|
202 |
|
|
void attr_free(struct attr *attr);
|
203 |
|
|
void attr_dup_content(struct attr *src, struct attr *dst);
|
204 |
|
|
struct attr *attr_dup(struct attr *attr);
|
205 |
|
|
void attr_list_free(struct attr **attrs);
|
206 |
|
|
struct attr **attr_list_dup(struct attr **attrs);
|
207 |
|
|
int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret);
|
208 |
|
|
int attr_types_contains(enum attr_type *types, enum attr_type type);
|
209 |
|
|
int attr_types_contains_default(enum attr_type *types, enum attr_type type, int deflt);
|
210 |
|
|
|
211 |
|
|
char *flags_to_text(int flags);
|
212 |
|
|
|
213 |
|
|
/* end of prototypes */
|
214 |
|
|
#ifdef __cplusplus
|
215 |
|
|
}
|
216 |
|
|
#endif
|
217 |
|
|
|
218 |
|
|
#endif
|