adding own colormap
authorAndy Spencer <andy753421@gmail.com>
Wed, 13 May 2009 05:39:21 +0000 (05:39 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 13 May 2009 05:39:21 +0000 (05:39 +0000)
src/Makefile.am
src/plugin-radar-colormap.c [new file with mode: 0644]
src/plugin-radar.c
src/plugin-radar.h

index 6736622..a47ed55 100644 (file)
@@ -9,6 +9,7 @@ aweather_SOURCES  = main.c \
        data.c           data.h           \
        location.c       location.h       \
        plugin-radar.c   plugin-radar.h   \
+       plugin-radar-colormap.c           \
        plugin-ridge.c   plugin-ridge.h   \
        plugin-example.c plugin-example.h
 aweather_LDADD    = $(RSL_LIBS) $(GTK_LIBS) $(CURL_LIBS)
diff --git a/src/plugin-radar-colormap.c b/src/plugin-radar-colormap.c
new file mode 100644 (file)
index 0000000..4d8b743
--- /dev/null
@@ -0,0 +1,784 @@
+#include <glib.h>
+#include "aweather-gui.h"
+#include "plugin-radar.h"
+
+         //{0xcc,0xff,0xff,0xff},{0xcc,0xff,0xff,0xff}, {0xcc,0xff,0xff,0xff},
+         //{0xcc,0x99,0xcc,0xff},{0xcc,0x99,0xcc,0xff}, {0xcc,0x99,0xcc,0xff},
+         //{0x99,0x66,0x99,0xff},{0x99,0x66,0x99,0xff}, {0x99,0x66,0x99,0xff},
+         //{0x66,0x33,0x66,0xff},{0x66,0x33,0x66,0xff}, {0x66,0x33,0x66,0xff},
+         //{0xcc,0xcc,0x99,0xff},{0xcc,0xcc,0x99,0xff}, {0xcc,0xcc,0x99,0xff},
+         //{0x99,0x99,0x66,0xff},{0x99,0x99,0x66,0xff}, {0x99,0x99,0x66,0xff},
+colormap_t colormaps[] = {
+       {"Reflectivity",
+        {{0x00,0x00,0x00,0x00}, // BADVAL
+         {0x00,0x00,0x00,0x00}, // RFVAL
+         {0x00,0x00,0x00,0x00}, // APFLAG
+         {0x00,0x00,0x00,0x00}, // NOECHO
+          {0x04,0xe9,0xe7,0x00},  //  0 dBZ
+          {0x04,0xe9,0xe7,0x00},  //  1 dBZ
+          {0x04,0xe9,0xe7,0x10},  //  2 dBZ
+          {0x04,0xe9,0xe7,0x20},  //  3 dBZ
+          {0x04,0xe9,0xe7,0x30},  //  4 dBZ
+          {0x01,0x9f,0xf4,0x40},  //  5 dBZ
+          {0x01,0x9f,0xf4,0x50},  //  6 dBZ
+          {0x01,0x9f,0xf4,0x60},  //  7 dBZ
+          {0x01,0x9f,0xf4,0x70},  //  8 dBZ
+          {0x01,0x9f,0xf4,0x80},  //  9 dBZ
+          {0x03,0x00,0xf4,0x90},  // 10 dBZ
+          {0x03,0x00,0xf4,0xa0},  // 11 dBZ
+          {0x03,0x00,0xf4,0xb0},  // 12 dBZ
+          {0x03,0x00,0xf4,0xc0},  // 13 dBZ
+          {0x03,0x00,0xf4,0xd0},  // 14 dBZ
+          {0x02,0xfd,0x02,0xe0},  // 15 dBZ
+          {0x02,0xfd,0x02,0xf0},  // 16 dBZ
+          {0x02,0xfd,0x02,0xff},  // 17 dBZ
+          {0x02,0xfd,0x02,0xff},  // 18 dBZ
+          {0x02,0xfd,0x02,0xff},  // 19 dBZ
+          {0x01,0xc5,0x01,0xff},  // 20 dBZ
+          {0x01,0xc5,0x01,0xff},  // 21 dBZ
+          {0x01,0xc5,0x01,0xff},  // 22 dBZ
+          {0x01,0xc5,0x01,0xff},  // 23 dBZ
+          {0x01,0xc5,0x01,0xff},  // 24 dBZ
+          {0x00,0x8e,0x00,0xff},  // 25 dBZ
+          {0x00,0x8e,0x00,0xff},  // 26 dBZ
+          {0x00,0x8e,0x00,0xff},  // 27 dBZ
+          {0x00,0x8e,0x00,0xff},  // 28 dBZ
+          {0x00,0x8e,0x00,0xff},  // 29 dBZ
+          {0xfd,0xf8,0x02,0xff},  // 30 dBZ
+          {0xfd,0xf8,0x02,0xff},  // 31 dBZ
+          {0xfd,0xf8,0x02,0xff},  // 32 dBZ
+          {0xfd,0xf8,0x02,0xff},  // 33 dBZ
+          {0xfd,0xf8,0x02,0xff},  // 34 dBZ
+          {0xe5,0xbc,0x00,0xff},  // 35 dBZ
+          {0xe5,0xbc,0x00,0xff},  // 36 dBZ
+          {0xe5,0xbc,0x00,0xff},  // 37 dBZ
+          {0xe5,0xbc,0x00,0xff},  // 38 dBZ
+          {0xe5,0xbc,0x00,0xff},  // 39 dBZ
+          {0xfd,0x95,0x00,0xff},  // 40 dBZ
+          {0xfd,0x95,0x00,0xff},  // 41 dBZ
+          {0xfd,0x95,0x00,0xff},  // 42 dBZ
+          {0xfd,0x95,0x00,0xff},  // 43 dBZ
+          {0xfd,0x95,0x00,0xff},  // 44 dBZ
+          {0xfd,0x00,0x00,0xff},  // 45 dBZ
+          {0xfd,0x00,0x00,0xff},  // 46 dBZ
+          {0xfd,0x00,0x00,0xff},  // 47 dBZ
+          {0xfd,0x00,0x00,0xff},  // 48 dBZ
+          {0xfd,0x00,0x00,0xff},  // 49 dBZ
+          {0xd4,0x00,0x00,0xff},  // 50 dBZ
+          {0xd4,0x00,0x00,0xff},  // 51 dBZ
+          {0xd4,0x00,0x00,0xff},  // 52 dBZ
+          {0xd4,0x00,0x00,0xff},  // 53 dBZ
+          {0xd4,0x00,0x00,0xff},  // 54 dBZ
+          {0xbc,0x00,0x00,0xff},  // 55 dBZ
+          {0xbc,0x00,0x00,0xff},  // 56 dBZ
+          {0xbc,0x00,0x00,0xff},  // 57 dBZ
+          {0xbc,0x00,0x00,0xff},  // 58 dBZ
+          {0xbc,0x00,0x00,0xff},  // 59 dBZ
+          {0xf8,0x00,0xfd,0xff},  // 60 dBZ
+          {0xf8,0x00,0xfd,0xff},  // 61 dBZ
+          {0xf8,0x00,0xfd,0xff},  // 62 dBZ
+          {0xf8,0x00,0xfd,0xff},  // 63 dBZ
+          {0xf8,0x00,0xfd,0xff},  // 64 dBZ
+          {0x98,0x54,0xc6,0xff},  // 65 dBZ
+          {0x98,0x54,0xc6,0xff},  // 66 dBZ
+          {0x98,0x54,0xc6,0xff},  // 67 dBZ
+          {0x98,0x54,0xc6,0xff},  // 68 dBZ
+          {0x98,0x54,0xc6,0xff},  // 69 dBZ
+          {0xfd,0xfd,0xfd,0xff},  // 70 dBZ
+          {0xfd,0xfd,0xfd,0xff},  // 71 dBZ
+          {0xfd,0xfd,0xfd,0xff},  // 72 dBZ
+          {0xfd,0xfd,0xfd,0xff},  // 73 dBZ
+          {0xfd,0xfd,0xfd,0xff},  // 74 dBZ
+         {0x00,0x00,0x00,0xff},  // 75 dBZ
+         {0x00,0x00,0x00,0xff},  // 76 dBZ
+         {0x00,0x00,0x00,0xff},  // 77 dBZ
+         {0x00,0x00,0x00,0xff},  // 78 dBZ
+         {0x00,0x00,0x00,0xff},  // 79 dBZ
+         {0x00,0x00,0x00,0xff},  // 80 dBZ
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff}}},
+       {"Velocity",
+        {{0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff}}},
+       {"Spectrum width",
+        {{0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff},
+         {0x00,0x00,0x00,0xff}}},
+       {NULL, {{}}},
+};
index 2693833..e021253 100644 (file)
@@ -30,8 +30,9 @@
 GtkWidget *drawing;
 GtkWidget *config_body;
 static Sweep *cur_sweep = NULL;  // make this not global
