if ((_conn_state == RCVR_FIXED) && (_track_store==TRUE)) {
if ((_gps_filter==TRUE) && (track_drop_cnt<GPS_FILTER_MAX_SKIP)) {
- integerize_data(_vel_offsetx, _vel_offsety, _pos, _gps);
+ integerize_data(&_gps, &_pos);
if ( (_gps.hdop<_filter_hdop || _filter_hdop==0.0) &&
(_gps.vdop<_filter_vdop || _filter_vdop==0.0) &&
(fabs(_gps.heading-_gps.lheading)>_filter_angle || _filter_angle==0.0 ) &&
map_refresh_mark();
} else {
track_drop_cnt=0;
- integerize_data(_vel_offsetx, _vel_offsety, _pos, _gps);
+ integerize_data(&_gps, &_pos);
track_add(_pos.time, newly_fixed);
_gps.lheading=_gps.heading;
map_refresh_mark();
{
_mark_x1 = unit2x(_pos.unitx);
_mark_y1 = unit2y(_pos.unity);
-_mark_x2 = _mark_x1 + (_show_velvec ? _vel_offsetx : 0);
-_mark_y2 = _mark_y1 + (_show_velvec ? _vel_offsety : 0);
+_mark_x2 = _mark_x1 + (_show_velvec ? _gps.vel_offsetx : 0);
+_mark_y2 = _mark_y1 + (_show_velvec ? _gps.vel_offsety : 0);
_mark_minx = MIN(_mark_x1, _mark_x2) - (2 * _draw_width);
_mark_miny = MIN(_mark_y1, _mark_y2) - (2 * _draw_width);
_mark_width = abs(_mark_x1 - _mark_x2) + (4 * _draw_width);
_pos.unity = y2unit((gint) (y + 0.5));
unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon);
_gps.speed = 20.f;
-integerize_data();
+integerize_data(&_gps, &_pos);
track_add(time(NULL), FALSE);
map_refresh_mark();
}
#include "utils.h"
#include "gps.h"
+#include "gpsdata.h"
#include "mapper-types.h"
#include "bt.h"
-void sound_noise(void)
+void
+sound_noise(void)
{
#ifdef WITH_HILDON
hildon_play_system_sound("/usr/share/sounds/ui-information_note.wav");
}
void
-deg_format(DegFormat degformat, gdouble coor, gchar * scoor, gchar neg_char,
- gchar pos_char)
+deg_format(DegFormat degformat, gdouble coor, gchar * scoor, gchar neg_char, gchar pos_char)
{
- gdouble min;
- gdouble acoor = fabs(coor);
- printf("%s()\n", __PRETTY_FUNCTION__);
+gdouble min;
+gdouble acoor=fabs(coor);
- switch (degformat) {
+switch (degformat) {
case DDPDDDDD:
sprintf(scoor, "%.5f°", coor);
break;
coor < 0.f ? neg_char : pos_char);
break;
default:;
- }
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+}
}
/**
* Convert the float lat/lon/speed/heading data into integer units.
*/
-void integerize_data()
+void
+integerize_data(GpsData *gps, Point *pos)
{
- gdouble tmp;
- printf("%s()\n", __PRETTY_FUNCTION__);
-
- latlon2unit(_gps.lat, _gps.lon, _pos.unitx, _pos.unity);
+gdouble tmp;
- tmp = (_gps.heading * (1.f / 180.f)) * PI;
- _vel_offsetx = (gint) (floorf(_gps.speed * sinf(tmp) + 0.5f));
- _vel_offsety = -(gint) (floorf(_gps.speed * cosf(tmp) + 0.5f));
+latlon2unit(gps->lat, gps->lon, pos->unitx, pos->unity);
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+tmp=(gps->heading*(1.f/180.f))*G_PI;
+gps->vel_offsetx=(gint)(floorf(gps->speed*sinf(tmp)+0.5f));
+gps->vel_offsety=-(gint)(floorf(gps->speed*cosf(tmp)+0.5f));
}
gint
-download_comparefunc(const ProgressUpdateInfo * a,
- const ProgressUpdateInfo * b, gpointer user_data)
+download_comparefunc(const ProgressUpdateInfo * a, const ProgressUpdateInfo * b, gpointer user_data)
{
- gint diff = (a->priority - b->priority);
- if (diff)
- return diff;
- diff = (a->tilex - b->tilex);
- if (diff)
- return diff;
- diff = (a->tiley - b->tiley);
- if (diff)
- return diff;
- diff = (a->zoom - b->zoom);
- if (diff)
- return diff;
- diff = (a->repo - b->repo);
- if (diff)
- return diff;
- /* Otherwise, deletes are "greatest" (least priority). */
- if (!a->retries)
- return (b->retries ? -1 : 0);
- else if (!b->retries)
- return (a->retries ? 1 : 0);
- /* Do updates after non-updates (because they'll both be done anyway). */
- return (a->retries - b->retries);
+gint diff = (a->priority - b->priority);
+if (diff)
+ return diff;
+diff = (a->tilex - b->tilex);
+if (diff)
+ return diff;
+diff = (a->tiley - b->tiley);
+if (diff)
+ return diff;
+diff = (a->zoom - b->zoom);
+if (diff)
+ return diff;
+diff = (a->repo - b->repo);
+if (diff)
+ return diff;
+/* Otherwise, deletes are "greatest" (least priority). */
+if (!a->retries)
+ return (b->retries ? -1 : 0);
+else if (!b->retries)
+ return (a->retries ? 1 : 0);
+/* Do updates after non-updates (because they'll both be done anyway). */
+return (a->retries - b->retries);
}
#include <libxml/parser.h>
#include "mapper-types.h"
+#include "gpsdata.h"
/****************************************************************************
* BELOW: DEFINES ***********************************************************
#define unit2y(unit) (unit2pixel(unit) - tile2pixel(_base_tiley) - _offsety)
#define y2unit(y) (pixel2unit(y + _offsety) + tile2unit(_base_tiley))
-#define leadx2unit() (_pos.unitx + (_lead_ratio) * pixel2unit(_vel_offsetx))
-#define leady2unit() (_pos.unity + (0.6f*_lead_ratio)*pixel2unit(_vel_offsety))
+#define leadx2unit() (_pos.unitx + (_lead_ratio) * pixel2unit(_gps.vel_offsetx))
+#define leady2unit() (_pos.unity + (0.6f*_lead_ratio)*pixel2unit(_gps.vel_offsety))
/* Pans are done two "grids" at a time, or 64 pixels. */
#define PAN_UNITS (grid2unit(2))
void sound_noise(void);
gint download_comparefunc(const ProgressUpdateInfo * a, const ProgressUpdateInfo * b, gpointer user_data);
void deg_format(DegFormat degformat, gdouble coor, gchar *scoor, gchar neg_char, gchar pos_char);
-void integerize_data();
+void integerize_data(GpsData *gps, Point *pos);
#endif