]> Pileus Git - aweather/blobdiff - src/plugins/radar.h
Move RSL file handling to level2 object
[aweather] / src / plugins / radar.h
index 95367b47c3c12f804155b2b47ac9a21f1e983868..b61854aa89e61674f88eafa338d72f3c8b674308 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #define __RADAR_H__
 
 #include <glib-object.h>
-#include <libsoup/soup.h>
 #include <rsl.h>
 
-#include <gis/gis.h>
-
-#include "marching.h"
-
-/* TODO: convert */
-typedef struct {
-       char *name;
-       guint8 data[256][4];
-} colormap_t;
-extern colormap_t colormaps[];
+#include <gis.h>
+#include "level2.h"
 
 #define GIS_TYPE_PLUGIN_RADAR            (gis_plugin_radar_get_type ())
 #define GIS_PLUGIN_RADAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),   GIS_TYPE_PLUGIN_RADAR, GisPluginRadar))
@@ -47,22 +38,24 @@ struct _GisPluginRadar {
        GObject parent_instance;
 
        /* instance members */
-       GisWorld    *world;
-       GisView     *view;
-       GisOpenGL   *opengl;
-       GisPrefs    *prefs;
-       GtkWidget   *config_body;
-       GtkWidget   *progress_bar;
-       GtkWidget   *progress_label;
-       SoupSession *soup;
-
-       /* Private data for loading radars */
-       Radar       *cur_radar;
-       Sweep       *cur_sweep;
-       colormap_t  *cur_colormap;
-       guint        cur_sweep_tex;
-       TRIANGLE    *cur_triangles;
-       guint        cur_num_triangles;
+       GisViewer *viewer;
+       GisPrefs  *prefs;
+       GisHttp   *http;
+
+       /* Signals */
+       guint      time_changed_id;
+       guint      location_changed_id;
+
+       /* Tab area */
+       GtkWidget *config_body;
+       GtkWidget *progress_bar;
+       GtkWidget *progress_label;
+
+       /* Radar lists */
+       AWeatherColormap *colormap;
+       gpointer   radar;
+       gchar     *cur_site;
+       gchar     *cur_time;
 };
 
 struct _GisPluginRadarClass {
@@ -72,6 +65,36 @@ struct _GisPluginRadarClass {
 GType gis_plugin_radar_get_type();
 
 /* Methods */
-GisPluginRadar *gis_plugin_radar_new(GisWorld *world, GisView *view, GisOpenGL *opengl, GisPrefs *prefs);
+GisPluginRadar *gis_plugin_radar_new(GisViewer *viewer, GisPrefs *prefs);
+
+/* Misc. RSL helpers */
+#define RSL_FOREACH_VOL(radar, volume, count, index) \
+       guint count = 0; \
+       for (guint index = 0; index < radar->h.nvolumes; index++) { \
+               Volume *volume = radar->v[index]; \
+               if (volume == NULL) continue; \
+               count++;
+
+#define RSL_FOREACH_SWEEP(volume, sweep, count, index) \
+       guint count = 0; \
+       for (guint index = 0; index < volume->h.nsweeps; index++) { \
+               Sweep *sweep = volume->sweep[index]; \
+               if (sweep == NULL || sweep->h.elev == 0) continue; \
+               count++;
+
+#define RSL_FOREACH_RAY(sweep, ray, count, index) \
+       guint count = 0; \
+       for (guint index = 0; index < sweep->h.nrays; index++) { \
+               Ray *ray = sweep->ray[index]; \
+               if (ray == NULL) continue; \
+               count++;
+
+#define RSL_FOREACH_BIN(ray, bin, count, index) \
+       guint count = 0; \
+       for (guint index = 0; index < ray->h.nbins; index++) { \
+               Range bin = ray->range[index]; \
+               count++;
+
+#define RSL_FOREACH_END }
 
 #endif