-static int nred, ngreen, nblue;
-static char red[256], green[256], blue[256];
+//static int nred, ngreen, nblue;
+//static char red[256], green[256], blue[256];
+static colormap_t *colormap;
 static guint sweep_tex = 0;
 
 static AWeatherGui *gui = NULL;
@@ -40,20 +41,6 @@ static Radar *radar = NULL;
 /**************************
  * Data loading functions *
  **************************/
-/* return a GL alpha value for a radar pixle */
-static guint8 get_alpha(guint8 db)
-{
-       if (db == BADVAL) return 0;
-       if (db == RFVAL ) return 0;
-       if (db == APFLAG) return 0;
-       if (db == NOECHO) return 0;
-       if (db == 0     ) return 0;
-       //if      (db > 60) return 0;
-       //else if (db < 10) return 0;
-       //else if (db < 25) return (db-10)*(255.0/15);
-       else              return 255;
-}
-
 /* Convert a sweep to an 2d array of data points */
 static void bscan_sweep(Sweep *sweep, guint8 **data, int *width, int *height)
 {
@@ -74,10 +61,10 @@ static void bscan_sweep(Sweep *sweep, guint8 **data, int *width, int *height)
                        //guint val   = dz_f(ray->range[bi]);
                        guint val   = ray->h.f(ray->range[bi]);
                        guint buf_i = (ri*max_bins+bi)*4;
-                       buf[buf_i+0] =   red[val];
-                       buf[buf_i+1] = green[val];
-                       buf[buf_i+2] =  blue[val];
-                       buf[buf_i+3] = get_alpha(val);
+                       buf[buf_i+0] = colormap->data[val][0];
+                       buf[buf_i+1] = colormap->data[val][1];
+                       buf[buf_i+2] = colormap->data[val][2];
+                       buf[buf_i+3] = colormap->data[val][3];
                }
        }
 
