* Calculate the distance between two lat/lon pairs. The distance is returned
* in kilometer.
*/
-gfloat
-calculate_distance(gfloat lat1, gfloat lon1, gfloat lat2, gfloat lon2)
+gdouble
+calculate_distance(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2)
{
gdouble dlat, dlon, slat, slon, a;
/** A lat/lon/alt position */
typedef struct _Position Position;
struct _Position {
- gfloat lat;
- gfloat lon;
+ gdouble lat;
+ gdouble lon;
gfloat altitude;
};
typedef struct _PoiData PoiData;
struct _PoiData {
- gfloat lat;
- gfloat lon;
+ gdouble lat;
+ gdouble lon;
gchar *name;
gchar *desc;
};
struct _PoiInfo {
guint poi_id;
guint cat_id;
- gfloat lat;
- gfloat lon;
+ gdouble lat;
+ gdouble lon;
gchar *label;
gchar *desc;
gchar *cat_label;
}
#if 0
-void latlon2unit(gfloat lat, gfloat lon, gint *unitx_, gint *unity_)
+void latlon2unit(gdouble lat, gdouble lon, gint *unitx_, gint *unity_)
{
- gfloat tmp;
+ gdouble tmp;
gint unitx = &unitx_;
gint unity = &unity_;
* (logf((1.f + tmp) / (1.f - tmp)) * 0.5f - MERCATOR_TOP);
}
-void unit2latlon(gint unitx, gint unity, gfloat *lat, gfloat *lon)
+void unit2latlon(gint unitx, gint unity, gdouble *lat, gdouble *lon)
{
(lon) = ((unitx) * (360.f / WORLD_SIZE_UNITS)) - 180.f;
(lat) = (360.f * (atanf(expf(((unity)
#endif
void
-deg_format(DegFormat degformat, gfloat coor, gchar * scoor, gchar neg_char,
+deg_format(DegFormat degformat, gdouble coor, gchar * scoor, gchar neg_char,
gchar pos_char)
{
- gfloat min;
- gfloat acoor = fabs(coor);
+ gdouble min;
+ gdouble acoor = fabs(coor);
printf("%s()\n", __PRETTY_FUNCTION__);
switch (degformat) {
*/
void integerize_data()
{
- gfloat tmp;
+ gdouble tmp;
printf("%s()\n", __PRETTY_FUNCTION__);
latlon2unit(_gps.lat, _gps.lon, _pos.unitx, _pos.unity);
};
#define latlon2unit(lat, lon, unitx, unity) { \
- gfloat tmp; \
+ gdouble tmp; \
unitx = (lon + 180.f) * (WORLD_SIZE_UNITS / 360.f) + 0.5f; \
tmp = sinf(lat * (PI / 180.f)); \
unity = 0.5f + (WORLD_SIZE_UNITS / MERCATOR_SPAN) \
gint download_comparefunc(const ProgressUpdateInfo * a,
const ProgressUpdateInfo * b, gpointer user_data);
-gfloat calculate_distance(gfloat lat1, gfloat lon1, gfloat lat2, gfloat lon2);
-void deg_format(DegFormat degformat, gfloat coor, gchar *scoor, gchar neg_char, gchar pos_char);
+gdouble calculate_distance(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2);
+void deg_format(DegFormat degformat, gdouble coor, gchar *scoor, gchar neg_char, gchar pos_char);
void integerize_data();
#endif