]> Pileus Git - aweather/commitdiff
Determine site based on lat-lon location
authorAndy Spencer <andy753421@gmail.com>
Mon, 25 Jan 2010 08:49:52 +0000 (08:49 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 25 Jan 2010 08:51:31 +0000 (08:51 +0000)
Finally!

TODO
src/aweather-gui.c
src/aweather-location.c
src/aweather-location.h
src/main.c
src/plugins/Makefile.am
src/plugins/radar.c
src/plugins/radar.h

diff --git a/TODO b/TODO
index 463fba4f29c54ee7937d7ffafc5a494c09239e3c..d403252a5af24eaac2f9485e4695fb5a0c57d39f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,9 +9,6 @@ Road plan
   * UI docs??
   * GTK docs
 
-0.x - GIS
-  * NEXRAD LLE listings, click to center
-
 0.x - Volume scans
   * Display iso surfaces of volume scans
 
index 59e2b12d38d97c99fd5903d64d4c8a53bc70ede1..060e8ece8acfbaaf1a95593eeae1392081995b59 100644 (file)
@@ -107,7 +107,14 @@ void on_site_changed(GtkComboBox *combo, AWeatherGui *self)
        GtkTreeModel *model = gtk_combo_box_get_model(combo);
        gtk_combo_box_get_active_iter(combo, &iter);
        gtk_tree_model_get(model, &iter, 1, &site, -1);
-       gis_viewer_set_site(self->viewer, site);
+       city_t *city;
+       for (city = cities; city->type; city++)
+               if (city->code && g_str_equal(city->code, site)) {
+                       gis_viewer_set_location(self->viewer,
+                                       city->lat, city->lon, EARTH_R/20);
+                       gis_viewer_set_rotation(self->viewer, 0, 0, 0);
+                       break;
+               }
        g_free(site);
 }
 
@@ -252,11 +259,11 @@ static void site_setup(AWeatherGui *self)
        for (int i = 0; cities[i].label; i++) {
                if (cities[i].type == LOCATION_STATE) {
                        gtk_tree_store_append(store, &state, NULL);
-                       gtk_tree_store_set   (store, &state, 0, cities[i].label, 
+                       gtk_tree_store_set   (store, &state, 0, cities[i].label,
                                                             1, cities[i].code,  -1);
                } else {
                        gtk_tree_store_append(store, &city, &state);
-                       gtk_tree_store_set   (store, &city, 0, cities[i].label, 
+                       gtk_tree_store_set   (store, &city, 0, cities[i].label,
                                                            1, cities[i].code,  -1);
                }
        }
@@ -265,9 +272,6 @@ static void site_setup(AWeatherGui *self)
        GObject   *renderer = aweather_gui_get_object(self, "main_site_rend");
        gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(combo),
                        GTK_CELL_RENDERER(renderer), combo_sensitive, NULL, NULL);
-
-       g_signal_connect(self->viewer, "site-changed",
-                       G_CALLBACK(update_site_widget), self);
 }
 
 static void time_setup(AWeatherGui *self)
@@ -356,17 +360,44 @@ static void update_times(AWeatherGui *self, GisViewer *viewer, char *site)
                /* update_times_gtk from update_times_online_cb */
        }
 }
-static void on_gis_site_changed(GisViewer *viewer, char *site, gpointer _self)
+/* FIXME: This is redundent with the radar plugin
+ *        Make a shared wsr88d file? */
+static void on_gis_location_changed(GisViewer *viewer,
+               gdouble lat, gdouble lon, gdouble elev,
+               gpointer _self)
 {
        AWeatherGui *self = AWEATHER_GUI(_self);
-       g_debug("AWeatherGui: on_site_changed - Loading wsr88d list for %s", site);
-       update_times(self, viewer, site);
+       gdouble min_dist = EARTH_R / 5;
+       city_t *city, *min_city = NULL;
+       for (city = cities; city->type; city++) {
+               if (city->type != LOCATION_CITY)
+                       continue;
+               gdouble city_loc[3] = {};
+               gdouble eye_loc[3]  = {lat, lon, elev};
+               lle2xyz(city->lat, city->lon, city->elev,
+                               &city_loc[0], &city_loc[1], &city_loc[2]);
+               lle2xyz(lat, lon, elev,
+                               &eye_loc[0], &eye_loc[1], &eye_loc[2]);
+               gdouble dist = distd(city_loc, eye_loc);
+               if (dist < min_dist) {
+                       min_dist = dist;
+                       min_city = city;
+               }
+       }
+       static city_t *last_city = NULL;
+       if (min_city && min_city != last_city) {
+               update_site_widget(self->viewer, min_city->code, self);
+               update_times(self, viewer, min_city->code);
+       }
+       last_city = min_city;
 }
 static void on_gis_refresh(GisViewer *viewer, gpointer _self)
 {
        AWeatherGui *self = AWEATHER_GUI(_self);
-       char *site = gis_viewer_get_site(self->viewer);
-       update_times(self, self->viewer, site);
+       gdouble lat, lon, elev;
+       gis_viewer_get_location(self->viewer, &lat, &lon, &elev);
+       /* Hack to update times */
+       on_gis_location_changed(self->viewer, lat, lon, elev, self);
 }
 
 
@@ -492,8 +523,10 @@ static void aweather_gui_init(AWeatherGui *self)
                        aweather_gui_get_object(self, "offline"));
 
        /* deprecated site stuff */
-       g_signal_connect(self->viewer, "site-changed", G_CALLBACK(on_gis_site_changed), self);
-       g_signal_connect(self->viewer, "refresh",      G_CALLBACK(on_gis_refresh),      self);
+       g_signal_connect(self->viewer, "location-changed",
+                       G_CALLBACK(on_gis_location_changed), self);
+       g_signal_connect(self->viewer, "refresh",
+                       G_CALLBACK(on_gis_refresh), self);
 }
 static GObject *aweather_gui_constructor(GType gtype, guint n_properties,
                GObjectConstructParam *properties)
