/*
- * 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 "marching.h"
+#include <grits.h>
+#include "radar-info.h"
+#include "level2.h"
-/* TODO: convert */
-typedef struct {
- char *name;
- guint8 data[256][4];
-} colormap_t;
-extern colormap_t colormaps[];
+#define GRITS_TYPE_PLUGIN_RADAR (grits_plugin_radar_get_type ())
+#define GRITS_PLUGIN_RADAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GRITS_TYPE_PLUGIN_RADAR, GritsPluginRadar))
+#define GRITS_IS_PLUGIN_RADAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GRITS_TYPE_PLUGIN_RADAR))
+#define GRITS_PLUGIN_RADAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRITS_TYPE_PLUGIN_RADAR, GritsPluginRadarClass))
+#define GRITS_IS_PLUGIN_RADAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRITS_TYPE_PLUGIN_RADAR))
+#define GRITS_PLUGIN_RADAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRITS_TYPE_PLUGIN_RADAR, GritsPluginRadarClass))
-#define AWEATHER_TYPE_RADAR (aweather_radar_get_type ())
-#define AWEATHER_RADAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AWEATHER_TYPE_RADAR, AWeatherRadar))
-#define AWEATHER_IS_RADAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AWEATHER_TYPE_RADAR))
-#define AWEATHER_RADAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AWEATHER_TYPE_RADAR, AWeatherRadarClass))
-#define AWEATHER_IS_RADAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AWEATHER_TYPE_RADAR))
-#define AWEATHER_RADAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AWEATHER_TYPE_RADAR, AWeatherRadarClass))
+typedef struct _GritsPluginRadar GritsPluginRadar;
+typedef struct _GritsPluginRadarClass GritsPluginRadarClass;
-typedef struct _AWeatherRadar AWeatherRadar;
-typedef struct _AWeatherRadarClass AWeatherRadarClass;
+typedef struct _RadarConus RadarConus;
+typedef struct _RadarSite RadarSite;
-struct _AWeatherRadar {
+struct _GritsPluginRadar {
GObject parent_instance;
/* instance members */
- AWeatherGui *gui;
- 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;
+ GritsViewer *viewer;
+ GritsPrefs *prefs;
+ GtkWidget *config;
+ guint tab_id;
+ AWeatherColormap *colormap;
+ GritsCallback *hud;
+
+ GHashTable *sites;
+ GritsHttp *sites_http;
+
+ RadarConus *conus;
+ GritsHttp *conus_http;
};
-struct _AWeatherRadarClass {
+struct _GritsPluginRadarClass {
GObjectClass parent_class;
};
-GType aweather_radar_get_type();
+GType grits_plugin_radar_get_type();
/* Methods */
-AWeatherRadar *aweather_radar_new(AWeatherGui *gui);
+GritsPluginRadar *grits_plugin_radar_new(GritsViewer *viewer, GritsPrefs *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