X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fplugins%2Fradar.h;h=2ed86acb1568c9af3f4935c957364bafb000b8e5;hb=b49751ab8e6aaf8db33f2d7c45ff647b2b857f89;hp=2db7980c7fc4edd4f23bd8ee00e67ac3c3c5f016;hpb=f705ad00b5d94f8ddc59575737b79feed191b404;p=aweather diff --git a/src/plugins/radar.h b/src/plugins/radar.h index 2db7980..2ed86ac 100644 --- a/src/plugins/radar.h +++ b/src/plugins/radar.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Andy Spencer + * Copyright (C) 2009-2010 Andy Spencer * * 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 @@ -19,54 +19,78 @@ #define __RADAR_H__ #include -#include #include -#include "marching.h" +#include +#include "level2.h" -/* TODO: convert */ -typedef struct { - char *name; - guint8 data[256][4]; -} colormap_t; -extern colormap_t colormaps[]; +#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)) +#define GIS_IS_PLUGIN_RADAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GIS_TYPE_PLUGIN_RADAR)) +#define GIS_PLUGIN_RADAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIS_TYPE_PLUGIN_RADAR, GisPluginRadarClass)) +#define GIS_IS_PLUGIN_RADAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIS_TYPE_PLUGIN_RADAR)) +#define GIS_PLUGIN_RADAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIS_TYPE_PLUGIN_RADAR, GisPluginRadarClass)) -#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 _GisPluginRadar GisPluginRadar; +typedef struct _GisPluginRadarClass GisPluginRadarClass; -typedef struct _AWeatherRadar AWeatherRadar; -typedef struct _AWeatherRadarClass AWeatherRadarClass; +typedef struct _RadarConus RadarConus; +typedef struct _RadarSite RadarSite; -struct _AWeatherRadar { +struct _GisPluginRadar { 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; + GisViewer *viewer; + GisPrefs *prefs; + GtkWidget *config; + AWeatherColormap *colormap; + gpointer *hud_ref; + + GHashTable *sites; + GisHttp *sites_http; + + RadarConus *conus; + GisHttp *conus_http; }; -struct _AWeatherRadarClass { +struct _GisPluginRadarClass { GObjectClass parent_class; }; -GType aweather_radar_get_type(); +GType gis_plugin_radar_get_type(); /* Methods */ -AWeatherRadar *aweather_radar_new(AWeatherGui *gui); +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