index c4952d058df775dd7b4b443057a9eab204de1f78..bb123747211ebd8ed4fba270dfb76f114c229715 100644 (file)
 #include "aweather-location.h"
 
 city_t cities[] = {
-       {LOCATION_STATE, NULL,   "Alabama",           0, 0, 0},
-       {LOCATION_CITY,  "KBMX", "Birmingham",        0, 0, 0},
-       {LOCATION_CITY,  "KMXX", "E. Alabama",        0, 0, 0},
-       {LOCATION_CITY,  "KEOX", "Fort Rucker",       0, 0, 0},
-       {LOCATION_CITY,  "KMOB", "Mobile",            0, 0, 0},
-       {LOCATION_CITY,  "KHTX", "Nrn. Alabama",      0, 0, 0},
-       {LOCATION_STATE, NULL,   "Alaska",            0, 0, 0},
-       {LOCATION_CITY,  "KABC", "Bethel",            0, 0, 0},
-       {LOCATION_CITY,  "KACG", "Biorka Is.",        0, 0, 0},
-       {LOCATION_CITY,  "KAPD", "Fairbanks",         0, 0, 0},
-       {LOCATION_CITY,  "KAHG", "Kenai",             0, 0, 0},
-       {LOCATION_CITY,  "KAKC", "King Salmon",       0, 0, 0},
-       {LOCATION_CITY,  "KAIH", "Middleton Is.",     0, 0, 0},
-       {LOCATION_CITY,  "KAEC", "Nome",              0, 0, 0},
-       {LOCATION_CITY,  "KAPD", "Pedro Dome",        0, 0, 0},
-       {LOCATION_CITY,  "KACG", "Sitka",             0, 0, 0},
-       {LOCATION_STATE, NULL,   "Arizona",           0, 0, 0},
-       {LOCATION_CITY,  "KFSX", "Flagstaff",         0, 0, 0},
-       {LOCATION_CITY,  "KIWA", "Phoenix",           0, 0, 0},
-       {LOCATION_CITY,  "KEMX", "Tucson",            0, 0, 0},
-       {LOCATION_CITY,  "KYUX", "Yuma",              0, 0, 0},
-       {LOCATION_STATE, NULL,   "Arkansas",          0, 0, 0},
-       {LOCATION_CITY,  "KLZK", "Little Rock",       0, 0, 0},
-       {LOCATION_CITY,  "KSRX", "W. Ark./Ft. Smith", 0, 0, 0},
-       {LOCATION_STATE, NULL,   "California",        0, 0, 0},
-       {LOCATION_CITY,  "KBBX", "Beale AFB",         0, 0, 0},
-       {LOCATION_CITY,  "KEYX", "Edwards AFB",       0, 0, 0},
-       {LOCATION_CITY,  "KBHX", "Eureka",            0, 0, 0},
-       {LOCATION_CITY,  "KHNX", "Hanford",           0, 0, 0},
-       {LOCATION_CITY,  "KVTX", "Los Angeles",       0, 0, 0},
-       {LOCATION_CITY,  "KDAX", "Sacramento",        0, 0, 0},
-       {LOCATION_CITY,  "KNKX", "San Diego",         0, 0, 0},
-       {LOCATION_CITY,  "KMUX", "San Francisco",     0, 0, 0},
-       {LOCATION_CITY,  "KHNX", "San Joaquin Vly.",  0, 0, 0},
-       {LOCATION_CITY,  "KSOX", "Santa Ana Mtns",    0, 0, 0},
-       {LOCATION_CITY,  "KVBX", "Vandenberg AFB",    0, 0, 0},
-       {LOCATION_STATE, NULL,   "Colorado",          0, 0, 0},
-       {LOCATION_CITY,  "KFTG", "Denver/Boulder",    0, 0, 0},
-       {LOCATION_CITY,  "KGJX", "Grand Junction",    0, 0, 0},
-       {LOCATION_CITY,  "KPUX", "Pueblo",            0, 0, 0},
-       {LOCATION_STATE, NULL,   "Delaware",          0, 0, 0},
-       {LOCATION_CITY,  "KDOX", "Dover AFB",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Florida",           0, 0, 0},
-       {LOCATION_CITY,  "KEVX", "Eglin AFB",         0, 0, 0},
-       {LOCATION_CITY,  "KJAX", "Jacksonville",      0, 0, 0},
-       {LOCATION_CITY,  "KBYX", "Key West",          0, 0, 0},
-       {LOCATION_CITY,  "KMLB", "Melbourne",         0, 0, 0},
-       {LOCATION_CITY,  "KAMX", "Miami",             0, 0, 0},
-       {LOCATION_CITY,  "KEVX", "NW Florida",        0, 0, 0},
-       {LOCATION_CITY,  "KTLH", "Tallahassee",       0, 0, 0},
-       {LOCATION_CITY,  "KTBW", "Tampa Bay Area",    0, 0, 0},
-       {LOCATION_STATE, NULL,   "Georgia",           0, 0, 0},
-       {LOCATION_CITY,  "KFFC", "Atlanta",           0, 0, 0},
-       {LOCATION_CITY,  "KVAX", "Moody AFB",         0, 0, 0},
-       {LOCATION_CITY,  "KFFC", "Peachtree City",    0, 0, 0},
-       {LOCATION_CITY,  "KJGX", "Robins AFB",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "Guam",              0, 0, 0},
-       {LOCATION_CITY,  "KGUA", "Andersen AFB",      0, 0, 0},
-       {LOCATION_STATE, NULL,   "Hawaii",            0, 0, 0},
-       {LOCATION_CITY,  "KHKI", "Kauai",             0, 0, 0},
-       {LOCATION_CITY,  "KHKM", "Kohala",            0, 0, 0},
-       {LOCATION_CITY,  "KHMO", "Molokai",           0, 0, 0},
-       {LOCATION_CITY,  "KHWA", "South Shore",       0, 0, 0},
-       {LOCATION_STATE, NULL,   "Idaho",             0, 0, 0},
-       {LOCATION_CITY,  "KCBX", "Boise",             0, 0, 0},
-       {LOCATION_CITY,  "KSFX", "Pocatello",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Illinois",          0, 0, 0},
-       {LOCATION_CITY,  "KILX", "Central IL",        0, 0, 0},
-       {LOCATION_CITY,  "KLOT", "Chicago",           0, 0, 0},
-       {LOCATION_STATE, NULL,   "Indiana",           0, 0, 0},
-       {LOCATION_CITY,  "KVWX", "Evansville",        0, 0, 0},
-       {LOCATION_CITY,  "KIND", "Indianapolis",      0, 0, 0},
-       {LOCATION_CITY,  "KIWX", "Nrn. Indiana",      0, 0, 0},
-       {LOCATION_STATE, NULL,   "Iowa",              0, 0, 0},
-       {LOCATION_CITY,  "KDMX", "Des Moines",        0, 0, 0},
-       {LOCATION_CITY,  "KDVN", "Quad Cities",       0, 0, 0},
-       {LOCATION_STATE, NULL,   "Kansas",            0, 0, 0},
-       {LOCATION_CITY,  "KDDC", "Dodge City",        0, 0, 0},
-       {LOCATION_CITY,  "KGLD", "Goodland",          0, 0, 0},
-       {LOCATION_CITY,  "KTWX", "Topeka",            0, 0, 0},
-       {LOCATION_CITY,  "KICT", "Wichita",           0, 0, 0},
-       {LOCATION_STATE, NULL,   "Kentucky",          0, 0, 0},
-       {LOCATION_CITY,  "KHPX", "Fort Cambell",      0, 0, 0},
-       {LOCATION_CITY,  "KJKL", "Jackson",           0, 0, 0},
-       {LOCATION_CITY,  "KLVX", "Louisville",        0, 0, 0},
-       {LOCATION_CITY,  "KPAH", "Paducah",           0, 0, 0},
-       {LOCATION_STATE, NULL,   "Louisiana",         0, 0, 0},
-       {LOCATION_CITY,  "KPOE", "Fort Polk",         0, 0, 0},
-       {LOCATION_CITY,  "KLCH", "Lake Charles",      0, 0, 0},
-       {LOCATION_CITY,  "KLIX", "New Orleans",       0, 0, 0},
-       {LOCATION_CITY,  "KSHV", "Shreveport",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "Maine",             0, 0, 0},
-       {LOCATION_CITY,  "KCBW", "Caribou",           0, 0, 0},
-       {LOCATION_CITY,  "KGYX", "Portland",          0, 0, 0},
-       {LOCATION_STATE, NULL,   "Maryland",          0, 0, 0},
-       {LOCATION_CITY,  "KLWX", "Baltimore",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Massachusetts",     0, 0, 0},
-       {LOCATION_CITY,  "KBOX", "Boston",            0, 0, 0},
-       {LOCATION_STATE, NULL,   "Michigan",          0, 0, 0},
-       {LOCATION_CITY,  "KDTX", "Detroit",           0, 0, 0},
-       {LOCATION_CITY,  "KAPX", "Gaylord",           0, 0, 0},
-       {LOCATION_CITY,  "KGRR", "Grand Rapids",      0, 0, 0},
-       {LOCATION_CITY,  "KMQT", "Marquette",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Minnesota",         0, 0, 0},
-       {LOCATION_CITY,  "KDLH", "Duluth",            0, 0, 0},
-       {LOCATION_CITY,  "KMPX", "Minneapolis",       0, 0, 0},
-       {LOCATION_STATE, NULL,   "Mississippi",       0, 0, 0},
-       {LOCATION_CITY,  "KGWX", "Columbus AFB",      0, 0, 0},
-       {LOCATION_CITY,  "KDGX", "Jackson/Brandon",   0, 0, 0},
-       {LOCATION_STATE, NULL,   "Missouri",          0, 0, 0},
-       {LOCATION_CITY,  "KEAX", "Kansas City",       0, 0, 0},
-       {LOCATION_CITY,  "KSGF", "Springfield",       0, 0, 0},
-       {LOCATION_CITY,  "KLSX", "St. Louis",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Montana",           0, 0, 0},
-       {LOCATION_CITY,  "KBLX", "Billings",          0, 0, 0},
-       {LOCATION_CITY,  "KGGW", "Glasgow",           0, 0, 0},
-       {LOCATION_CITY,  "KTFX", "Great Falls",       0, 0, 0},
-       {LOCATION_CITY,  "KMSX", "Missoula",          0, 0, 0},
-       {LOCATION_STATE, NULL,   "Nebraska",          0, 0, 0},
-       {LOCATION_CITY,  "KUEX", "Hastings",          0, 0, 0},
-       {LOCATION_CITY,  "KLNX", "North Platte",      0, 0, 0},
-       {LOCATION_CITY,  "KOAX", "Omaha",             0, 0, 0},
-       {LOCATION_STATE, NULL,   "Nevada",            0, 0, 0},
-       {LOCATION_CITY,  "KLRX", "Elko",              0, 0, 0},
-       {LOCATION_CITY,  "KESX", "Las Vegas",         0, 0, 0},
-       {LOCATION_CITY,  "KRGX", "Reno",              0, 0, 0},
-       {LOCATION_STATE, NULL,   "New Jersey",        0, 0, 0},
-       {LOCATION_CITY,  "KDIX", "Mt. Holly",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "New Mexico",        0, 0, 0},
-       {LOCATION_CITY,  "KABX", "Albuquerque",       0, 0, 0},
-       {LOCATION_CITY,  "KFDX", "Cannon AFB",        0, 0, 0},
-       {LOCATION_CITY,  "KHDX", "Holloman AFB",      0, 0, 0},
-       {LOCATION_STATE, NULL,   "New York",          0, 0, 0},
-       {LOCATION_CITY,  "KENX", "Albany",            0, 0, 0},
-       {LOCATION_CITY,  "KBGM", "Binghamton",        0, 0, 0},
-       {LOCATION_CITY,  "KBUF", "Buffalo",           0, 0, 0},
-       {LOCATION_CITY,  "KTYX", "Montague",          0, 0, 0},
-       {LOCATION_CITY,  "KOKX", "New York City",     0, 0, 0},
-       {LOCATION_CITY,  "KOKX", "Upton",             0, 0, 0},
-       {LOCATION_STATE, NULL,   "North Carolina",    0, 0, 0},
-       {LOCATION_CITY,  "KRAX", "Durham",            0, 0, 0},
-       {LOCATION_CITY,  "KMHX", "Morehead City",     0, 0, 0},
-       {LOCATION_CITY,  "KRAX", "Raleigh",           0, 0, 0},
-       {LOCATION_CITY,  "KLTX", "Wilmington",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "North Dakota",      0, 0, 0},
-       {LOCATION_CITY,  "KBIS", "Bismarck",          0, 0, 0},
-       {LOCATION_CITY,  "KMVX", "Grand Forks",       0, 0, 0},
-       {LOCATION_CITY,  "KMBX", "Minot AFB",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Ohio",              0, 0, 0},
-       {LOCATION_CITY,  "KILN", "Cincinnati",        0, 0, 0},
-       {LOCATION_CITY,  "KCLE", "Cleveland",         0, 0, 0},
-       {LOCATION_CITY,  "KILN", "Dayton",            0, 0, 0},
-       {LOCATION_CITY,  "KILN", "Wilmington",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "Oklahoma",          0, 0, 0},
-       {LOCATION_CITY,  "KFDR", "Frederick",         0, 0, 0},
-       {LOCATION_CITY,  "KTLX", "Oklahoma City",     0, 0, 0},
-       {LOCATION_CITY,  "KINX", "Tulsa",             0, 0, 0},
-       {LOCATION_CITY,  "KVNX", "Vance AFB",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Oregon",            0, 0, 0},
-       {LOCATION_CITY,  "KMAX", "Medford",           0, 0, 0},
-       {LOCATION_CITY,  "KPDT", "Pendleton",         0, 0, 0},
-       {LOCATION_CITY,  "KRTX", "Portland",          0, 0, 0},
-       {LOCATION_STATE, NULL,   "Pennsylvania",      0, 0, 0},
-       {LOCATION_CITY,  "KDIX", "Philadelphia",      0, 0, 0},
-       {LOCATION_CITY,  "KPBZ", "Pittsburgh",        0, 0, 0},
-       {LOCATION_CITY,  "KCCX", "State College",     0, 0, 0},
-       {LOCATION_STATE, NULL,   "Puerto Rico",       0, 0, 0},
-       {LOCATION_CITY,  "KJUA", "Puerto Rico/V.I.",  0, 0, 0},
-       {LOCATION_STATE, NULL,   "South Carolina",    0, 0, 0},
-       {LOCATION_CITY,  "KCLX", "Charleston",        0, 0, 0},
-       {LOCATION_CITY,  "KCAE", "Columbia",          0, 0, 0},
-       {LOCATION_CITY,  "KGSP", "Greenville",        0, 0, 0},
-       {LOCATION_CITY,  "KGSP", "Spartanburg",       0, 0, 0},
-       {LOCATION_CITY,  "KGSP", "Greer",             0, 0, 0},
-       {LOCATION_STATE, NULL,   "South Dakota",      0, 0, 0},
-       {LOCATION_CITY,  "KABR", "Aberdeen",          0, 0, 0},
-       {LOCATION_CITY,  "KUDX", "Rapid City",        0, 0, 0},
-       {LOCATION_CITY,  "KFSD", "Sioux falls",       0, 0, 0},
-       {LOCATION_STATE, NULL,   "Tennessee",         0, 0, 0},
-       {LOCATION_CITY,  "KMRX", "Knoxville",         0, 0, 0},
-       {LOCATION_CITY,  "KNQA", "Memphis",           0, 0, 0},
-       {LOCATION_CITY,  "KMRX", "Morristown",        0, 0, 0},
-       {LOCATION_CITY,  "KOHX", "Nashville",         0, 0, 0},
-       {LOCATION_CITY,  "KMRX", "Tri Cities",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "Texas",             0, 0, 0},
-       {LOCATION_CITY,  "KAMA", "Amarillo",          0, 0, 0},
-       {LOCATION_CITY,  "KEWX", "Austin",            0, 0, 0},
-       {LOCATION_CITY,  "KBRO", "Brownsville",       0, 0, 0},
-       {LOCATION_CITY,  "KGRK", "Central Texas",     0, 0, 0},
-       {LOCATION_CITY,  "KCRP", "Corpus Christi",    0, 0, 0},
-       {LOCATION_CITY,  "KFWS", "Dallas",            0, 0, 0},
-       {LOCATION_CITY,  "KDYX", "Dyess AFB",         0, 0, 0},
-       {LOCATION_CITY,  "KEPZ", "El Paso",           0, 0, 0},
-       {LOCATION_CITY,  "KFWS", "Fort Worth",        0, 0, 0},
-       {LOCATION_CITY,  "KHGX", "Galveston",         0, 0, 0},
-       {LOCATION_CITY,  "KHGX", "Houston",           0, 0, 0},
-       {LOCATION_CITY,  "KDFX", "Laughlin AFB",      0, 0, 0},
-       {LOCATION_CITY,  "KLBB", "Lubbock",           0, 0, 0},
-       {LOCATION_CITY,  "KMAF", "Midland/Odessa",    0, 0, 0},
-       {LOCATION_CITY,  "KSJT", "San Angelo",        0, 0, 0},
-       {LOCATION_CITY,  "KEWX", "San Antonio",       0, 0, 0},
-       {LOCATION_STATE, NULL,   "Utah",              0, 0, 0},
-       {LOCATION_CITY,  "KICX", "Cedar City",        0, 0, 0},
-       {LOCATION_CITY,  "KMTX", "Salt Lake City",    0, 0, 0},
-       {LOCATION_STATE, NULL,   "Vermont",           0, 0, 0},
-       {LOCATION_CITY,  "KCXX", "Burlington",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "Virginia",          0, 0, 0},
-       {LOCATION_CITY,  "KFCX", "Blacksburg",        0, 0, 0},
-       {LOCATION_CITY,  "KAKQ", "Norfolk",           0, 0, 0},
-       {LOCATION_CITY,  "KAKQ", "Richmond",          0, 0, 0},
-       {LOCATION_CITY,  "KFCX", "Roanoke",           0, 0, 0},
-       {LOCATION_CITY,  "KLWX", "Sterling",          0, 0, 0},
-       {LOCATION_CITY,  "KAKQ", "Wakefield",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Washington",        0, 0, 0},
-       {LOCATION_CITY,  "KATX", "Seattle",           0, 0, 0},
-       {LOCATION_CITY,  "KOTX", "Spokane",           0, 0, 0},
-       {LOCATION_CITY,  "KATX", "Tacoma",            0, 0, 0},
-       {LOCATION_STATE, NULL,   "Washington DC",     0, 0, 0},
-       {LOCATION_CITY,  "KLWX", "Washington",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "West Virginia",     0, 0, 0},
-       {LOCATION_CITY,  "KRLX", "Charleston",        0, 0, 0},
-       {LOCATION_STATE, NULL,   "Wisconsin",         0, 0, 0},
-       {LOCATION_CITY,  "KGRB", "Green Bay",         0, 0, 0},
-       {LOCATION_CITY,  "KARX", "La Crosse",         0, 0, 0},
-       {LOCATION_CITY,  "KMKX", "Milwaukee",         0, 0, 0},
-       {LOCATION_STATE, NULL,   "Wyoming",           0, 0, 0},
-       {LOCATION_CITY,  "KCYS", "Cheyenne",          0, 0, 0},
-       {LOCATION_CITY,  "KRIW", "Riverton",          0, 0, 0},
-       {0,               NULL,   NULL,               0, 0, 0},
+       {LOCATION_STATE, NULL,   "Alabama",           0,        0,       0},
+       {LOCATION_CITY,  "KBMX", "Birmingham",        33.1722, -86.77,   0},
+       {LOCATION_CITY,  "KHTX", "Nrn. Alabama",      34.9306, -86.0833, 0},
+       {LOCATION_CITY,  "KMOB", "Mobile",            30.6794, -88.2397, 0},
+       {LOCATION_STATE, NULL,   "Arizona",           0,        0,       0},
+       {LOCATION_CITY,  "KEMX", "Tucson",            31.8936, -110.63,  0},
+       {LOCATION_CITY,  "KFSX", "Flagstaff",         34.5744, -111.198, 0},
+       {LOCATION_CITY,  "KIWA", "Phoenix",           33.2892, -111.67,  0},
+       {LOCATION_CITY,  "KYUX", "Yuma",              32.4953, -114.657, 0},
+       {LOCATION_STATE, NULL,   "Arkansas",          0,        0,       0},
+       {LOCATION_CITY,  "KLZK", "Little Rock",       34.8367, -92.2622, 0},
+       {LOCATION_STATE, NULL,   "California",        0,        0,       0},
+       {LOCATION_CITY,  "KBBX", "Beale AFB",         39.4961, -121.632, 0},
+       {LOCATION_CITY,  "KBHX", "Eureka",            40.4983, -124.292, 0},
+       {LOCATION_CITY,  "KDAX", "Sacramento",        38.5011, -121.678, 0},
+       {LOCATION_CITY,  "KHNX", "Hanford",           36.3142, -119.632, 0},
+       {LOCATION_CITY,  "KMUX", "San Francisco",     37.155, -121.898,  0},
+       {LOCATION_CITY,  "KNKX", "San Diego",         32.9189, -117.042, 0},
+       {LOCATION_CITY,  "KSOX", "Santa Ana Mtns",    33.8178, -117.636, 0},
+       {LOCATION_CITY,  "KVTX", "Los Angeles",       34.4117, -119.18,  0},
+       {LOCATION_STATE, NULL,   "Colorado",          0,        0,       0},
+       {LOCATION_CITY,  "KFTG", "Denver/Boulder",    39.7867, -104.546, 0},
+       {LOCATION_CITY,  "KGJX", "Grand Junction",    39.0622, -108.214, 0},
+       {LOCATION_CITY,  "KPUX", "Pueblo",            38.4594, -104.181, 0},
+       {LOCATION_STATE, NULL,   "Delaware",          0,        0,       0},
+       {LOCATION_CITY,  "KDOX", "Dover AFB",         38.8256, -75.44,   0},
+       {LOCATION_STATE, NULL,   "Florida",           0,        0,       0},
+       {LOCATION_CITY,  "KAMX", "Miami",             25.6111, -80.4128, 0},
+       {LOCATION_CITY,  "KBYX", "Key West",          24.5975, -81.7031, 0},
+       {LOCATION_CITY,  "KEVX", "NW Florida",        30.5644, -85.9214, 0},
+       {LOCATION_CITY,  "KJAX", "Jacksonville",      30.4847, -81.7019, 0},
+       {LOCATION_CITY,  "KMLB", "Melbourne",         28.1133, -80.6542, 0},
+       {LOCATION_CITY,  "KTBW", "Tampa Bay Area",    27.7056, -82.4017, 0},
+       {LOCATION_CITY,  "KTLH", "Tallahassee",       30.3975, -84.3289, 0},
+       {LOCATION_STATE, NULL,   "Georgia",           0,        0,       0},
+       {LOCATION_CITY,  "KFFC", "Atlanta",           33.3636, -84.5658, 0},
+       {LOCATION_CITY,  "KJGX", "Robins AFB",        32.675, -83.3511,  0},
+       {LOCATION_STATE, NULL,   "Idaho",             0,        0,       0},
+       {LOCATION_CITY,  "KCBX", "Boise",             43.4908, -116.236, 0},
+       {LOCATION_CITY,  "KSFX", "Pocatello",         43.1058, -112.686, 0},
+       {LOCATION_STATE, NULL,   "Illinois",          0,        0,       0},
+       {LOCATION_CITY,  "KILX", "Central IL",        40.1506, -89.3369, 0},
+       {LOCATION_CITY,  "KLOT", "Chicago",           41.6047, -88.0847, 0},
+       {LOCATION_STATE, NULL,   "Indiana",           0,        0,       0},
+       {LOCATION_CITY,  "KIND", "Indianapolis",      39.707,  -86.2803, 0},
+       {LOCATION_STATE, NULL,   "Iowa",              0,        0,       0},
+       {LOCATION_CITY,  "KDMX", "Des Moines",        41.731,  -93.7228, 0},
+       {LOCATION_CITY,  "KDVN", "Quad Cities",       41.611,  -90.5808, 0},
+       {LOCATION_STATE, NULL,   "Kansas",            0,        0,       0},
+       {LOCATION_CITY,  "KDDC", "Dodge City",        37.760,  -99.9686, 0},
+       {LOCATION_CITY,  "KGLD", "Goodland",          39.366,  -101.701, 0},
+       {LOCATION_CITY,  "KICT", "Wichita",           37.654,  -97.4428, 0},
+       {LOCATION_CITY,  "KTWX", "Topeka",            38.996,  -96.2325, 0},
+       {LOCATION_STATE, NULL,   "Kentucky",          0,        0,       0},
+       {LOCATION_CITY,  "KJKL", "Jackson",           37.590,  -83.3131, 0},
+       {LOCATION_CITY,  "KLVX", "Louisville",        37.975,  -85.9439, 0},
+       {LOCATION_CITY,  "KPAH", "Paducah",           37.068,  -88.7719, 0},
+       {LOCATION_STATE, NULL,   "Louisiana",         0,        0,       0},
+       {LOCATION_CITY,  "KLCH", "Lake Charles",      30.125,  -93.2158, 0},
+       {LOCATION_CITY,  "KLIX", "New Orleans",       30.336,  -89.8256, 0},
+       {LOCATION_CITY,  "KPOE", "Fort Polk",         31.155,  -92.9758, 0},
+       {LOCATION_CITY,  "KSHV", "Shreveport",        32.450,  -93.8414, 0},
+       {LOCATION_STATE, NULL,   "Maine",             0,        0,       0},
+       {LOCATION_CITY,  "KCBW", "Caribou",           46.039,  -67.8067, 0},
+       {LOCATION_CITY,  "KGYX", "Portland",          43.891,  -70.2567, 0},
+       {LOCATION_STATE, NULL,   "Maryland",          0,        0,       0},
+       {LOCATION_CITY,  "KLWX", "Baltimore",         38.975,  -77.4778, 0},
+       {LOCATION_STATE, NULL,   "Massachusetts",     0,        0,       0},
+       {LOCATION_CITY,  "KBOX", "Boston",            41.955,  -71.1369, 0},
+       {LOCATION_STATE, NULL,   "Michigan",          0,        0,       0},
+       {LOCATION_CITY,  "KAPX", "Gaylord",           44.907,  -84.7197, 0},
+       {LOCATION_CITY,  "KDTX", "Detroit",           42.699,  -83.4717, 0},
+       {LOCATION_CITY,  "KGRR", "Grand Rapids",      42.893,  -85.5447, 0},
+       {LOCATION_CITY,  "KMQT", "Marquette",         46.531,  -87.5483, 0},
+       {LOCATION_STATE, NULL,   "Minnesota",         0,        0,       0},
+       {LOCATION_CITY,  "KDLH", "Duluth",            46.836,  -92.2097, 0},
+       {LOCATION_CITY,  "KMPX", "Minneapolis",       44.848,  -93.5656, 0},
+       {LOCATION_STATE, NULL,   "Mississippi",       0,        0,       0},
+       {LOCATION_CITY,  "KDGX", "Jackson/Brandon",   32.275,  -89.98,   0},
+       {LOCATION_CITY,  "KGWX", "Columbus AFB",      33.896,  -88.3289, 0},
+       {LOCATION_STATE, NULL,   "Missouri",          0,        0,       0},
+       {LOCATION_CITY,  "KEAX", "Kansas City",       38.810,  -94.2644, 0},
+       {LOCATION_CITY,  "KLSX", "St. Louis",         38.698,  -90.6828, 0},
+       {LOCATION_CITY,  "KSGF", "Springfield",       37.235,  -93.4006, 0},
+       {LOCATION_STATE, NULL,   "Montana",           0,        0,       0},
+       {LOCATION_CITY,  "KBLX", "Billings",          45.853,  -108.607, 0},
+       {LOCATION_CITY,  "KGGW", "Glasgow",           48.206,  -106.625, 0},
+       {LOCATION_CITY,  "KMSX", "Missoula",          47.041,  -113.986, 0},
+       {LOCATION_CITY,  "KTFX", "Great Falls",       47.459,  -111.385, 0},
+       {LOCATION_STATE, NULL,   "Nebraska",          0,        0,       0},
+       {LOCATION_CITY,  "KLNX", "North Platte",      41.957,  -100.576, 0},
+       {LOCATION_CITY,  "KOAX", "Omaha",             41.320,  -96.3667, 0},
+       {LOCATION_CITY,  "KUEX", "Hastings",          40.320,  -98.4419, 0},
+       {LOCATION_STATE, NULL,   "Nevada",            0,        0,       0},
+       {LOCATION_CITY,  "KESX", "Las Vegas",         35.701,  -114.891, 0},
+       {LOCATION_CITY,  "KLRX", "Elko",              40.739,  -116.803, 0},
+       {LOCATION_CITY,  "KRGX", "Reno",              39.755,  -119.462, 0},
+       {LOCATION_STATE, NULL,   "New Jersey",        0,        0,       0},
+       {LOCATION_CITY,  "KDIX", "Mt. Holly",         39.946,  -74.4108, 0},
+       {LOCATION_STATE, NULL,   "New Mexico",        0,        0,       0},
+       {LOCATION_CITY,  "KABX", "Albuquerque",       35.149,  -106.824, 0},
+       {LOCATION_CITY,  "KFDX", "Cannon AFB",        34.635,  -103.63,  0},
+       {LOCATION_CITY,  "KHDX", "Holloman AFB",      33.076,  -106.123, 0},
+       {LOCATION_STATE, NULL,   "New York",          0,        0,       0},
+       {LOCATION_CITY,  "KBGM", "Binghamton",        42.199,  -75.9847, 0},
+       {LOCATION_CITY,  "KBUF", "Buffalo",           42.948,  -78.7367, 0},
+       {LOCATION_CITY,  "KENX", "Albany",            42.586,  -74.0639, 0},
+       {LOCATION_CITY,  "KOKX", "New York City",     40.865,  -72.8639, 0},
+       {LOCATION_STATE, NULL,   "North Carolina",    0,        0,       0},
+       {LOCATION_CITY,  "KLTX", "Wilmington",        33.989,  -78.4289, 0},
+       {LOCATION_CITY,  "KMHX", "Morehead City",     34.776,  -76.8761, 0},
+       {LOCATION_CITY,  "KRAX", "Raleigh",           35.665,  -78.4897, 0},
+       {LOCATION_STATE, NULL,   "North Dakota",      0,        0,       0},
+       {LOCATION_CITY,  "KBIS", "Bismarck",          46.770,  -100.761, 0},
+       {LOCATION_CITY,  "KMVX", "Grand Forks",       47.527,  -97.3256, 0},
+       {LOCATION_STATE, NULL,   "Ohio",              0,        0,       0},
+       {LOCATION_CITY,  "KCLE", "Cleveland",         41.413,  -81.8597, 0},
+       {LOCATION_CITY,  "KILN", "Cincinnati",        39.420,  -83.8217, 0},
+       {LOCATION_STATE, NULL,   "Oklahoma",          0,        0,       0},
+       {LOCATION_CITY,  "KFDR", "Frederick",         34.362,  -98.9764, 0},
+       {LOCATION_CITY,  "KINX", "Tulsa",             36.17,  -95.5647,  0},
+       {LOCATION_CITY,  "KTLX", "Oklahoma City",     35.333,  -97.2778, 0},
+       {LOCATION_CITY,  "KVNX", "Vance AFB",         36.740,  -98.1278, 0},
+       {LOCATION_STATE, NULL,   "Oregon",            0,        0,       0},
+       {LOCATION_CITY,  "KMAX", "Medford",           42.081,  -122.717, 0},
+       {LOCATION_CITY,  "KPDT", "Pendleton",         45.690,  -118.853, 0},
+       {LOCATION_CITY,  "KRTX", "Portland",          45.714,  -122.966, 0},
+       {LOCATION_STATE, NULL,   "Pennsylvania",      0,        0,       0},
+       {LOCATION_CITY,  "KCCX", "State College",     40.923,  -78.0036, 0},
+       {LOCATION_CITY,  "KDIX", "Philadelphia",      39.946,  -74.4108, 0},
+       {LOCATION_CITY,  "KPBZ", "Pittsburgh",        40.531,  -80.2183, 0},
+       {LOCATION_STATE, NULL,   "South Carolina",    0,        0,       0},
+       {LOCATION_CITY,  "KCAE", "Columbia",          33.948,  -81.1183, 0},
+       {LOCATION_CITY,  "KCLX", "Charleston",        32.655,  -81.0419, 0},
+       {LOCATION_CITY,  "KGSP", "Greenville",        34.866,  -82.22,   0},
+       {LOCATION_STATE, NULL,   "South Dakota",      0,        0,       0},
+       {LOCATION_CITY,  "KABR", "Aberdeen",          45.455,  -98.4131, 0},
+       {LOCATION_CITY,  "KFSD", "Sioux falls",       43.587,  -96.7294, 0},
+       {LOCATION_CITY,  "KUDX", "Rapid City",        44.12,  -102.83,   0},
+       {LOCATION_STATE, NULL,   "Tennessee",         0,        0,       0},
+       {LOCATION_CITY,  "KMRX", "Knoxville",         36.168,  -83.4017, 0},
+       {LOCATION_CITY,  "KNQA", "Memphis",           35.344,  -89.8733, 0},
+       {LOCATION_CITY,  "KOHX", "Nashville",         36.247,  -86.5625, 0},
+       {LOCATION_STATE, NULL,   "Texas",             0,        0,       0},
+       {LOCATION_CITY,  "KAMA", "Amarillo",          35.233,  -101.709, 0},
+       {LOCATION_CITY,  "KBRO", "Brownsville",       25.916,  -97.4189, 0},
+       {LOCATION_CITY,  "KCRP", "Corpus Christi",    27.784,  -97.5111, 0},
+       {LOCATION_CITY,  "KDFX", "Laughlin AFB",      29.272,  -100.281, 0},
+       {LOCATION_CITY,  "KDYX", "Dyess AFB",         32.538,  -99.2542, 0},
+       {LOCATION_CITY,  "KEPZ", "El Paso",           31.873,  -106.698, 0},
+       {LOCATION_CITY,  "KEWX", "Austin",            29.703,  -98.0283, 0},
+       {LOCATION_CITY,  "KFWS", "Dallas",            32.573,  -97.3031, 0},
+       {LOCATION_CITY,  "KGRK", "Central Texas",     30.721,  -97.3831, 0},
+       {LOCATION_CITY,  "KHGX", "Houston",           29.471,  -95.0792, 0},
+       {LOCATION_CITY,  "KLBB", "Lubbock",           33.653,  -101.814, 0},
+       {LOCATION_CITY,  "KMAF", "Midland/Odessa",    31.943,  -102.189, 0},
+       {LOCATION_CITY,  "KSJT", "San Angelo",        31.371,  -100.493, 0},
+       {LOCATION_STATE, NULL,   "Utah",              0,        0,       0},
+       {LOCATION_CITY,  "KMTX", "Salt Lake City",    41.262,  -112.448, 0},
+       {LOCATION_STATE, NULL,   "Vermont",           0,        0,       0},
+       {LOCATION_CITY,  "KCXX", "Burlington",        44.511,  -73.1669, 0},
+       {LOCATION_STATE, NULL,   "Virginia",          0,        0,       0},
+       {LOCATION_CITY,  "KAKQ", "Richmond",          36.983,  -77.0072, 0},
+       {LOCATION_CITY,  "KFCX", "Blacksburg",        37.024,  -80.2739, 0},
+       {LOCATION_CITY,  "KLWX", "Sterling",          38.975,  -77.4778, 0},
+       {LOCATION_STATE, NULL,   "Washington",        0,        0,       0},
+       {LOCATION_CITY,  "KATX", "Seattle",           48.194,  -122.496, 0},
+       {LOCATION_CITY,  "KOTX", "Spokane",           47.680,  -117.627, 0},
+       {LOCATION_STATE, NULL,   "Washington DC",     0,        0,       0},
+       {LOCATION_CITY,  "KLWX", "Washington",        38.975,  -77.4778, 0},
+       {LOCATION_STATE, NULL,   "West Virginia",     0,        0,       0},
+       {LOCATION_CITY,  "KRLX", "Charleston",        38.311,  -81.7231, 0},
+       {LOCATION_STATE, NULL,   "Wisconsin",         0,        0,       0},
+       {LOCATION_CITY,  "KARX", "La Crosse",         43.822,  -91.1911, 0},
+       {LOCATION_CITY,  "KGRB", "Green Bay",         44.498,  -88.1114, 0},
+       {LOCATION_CITY,  "KMKX", "Milwaukee",         42.967,  -88.5506, 0},
+       {LOCATION_STATE, NULL,   "Wyoming",           0,        0,       0},
+       {LOCATION_CITY,  "KCYS", "Cheyenne",          41.151,  -104.806, 0},
+       {LOCATION_CITY,  "KRIW", "Riverton",          43.066,  -108.477, 0},
+       {LOCATION_END,   NULL,   NULL,               0,        0,       0},
 };
index 1c3966850acdc45d3369612ad4e53352045e7282..a80f0ac0973b2d52baa6e35899f458e84c23cb46 100644 (file)
@@ -19,8 +19,9 @@
 #define __LOCATION_H__
 
 enum {
+       LOCATION_END,
        LOCATION_CITY,
-       LOCATION_STATE
+       LOCATION_STATE,
 };
 
 typedef struct {
index be6ff8b762473c50829f16b64096db9dd416c298..f5e26e86033d9f3bb86dce3c8f6cce10524fd3b7 100644 (file)
@@ -97,7 +97,6 @@ int main(int argc, char *argv[])
        g_signal_connect(action, "changed", G_CALLBACK(on_log_level_changed), NULL);
 
        gtk_widget_show_all(GTK_WIDGET(gui));
-       gis_viewer_set_site(gui->viewer, site);
        gtk_main();
        return 0;
 }
index 0f10732d4d5a4a16a0f35c6fc9be71aa6d687d79..74587937fec5fff3481d0629474d1820a6aff077 100644 (file)
@@ -11,7 +11,8 @@ if HAVE_RSL
 plugins_LTLIBRARIES += radar.la
 radar_la_SOURCES = radar.c   radar.h \
        marching.c marching.h \
-       radar-colormap.c
+       radar-colormap.c \
+       ../aweather-location.c
 radar_la_LDFLAGS = $(AM_LDFLAGS) $(RSL_LIBS)
 endif
 
index 334e0fb6b8f4598ccbaede664d220770e9bd45f2..13922f8fd6309b241da1714b99801110f03565f3 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "radar.h"
 #include "marching.h"
+#include "../aweather-location.h"
 
 
 /**************************
@@ -396,23 +397,13 @@ static void _cache_done_cb(char *path, gboolean updated, gpointer _self)
        self->soup = NULL;
 }
 
-
-/*************
- * Callbacks *
- *************/
-static void _on_sweep_clicked(GtkRadioButton *button, gpointer _self)
+static void _set_radar(GisPluginRadar *self, const char *site, const char *time)
 {
-       GisPluginRadar *self = GIS_PLUGIN_RADAR(_self);
-       _load_colormap(self, g_object_get_data(G_OBJECT(button), "type" ));
-       _load_sweep   (self, g_object_get_data(G_OBJECT(button), "sweep"));
-}
+       if (!site || !time)
+               return;
+       g_debug("GisPluginRadar: set_radar - %s - %s", site, time);
 
-static void _on_time_changed(GisViewer *viewer, const char *time, gpointer _self)
-{
-       GisPluginRadar *self = GIS_PLUGIN_RADAR(_self);
-       g_debug("GisPluginRadar: on_time_changed - setting time=%s", time);
        // format: http://mesonet.agron.iastate.edu/data/nexrd2/raw/KABR/KABR_20090510_0323
-       char *site = gis_viewer_get_site(viewer);
        char *path = g_strdup_printf("nexrd2/raw/%s/%s_%s", site, site, time);
 
        /* Set up progress bar */
@@ -450,6 +441,57 @@ static void _on_time_changed(GisViewer *viewer, const char *time, gpointer _self
        g_free(path);
 }
 
+
+/*************
+ * Callbacks *
+ *************/
+static void _on_sweep_clicked(GtkRadioButton *button, gpointer _self)
+{
+       GisPluginRadar *self = GIS_PLUGIN_RADAR(_self);
+       _load_colormap(self, g_object_get_data(G_OBJECT(button), "type" ));
+       _load_sweep   (self, g_object_get_data(G_OBJECT(button), "sweep"));
+}
+
+static void _on_time_changed(GisViewer *viewer, const char *time, gpointer _self)
+{
+       g_debug("GisPluginRadar: _on_time_changed");
+       GisPluginRadar *self = GIS_PLUGIN_RADAR(_self);
+       g_free(self->cur_time);
+       self->cur_time = g_strdup(time);
+       _set_radar(self, self->cur_site, self->cur_time);
+}
+
+static void _on_location_changed(GisViewer *viewer,
+               gdouble lat, gdouble lon, gdouble elev,
+               gpointer _self)
+{
+       g_debug("GisPluginRadar: _on_location_changed");
+       GisPluginRadar *self = GIS_PLUGIN_RADAR(_self);
+       gdouble min_dist = EARTH_R / 5;
+       city_t *city, *min_city = NULL;
+       for (city = cities; city->type; city++) {
+               if (city->type != LOCATION_CITY)
+                       continue;
+               gdouble city_loc[3] = {};
+               gdouble eye_loc[3]  = {lat, lon, elev};
+               lle2xyz(city->lat, city->lon, city->elev,
+                               &city_loc[0], &city_loc[1], &city_loc[2]);
+               lle2xyz(lat, lon, elev,
+                               &eye_loc[0], &eye_loc[1], &eye_loc[2]);
+               gdouble dist = distd(city_loc, eye_loc);
+               if (dist < min_dist) {
+                       min_dist = dist;
+                       min_city = city;
+               }
+       }
+       static city_t *last_city = NULL;
+       if (min_city && min_city != last_city) {
+               self->cur_site = min_city->code;
+               _set_radar(self, self->cur_site, self->cur_time);
+       }
+       last_city = min_city;
+}
+
 static gpointer _draw_radar(GisCallback *callback, gpointer _self)
 {
        GisPluginRadar *self = GIS_PLUGIN_RADAR(_self);
@@ -590,6 +632,9 @@ GisPluginRadar *gis_plugin_radar_new(GisViewer *viewer, GisPrefs *prefs)
        self->prefs  = prefs;
        self->time_changed_id = g_signal_connect(viewer, "time-changed",
                        G_CALLBACK(_on_time_changed), self);
+       self->location_changed_id = g_signal_connect(viewer, "location-changed",
+                       G_CALLBACK(_on_location_changed), self);
+
        /* Add renderers */
        GisCallback *callback;
 
index 1aa9cb3b9dc98fa6e591becc3b579a99f0922e12..cc02de116911b5dd2e8e5aa63603b129822669af 100644 (file)
@@ -54,8 +54,11 @@ struct _GisPluginRadar {
        GtkWidget   *progress_label;
        SoupSession *soup;
        guint        time_changed_id;
+       guint        location_changed_id;
 
        /* Private data for loading radars */
+       char        *cur_site;
+       char        *cur_time;
        Radar       *cur_radar;
        Sweep       *cur_sweep;
        colormap_t  *cur_colormap;