]> err.no Git - mapper/commitdiff
Fix distance display
authorKaj-Michael Lang <milang@tal.org>
Thu, 1 Nov 2007 01:33:03 +0000 (03:33 +0200)
committerKaj-Michael Lang <milang@tal.org>
Thu, 1 Nov 2007 01:33:03 +0000 (03:33 +0200)
src/osm-db.c
src/poi.c
src/search.c

index ca527914a39b6c904468f8a9b8c59d290352209f..e0abcfae5036e2c6d056c72b1612df2e438b3a89 100644 (file)
@@ -968,11 +968,11 @@ if (ltext)
 while (SQLITE_ROW == sqlite3_step(sql.select_way_name_search)) {
        gdouble rlat, rlon, dist;
 
-       rlat=sqlite3_column_double(sql.select_way_name_search, 2);
-       rlon=sqlite3_column_double(sql.select_way_name_search, 3);
+       rlat=sqlite3_column_double(sql.select_way_name_search, 3);
+       rlon=sqlite3_column_double(sql.select_way_name_search, 4);
        lat_format(rlat, tmp1);
        lon_format(rlon, tmp2);
-       dist=0.0;
+       dist=calculate_distance(lat, lon, rlat, rlon) * UNITS_CONVERT[_units];
 
        gtk_list_store_append(*store, &iter);
        gtk_list_store_set(*store, &iter,
@@ -982,7 +982,6 @@ while (SQLITE_ROW == sqlite3_step(sql.select_way_name_search)) {
                ITEM_DIST, dist,
                ITEM_LATLON, g_strdup_printf("%s, %s", tmp1, tmp2),
                ITEM_LABEL, sqlite3_column_text(sql.select_way_name_search, 1),
-               ITEM_DESC, sqlite3_column_text(sql.select_way_name_search, 4),
                -1);
        rows++;
 }
index eebbf238cb6d042cee4652a51b446c12bbcfa09c..d0d08e53dba4e12b21455d3b6f9a513069ce9d88 100644 (file)
--- a/src/poi.c
+++ b/src/poi.c
@@ -553,8 +553,7 @@ while (SQLITE_ROW == sqlite3_step(sql)) {
        rlon=sqlite3_column_double(sql, 1);
        lat_format(rlat, tmp1);
        lon_format(rlon, tmp2);
-
-       dist=calculate_distance(lat, lon, rlat, rlon);
+       dist=calculate_distance(lat, lon, rlat, rlon) * UNITS_CONVERT[_units];
 
        gtk_list_store_append(*store, &iter);
        gtk_list_store_set(*store, &iter,
index 1064f85f2fce8e6490d75d7f27ce4a5eb812aa82..5044327b0b5541574df0037b6d0a400509e3c815 100644 (file)
@@ -84,11 +84,17 @@ search_do_cb(GtkWidget *widget, gpointer data)
 gchar *st;
 guint cid;
 GtkTreeIter iter;
+guint slen;
 search_dialog *s=(search_dialog *)data;
 
-if ((strlen(gtk_entry_get_text(GTK_ENTRY(s->search_entry)))<2) && (cid==-1)) {
+slen=strlen(gtk_entry_get_text(GTK_ENTRY(s->search_entry)));
+
+if (slen<2 && s->stype==SEARCH_TYPE_POI && cid!=-1) {
        popup_error(s->dialog, _("Query string too short. Minimum 2 characters."));
        return TRUE;
+} else if (slen<3 && s->stype!=SEARCH_TYPE_POI) {
+       popup_error(s->dialog, _("Query string too short. Minimum 3 characters."));
+       return TRUE;    
 }
 
 st=g_strdup(gtk_entry_get_text(GTK_ENTRY(s->search_entry)));