@@ -89,17 +76,9 @@ static void bscan_sweep(Sweep *sweep, guint8 **data, int *width, int *height)
 
 static void load_color_table(char *table)
 {
-       /* TODO: replace this with a better color table */
-       g_message("loading color table");
-       if (g_str_equal(table, "Velocity"))
-               RSL_load_vel_color_table();
-       else if (g_str_equal(table, "Spectrum width"))
-               RSL_load_sw_color_table();
-       else
-               RSL_load_refl_color_table();
-       RSL_get_color_table(RSL_RED_TABLE,   red,   &nred);
-       RSL_get_color_table(RSL_GREEN_TABLE, green, &ngreen);
-       RSL_get_color_table(RSL_BLUE_TABLE,  blue,  &nblue);
+       for (int i = 0; colormaps[i].name; i++)
+               if (g_str_equal(colormaps[i].name, table))
+                       colormap = &colormaps[i];
 }
 
 /* Load a sweep as the active texture */
@@ -281,12 +260,15 @@ static gboolean expose(GtkWidget *da, GdkEventExpose *event, gpointer user_data)
        glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity();
        glBegin(GL_QUADS);
        int i;
-       for (i = 0; i < nred; i++) {
-               glColor4ub(red[i], green[i], blue[i], get_alpha(i));
-               glVertex3f(-1.0, (float)((i  ) - nred/2)/(nred/2), 0.0); // bot left
-               glVertex3f(-1.0, (float)((i+1) - nred/2)/(nred/2), 0.0); // top left
-               glVertex3f(-0.9, (float)((i+1) - nred/2)/(nred/2), 0.0); // top right
-               glVertex3f(-0.9, (float)((i  ) - nred/2)/(nred/2), 0.0); // bot right
+       for (i = 0; i < 256; i++) {
+               glColor4ub(colormap->data[i][0],
+                          colormap->data[i][1],
+                          colormap->data[i][2],
+                          colormap->data[i][3]);
+               glVertex3f(-1.0, (float)((i  ) - 256/2)/(256/2), 0.0); // bot left
+               glVertex3f(-1.0, (float)((i+1) - 256/2)/(256/2), 0.0); // top left
+               glVertex3f(-0.9, (float)((i+1) - 256/2)/(256/2), 0.0); // top right
+               glVertex3f(-0.9, (float)((i  ) - 256/2)/(256/2), 0.0); // bot right
        }
        glEnd();
        glEnable(GL_DEPTH_TEST);
index baf0dcd..7b787d8 100644 (file)
 
 gboolean radar_init(AWeatherGui *gui);
 
+typedef struct {
+       char *name;
+       guint8 data[256][4];
+} colormap_t;
+
+extern colormap_t colormaps[];
+
 #endif