151 |
|
|
152 |
const char *pos_get_bearing_str(pos_t from, pos_t to) { |
const char *pos_get_bearing_str(pos_t from, pos_t to) { |
153 |
static const char *bear_str[]={ |
static const char *bear_str[]={ |
154 |
"N", "NE", "E", "SE", "S", "SW", "W", "NW" }; |
"N", "NE", "E", "SE", "S", "SW", "W", "NW", "" }; |
155 |
int idx = (gpx_pos_get_bearing(from, to)+22.5)/45.0; |
|
156 |
/* make sure we stay in icon bounds */ |
float bearing = gpx_pos_get_bearing(from, to); |
157 |
while(idx < 0) idx += 8; |
if(!isnan(bearing)) { |
158 |
while(idx > 7) idx -= 8; |
int idx = (bearing+22.5)/45.0; |
159 |
return _(bear_str[idx]); |
/* make sure we stay in icon bounds */ |
160 |
|
while(idx < 0) idx += 8; |
161 |
|
while(idx > 7) idx -= 8; |
162 |
|
return _(bear_str[idx]); |
163 |
|
} |
164 |
|
|
165 |
|
return bear_str[8]; // empty string |
166 |
} |
} |
167 |
|
|
168 |
/* the maemo font size is quite huge, so we adjust some fonts */ |
/* the maemo font size is quite huge, so we adjust some fonts */ |