From 8fb42606a5e41d4c4cb73378f1780920292ff29e Mon Sep 17 00:00:00 2001 From: Wojciech Graj Date: Fri, 19 Aug 2022 17:56:25 +0200 Subject: [PATCH] Implement filtering. --- .gitignore | 1 + res/ui/ui.glade | 563 ++++++++++++++++++++++++++++++++++-- src/ui/catalog.c | 37 ++- src/ui/catalog.h | 2 + src/ui/filter.c | 235 +++++++++++++++ src/ui/filter.h | 10 + src/ui/ui.c | 2 + src/util/satcat_code_list.c | 173 +++++++++++ src/util/satcat_code_list.h | 14 + 9 files changed, 1002 insertions(+), 35 deletions(-) create mode 100644 src/ui/filter.c create mode 100644 src/ui/filter.h create mode 100644 src/util/satcat_code_list.c create mode 100644 src/util/satcat_code_list.h diff --git a/.gitignore b/.gitignore index e585078..a0e8717 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .sat_cache obj/ orbvis +*.glade~ diff --git a/res/ui/ui.glade b/res/ui/ui.glade index 9c009f4..62d79c3 100644 --- a/res/ui/ui.glade +++ b/res/ui/ui.glade @@ -2,25 +2,10 @@ - - - - - - - - - - - - - - - - - - - + + True + False + gtk-clear False @@ -691,9 +676,549 @@ False + + + True + False + vertical + + + + True + False + + + True + False + Status + + + 0 + 0 + + + + + True + False + Launch Site + + + 0 + 1 + + + + + True + False + + + True + True + + + + False + True + 0 + + + + + True + False + - + + + False + True + 1 + + + + + True + True + + + + False + True + 2 + + + + + 3 + 2 + + + + + True + False + Launch Date + + + 2 + 2 + + + + + True + False + Owner + + + 0 + 2 + + + + + True + False + Period (min) + + + 2 + 0 + + + + + True + False + + + True + True + number + + + False + True + 0 + + + + + True + False + - + + + False + True + 1 + + + + + True + True + number + + + False + True + 2 + + + + + 3 + 0 + + + + + True + False + Incl (deg) + + + 2 + 1 + + + + + True + False + + + True + True + number + + + False + True + 0 + + + + + True + False + - + + + False + True + 1 + + + + + True + True + number + + + False + True + 2 + + + + + 3 + 1 + + + + + True + False + Apogee (km) + + + 2 + 3 + + + + + True + False + Perigee (km) + + + 0 + 3 + + + + + True + False + + + True + True + number + + + False + True + 0 + + + + + True + False + - + + + False + True + 1 + + + + + True + True + number + + + False + True + 2 + + + + + 3 + 3 + + + + + True + False + + + True + True + number + + + False + True + 0 + + + + + True + False + - + + + False + True + 1 + + + + + True + True + number + + + False + True + 2 + + + + + 1 + 3 + + + + + True + False + + + True + False + + + True + True + 0 + + + + + True + True + True + image_clear + + + + False + True + 1 + + + + + 1 + 0 + + + + + True + False + + + True + False + + + True + True + 0 + + + + + True + True + True + image_clear1 + + + + False + True + 1 + + + + + 1 + 1 + + + + + True + False + + + True + False + + + True + True + 0 + + + + + True + True + True + image_clear2 + + + + False + True + 1 + + + + + 1 + 2 + + + + + True + True + 0 + + + + + True + False + + + True + False + True + vertical + + + False + True + 0 + + + + + gtk-clear + True + True + True + True + + + + False + True + 1 + + + + + gtk-apply + True + True + True + True + + + + False + True + 2 + + + + + False + True + 1 + + + + + 2 + + + + + True + False + Filter + + + 2 + False + + + + True + False + gtk-clear + + + True + False + gtk-clear + + + + + + + + + + + + + + + + + + + + + False Orbit Visualizer diff --git a/src/ui/catalog.c b/src/ui/catalog.c index f7fdd50..b7bf29a 100644 --- a/src/ui/catalog.c +++ b/src/ui/catalog.c @@ -1,5 +1,6 @@ #include "catalog.h" +#include "filter.h" #include "info.h" #include "satcat_code.h" @@ -21,6 +22,7 @@ enum Column { enum Page { PAGE_CATALOG = 0u, PAGE_INFO, + PAGE_FILTER, }; static const char *column_ids[] = { @@ -37,13 +39,14 @@ static const char *column_ids[] = { [COL_PERIGEE] = "col_perigee", }; +GtkTreeModelFilter *e_catalog_filter = NULL; + static GtkTreeViewColumn *columns[NUM_COLS]; static GtkWindow *window_catalog; static GtkTreeSortable *sort = NULL; static gchar search_text[64] = { 0 }; static enum Column sort_col = COL_CATNUM; static GtkSortType sort_type = GTK_SORT_ASCENDING; -static GtkTreeModelFilter *filter = NULL; static GtkTreeView *satellite_view; static GtkListStore *satellite_store; static GtkTreeSelection *selection; @@ -93,9 +96,9 @@ void on_column_select_cell_toggled(GtkCellRendererToggle *cell_renderer, char *p (void)cell_renderer; (void)user_data; GtkTreeIter iter; - gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(filter), &iter, path); + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(e_catalog_filter), &iter, path); struct Satellite *satellite; - gtk_tree_model_get(GTK_TREE_MODEL(filter), &iter, + gtk_tree_model_get(GTK_TREE_MODEL(e_catalog_filter), &iter, 0, &satellite, -1); satellite_select_ptr(satellite); @@ -109,7 +112,7 @@ void on_catalog_search_search_changed(GtkSearchEntry *entry, gpointer user_data) for (i = 0; i < 63 && text[i]; i++) search_text[i] = g_ascii_toupper(text[i]); search_text[i] = '\0'; - gtk_tree_model_filter_refilter(filter); + gtk_tree_model_filter_refilter(e_catalog_filter); } void on_col_clicked(GtkTreeViewColumn *treeviewcolumn, gpointer user_data) @@ -159,20 +162,20 @@ void catalog_construct_views(void) sort = GTK_TREE_SORTABLE(gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(satellite_store))); gtk_tree_sortable_set_sort_func(sort, 1, catalog_view_search_compare_func, NULL, NULL); - filter = GTK_TREE_MODEL_FILTER(gtk_tree_model_filter_new(GTK_TREE_MODEL(sort), NULL)); - gtk_tree_model_filter_set_visible_func(filter, catalog_view_filter_visible_func, NULL, NULL); + e_catalog_filter = GTK_TREE_MODEL_FILTER(gtk_tree_model_filter_new(GTK_TREE_MODEL(sort), NULL)); + gtk_tree_model_filter_set_visible_func(e_catalog_filter, catalog_view_filter_visible_func, NULL, NULL); g_object_unref(sort); - gtk_tree_view_set_model(satellite_view, GTK_TREE_MODEL(filter)); - g_object_unref(filter); + gtk_tree_view_set_model(satellite_view, GTK_TREE_MODEL(e_catalog_filter)); + g_object_unref(e_catalog_filter); } void catalog_deconstruct_views(void) { gtk_tree_view_set_model(satellite_view, NULL); - if (filter) - g_object_unref(filter); + if (e_catalog_filter) + g_object_unref(e_catalog_filter); if (sort) g_object_unref(sort); } @@ -180,16 +183,18 @@ void catalog_deconstruct_views(void) void catalog_satellite_changed(struct Satellite *satellite) { GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(filter); - gtk_tree_model_get_iter_first(model, &iter); + GtkTreeModel *model = GTK_TREE_MODEL(e_catalog_filter); + if (!gtk_tree_model_get_iter_first(model, &iter)) + return; struct Satellite *iter_satellite; gtk_tree_model_get(model, &iter, 0, &iter_satellite, -1); while (iter_satellite != satellite) { - gtk_tree_model_iter_next(model, &iter); + if (!gtk_tree_model_iter_next(model, &iter)) + return; gtk_tree_model_get(model, &iter, 0, &iter_satellite, -1); } - GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(filter), &iter); - gtk_tree_model_row_changed(GTK_TREE_MODEL(filter), path, &iter); + GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(e_catalog_filter), &iter); + gtk_tree_model_row_changed(GTK_TREE_MODEL(e_catalog_filter), path, &iter); gtk_tree_path_free(path); } @@ -200,7 +205,7 @@ gboolean catalog_view_filter_visible_func(GtkTreeModel *model, GtkTreeIter *iter gtk_tree_model_get(model, iter, 0, &satellite, -1); - return g_strstr_len(satellite->satcat.name, 24, search_text) != NULL; + return (g_strstr_len(satellite->satcat.name, 24, search_text) != NULL) && (filter_func(satellite)); } gint catalog_view_search_compare_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data) diff --git a/src/ui/catalog.h b/src/ui/catalog.h index 345e5f4..0c3fc6e 100644 --- a/src/ui/catalog.h +++ b/src/ui/catalog.h @@ -9,4 +9,6 @@ void catalog_deinit(void); void catalog_satellite_changed(struct Satellite *satellite); void catalog_satellites_fill(struct Satellite *satellites, size_t n_satellites); +extern GtkTreeModelFilter *e_catalog_filter; + #endif /* __CATALOG_H__ */ diff --git a/src/ui/filter.c b/src/ui/filter.c new file mode 100644 index 0000000..e6d8f2f --- /dev/null +++ b/src/ui/filter.c @@ -0,0 +1,235 @@ +#include "filter.h" + +#include "catalog.h" +#include "satcat_code_list.h" + +#include + +#define FILTER_FUNC_BETWEEN(field, target, var) ((field_active[field]) && (((target)[0] >= (var)) || ((target)[1] <= (var)))) +#define SC_DATE_LESS(d1, d2) (((d1).year < (d2).year) ? (TRUE) : (((d1).year == (d2).year) ? (((d1).month < (d2).month) ? (TRUE) : (((d1).month == (d2).month) ? ((d1).day < (d2).day) : (FALSE))) : (FALSE))) + +enum FilterCombo { + COMBO_STATUS = 0u, + COMBO_LAUNCH_SITE, + COMBO_SOURCE, + NUM_FILTER_COMBO, +}; + +enum FilterEntry { + ENTRY_PERIGEE = 0u, + ENTRY_APOGEE, + ENTRY_INCLINATION, + ENTRY_PERIOD, + ENTRY_LAUNCH_DATE, + NUM_FILTER_ENTRY, +}; + +enum FilterField { + FIELD_STATUS = 0u, + FIELD_LAUNCH_SITE, + FIELD_SOURCE, + FIELD_PERIGEE, + FIELD_APOGEE, + FIELD_INCLINATION, + FIELD_PERIOD, + FIELD_LAUNCH_DATE, + NUM_FILTER_FIELD, +}; + +static const char *combo_item_ids[NUM_FILTER_COMBO] = { + [COMBO_STATUS] = "filter_status", + [COMBO_LAUNCH_SITE] = "filter_launch_site", + [COMBO_SOURCE] = "filter_source", +}; + +static const char *entry_item_ids[NUM_FILTER_ENTRY][2] = { + [ENTRY_PERIGEE] = { "filter_low_perigee", "filter_high_perigee" }, + [ENTRY_APOGEE] = { "filter_low_apogee", "filter_high_apogee" }, + [ENTRY_INCLINATION] = { "filter_low_inclination", "filter_high_inclination" }, + [ENTRY_PERIOD] = { "filter_low_period", "filter_high_period" }, + [ENTRY_LAUNCH_DATE] = { "filter_low_launch_date", "filter_high_launch_date" }, +}; + +static GtkComboBoxText *combo_items[NUM_FILTER_COMBO]; +static GtkEntry *entry_items[NUM_FILTER_ENTRY][2]; +static gboolean field_active[NUM_FILTER_FIELD] = { FALSE }; + +static gboolean active = FALSE; + +static char target_status; +static sc_code_t target_source; +static sc_code_t target_launch_site; +static double target_perigee[2]; +static double target_apogee[2]; +static double target_inclination[2]; +static double target_period[2]; +static struct SCDate target_launch_date[2]; + +static void on_filter_clear_clicked(GtkButton *button, gpointer user_data); +static void on_filter_apply_clicked(GtkButton *button, gpointer user_data); +static void on_filter_clear_status_clicked(GtkButton *button, gpointer user_data); +static void on_filter_clear_source_clicked(GtkButton *button, gpointer user_data); +static void on_filter_clear_launch_site_clicked(GtkButton *button, gpointer user_data); +static void on_filter_launch_date_activate(GtkEntry *entry, gpointer user_data); + +static void filter_set_from_entry(enum FilterEntry entry, enum FilterField field, double *target, double dflt[2]); + +void on_filter_clear_status_clicked(GtkButton *button, gpointer user_data) +{ + (void)button; + (void)user_data; + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_items[COMBO_STATUS]), -1); +} + +void on_filter_clear_source_clicked(GtkButton *button, gpointer user_data) +{ + (void)button; + (void)user_data; + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_items[COMBO_SOURCE]), -1); +} + +void on_filter_clear_launch_site_clicked(GtkButton *button, gpointer user_data) +{ + (void)button; + (void)user_data; + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_items[COMBO_LAUNCH_SITE]), -1); +} + +void on_filter_launch_date_activate(GtkEntry *entry, gpointer user_data) +{ + (void)user_data; + + const gchar *text = gtk_entry_get_text(entry); + unsigned y, m = 1, d = 1; + int nitems = sscanf(text, "%4u-%2u-%2u", &y, &m, &d); + if (!nitems) + goto FAIL; + { + GTimeZone *tz = g_time_zone_new_utc(); + GDateTime *dt = g_date_time_new(tz, y, m, d, 0, 0, 0); + if (dt) { + g_date_time_unref(dt); + g_time_zone_unref(tz); + return; + } + g_time_zone_unref(tz); + } +FAIL: + gtk_entry_set_text(entry, ""); +} + +void on_filter_clear_clicked(GtkButton *button, gpointer user_data) +{ + (void)button; + (void)user_data; + + unsigned i, j; + for (i = 0; i < NUM_FILTER_COMBO; i++) + gtk_combo_box_set_active(GTK_COMBO_BOX(combo_items[i]), -1); + for (i = 0; i < NUM_FILTER_ENTRY; i++) + for (j = 0; j < 2; j++) + gtk_entry_set_text(entry_items[i][j], ""); + for (i = 0; i < NUM_FILTER_FIELD; i++) + field_active[i] = FALSE; + + active = FALSE; + gtk_tree_model_filter_refilter(e_catalog_filter); +} + +void filter_set_from_entry(enum FilterEntry entry, enum FilterField field, double *target, double dflt[2]) +{ + field_active[field] = FALSE; + unsigned j; + for (j = 0; j < 2; j++) { + const gchar *text = gtk_entry_get_text(entry_items[entry][j]); + gchar *endptr; + target[j] = g_ascii_strtod(text, &endptr); + if (endptr == text) + target[j] = dflt[j]; + else + field_active[field] = TRUE; + } +} + +void on_filter_apply_clicked(GtkButton *button, gpointer user_data) +{ + (void)button; + (void)user_data; + + int idx; + + idx = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_items[COMBO_STATUS])); + field_active[FIELD_STATUS] = (idx != -1); + if (field_active[FIELD_STATUS]) + target_status = SCSTAT[idx]; + + idx = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_items[COMBO_SOURCE])); + field_active[FIELD_SOURCE] = (idx != -1); + if (field_active[FIELD_SOURCE]) + target_source = SCSRC[idx]; + + idx = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_items[COMBO_LAUNCH_SITE])); + field_active[FIELD_LAUNCH_SITE] = (idx != -1); + if (field_active[FIELD_LAUNCH_SITE]) + target_launch_site = SCSITE[idx]; + + filter_set_from_entry(ENTRY_PERIGEE, FIELD_PERIGEE, target_perigee, (double[2]){ 0, DBL_MAX }); + filter_set_from_entry(ENTRY_APOGEE, FIELD_APOGEE, target_apogee, (double[2]){ 0, DBL_MAX }); + filter_set_from_entry(ENTRY_INCLINATION, FIELD_INCLINATION, target_inclination, (double[2]){ 0, 360.0 }); + filter_set_from_entry(ENTRY_PERIOD, FIELD_PERIOD, target_period, (double[2]){ 0, DBL_MAX }); + + field_active[FIELD_LAUNCH_DATE] = FALSE; + unsigned i; + for (i = 0; i < 2; i++) { + target_launch_date[i].year = (unsigned[2]){ 0, 9999 }[i]; + target_launch_date[i].month = 1; + target_launch_date[i].day = 1; + int nitems = sscanf(gtk_entry_get_text(entry_items[ENTRY_LAUNCH_DATE][i]), "%4u-%2u-%2u", &target_launch_date[i].year, &target_launch_date[i].month, &target_launch_date[i].day); + if (nitems) + field_active[FIELD_LAUNCH_DATE] = TRUE; + } + + active = TRUE; + gtk_tree_model_filter_refilter(e_catalog_filter); +} + +gboolean filter_func(struct Satellite *satellite) +{ + if (!active) + return TRUE; + + return !((field_active[FIELD_STATUS] && satellite->satcat.opstat != target_status) + || (field_active[FIELD_SOURCE] && SC_STR5_TO_CODE(satellite->satcat.source) != target_source) + || (field_active[FIELD_LAUNCH_SITE] && SC_STR5_TO_CODE(satellite->satcat.launch_site) != target_launch_site) + || FILTER_FUNC_BETWEEN(FIELD_PERIGEE, target_perigee, satellite->satcat.perigee) + || FILTER_FUNC_BETWEEN(FIELD_APOGEE, target_apogee, satellite->satcat.apogee) + || FILTER_FUNC_BETWEEN(FIELD_INCLINATION, target_inclination, satellite->satcat.inc_deg) + || FILTER_FUNC_BETWEEN(FIELD_PERIOD, target_period, satellite->satcat.period) + || (field_active[FIELD_LAUNCH_DATE] && (SC_DATE_LESS(satellite->satcat.launch_date, target_launch_date[0]) || SC_DATE_LESS(target_launch_date[1], satellite->satcat.launch_date)))); +} + +void filter_init(GtkBuilder *builder) +{ + gtk_builder_add_callback_symbols(builder, + "on_filter_clear_clicked", G_CALLBACK(on_filter_clear_clicked), + "on_filter_apply_clicked", G_CALLBACK(on_filter_apply_clicked), + "on_filter_clear_status_clicked", G_CALLBACK(on_filter_clear_status_clicked), + "on_filter_clear_source_clicked", G_CALLBACK(on_filter_clear_source_clicked), + "on_filter_clear_launch_site_clicked", G_CALLBACK(on_filter_clear_launch_site_clicked), + "on_filter_launch_date_activate", G_CALLBACK(on_filter_launch_date_activate), + NULL); + + unsigned i, j; + for (i = 0; i < NUM_FILTER_COMBO; i++) + combo_items[i] = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, combo_item_ids[i])); + for (i = 0; i < NUM_FILTER_ENTRY; i++) + for (j = 0; j < 2; j++) + entry_items[i][j] = GTK_ENTRY(gtk_builder_get_object(builder, entry_item_ids[i][j])); + + for (i = 0; i < NUM_SCSTAT; i++) + gtk_combo_box_text_append(combo_items[COMBO_STATUS], NULL, sc_status_str(SCSTAT[i])); + for (i = 0; i < NUM_SCSRC; i++) + gtk_combo_box_text_append(combo_items[COMBO_SOURCE], NULL, sc_source_str(SCSRC[i])); + for (i = 0; i < NUM_SCSITE; i++) + gtk_combo_box_text_append(combo_items[COMBO_LAUNCH_SITE], NULL, sc_launch_site_str(SCSITE[i])); +} diff --git a/src/ui/filter.h b/src/ui/filter.h new file mode 100644 index 0000000..20308cf --- /dev/null +++ b/src/ui/filter.h @@ -0,0 +1,10 @@ +#ifndef __FILTER_H__ +#define __FILTER_H__ + +#include "satellite.h" +#include "ui.h" + +void filter_init(GtkBuilder *builder); +gboolean filter_func(struct Satellite *satellite); + +#endif /* __FILTER_H__ */ diff --git a/src/ui/ui.c b/src/ui/ui.c index 5d019b8..511315f 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -3,6 +3,7 @@ #include "catalog.h" #include "entity.h" #include "error.h" +#include "filter.h" #include "gfx.h" #include "info.h" #include "input.h" @@ -68,6 +69,7 @@ void ui_init(int argc, char ***argv) catalog_init(builder); setting_init(builder); info_init(builder); + filter_init(builder); gtk_builder_connect_signals(builder, NULL); diff --git a/src/util/satcat_code_list.c b/src/util/satcat_code_list.c new file mode 100644 index 0000000..ae66c84 --- /dev/null +++ b/src/util/satcat_code_list.c @@ -0,0 +1,173 @@ +#include "satcat_code_list.h" + +/* Generated using: + * grep -oP 'SCSTAT_[A-Z0-9_]+' lib/satcat/satcat_code.h | xargs -I % echo -e '\t'%',' + **/ + +const char SCSTAT[NUM_SCSTAT] = { + SCSTAT_OPERATIONAL, + SCSTAT_NONOPERATIONAL, + SCSTAT_PARTIALLY_OPERATIONAL, + SCSTAT_BACKUP, + SCSTAT_SPARE, + SCSTAT_EXTENDED_MISSION, + SCSTAT_DECAYED, + SCSTAT_UNKNOWN, +}; + +const sc_code_t SCSRC[NUM_SCSRC] = { + SCSRC_AB, + SCSRC_ABS, + SCSRC_AC, + SCSRC_ALG, + SCSRC_ANG, + SCSRC_ARGN, + SCSRC_ASRA, + SCSRC_AUS, + SCSRC_AZER, + SCSRC_BEL, + SCSRC_BELA, + SCSRC_BERM, + SCSRC_BGD, + SCSRC_BHUT, + SCSRC_BOL, + SCSRC_BRAZ, + SCSRC_BUL, + SCSRC_CA, + SCSRC_CHBZ, + SCSRC_CHLE, + SCSRC_CIS, + SCSRC_COL, + SCSRC_CRI, + SCSRC_CZCH, + SCSRC_DEN, + SCSRC_ECU, + SCSRC_EGYP, + SCSRC_ESA, + SCSRC_ESRO, + SCSRC_EST, + SCSRC_EUME, + SCSRC_EUTE, + SCSRC_FGER, + SCSRC_FIN, + SCSRC_FR, + SCSRC_FRIT, + SCSRC_GER, + SCSRC_GHA, + SCSRC_GLOB, + SCSRC_GREC, + SCSRC_GRSA, + SCSRC_GUAT, + SCSRC_HUN, + SCSRC_IM, + SCSRC_IND, + SCSRC_INDO, + SCSRC_IRAN, + SCSRC_IRAQ, + SCSRC_IRID, + SCSRC_ISRA, + SCSRC_ISRO, + SCSRC_ISS, + SCSRC_IT, + SCSRC_ITSO, + SCSRC_JPN, + SCSRC_KAZ, + SCSRC_KEN, + SCSRC_LAOS, + SCSRC_LKA, + SCSRC_LTU, + SCSRC_LUXE, + SCSRC_MA, + SCSRC_MALA, + SCSRC_MEX, + SCSRC_MMR, + SCSRC_MNG, + SCSRC_MUS, + SCSRC_NATO, + SCSRC_NETH, + SCSRC_NICO, + SCSRC_NIG, + SCSRC_NKOR, + SCSRC_NOR, + SCSRC_NPL, + SCSRC_NZ, + SCSRC_O3B, + SCSRC_ORB, + SCSRC_PAKI, + SCSRC_PERU, + SCSRC_POL, + SCSRC_POR, + SCSRC_PRC, + SCSRC_PRY, + SCSRC_PRES, + SCSRC_QAT, + SCSRC_RASC, + SCSRC_ROC, + SCSRC_ROM, + SCSRC_RP, + SCSRC_RWA, + SCSRC_SAFR, + SCSRC_SAUD, + SCSRC_SDN, + SCSRC_SEAL, + SCSRC_SES, + SCSRC_SGJP, + SCSRC_SING, + SCSRC_SKOR, + SCSRC_SPN, + SCSRC_STCT, + SCSRC_SVN, + SCSRC_SWED, + SCSRC_SWTZ, + SCSRC_TBD, + SCSRC_THAI, + SCSRC_TMMC, + SCSRC_TUN, + SCSRC_TURK, + SCSRC_UAE, + SCSRC_UK, + SCSRC_UKR, + SCSRC_UNK, + SCSRC_URY, + SCSRC_US, + SCSRC_USBZ, + SCSRC_VENZ, + SCSRC_VTNM, +}; + +const sc_code_t SCSITE[NUM_SCSITE] = { + SCSITE_AFETR, + SCSITE_AFWTR, + SCSITE_CAS, + SCSITE_DLS, + SCSITE_ERAS, + SCSITE_FRGUI, + SCSITE_HGSTR, + SCSITE_JSC, + SCSITE_KODAK, + SCSITE_KSCUT, + SCSITE_KWAJ, + SCSITE_KYMSC, + SCSITE_NSC, + SCSITE_PLMSC, + SCSITE_RLLB, + SCSITE_SEAL, + SCSITE_SEMLS, + SCSITE_SMTS, + SCSITE_SNMLP, + SCSITE_SRILR, + SCSITE_SUBL, + SCSITE_SVOBO, + SCSITE_TAISC, + SCSITE_TANSC, + SCSITE_TYMSC, + SCSITE_UNK, + SCSITE_VOSTO, + SCSITE_WLPIS, + SCSITE_WOMRA, + SCSITE_WRAS, + SCSITE_WSC, + SCSITE_XICLF, + SCSITE_YAVNE, + SCSITE_YUN, +}; diff --git a/src/util/satcat_code_list.h b/src/util/satcat_code_list.h new file mode 100644 index 0000000..1c8ba81 --- /dev/null +++ b/src/util/satcat_code_list.h @@ -0,0 +1,14 @@ +#ifndef __SATCAT_CODE_LIST_H__ +#define __SATCAT_CODE_LIST_H__ + +#include "satcat_code.h" + +#define NUM_SCSTAT 8 +#define NUM_SCSRC 117 +#define NUM_SCSITE 34 + +extern const char SCSTAT[NUM_SCSTAT]; +extern const sc_code_t SCSRC[NUM_SCSRC]; +extern const sc_code_t SCSITE[NUM_SCSITE]; + +#endif /* __SATCAT_CODE_LIST_H__ */