From: Matei C. <cm...@us...> - 2011-03-22 09:22:21
|
Update of /cvsroot/gcx/gcx/src In directory vz-cvs-2.sog:/tmp/cvs-serv22193/src Modified Files: gui.c gui.h mbandgui.c query.c query.h Log Message: Add UCAC3 query and fix frame/star list selection in mbandgui Index: query.h =================================================================== RCS file: /cvsroot/gcx/gcx/src/query.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** query.h 20 Mar 2011 02:41:58 -0000 1.5 --- query.h 22 Mar 2011 09:22:18 -0000 1.6 *************** *** 10,17 **** QUERY_GSC_ACT, QUERY_TYCHO2, QUERY_CATALOGS, }; ! #define CAT_QUERY_NAMES {"ucac2", "gsc2", "usnob", "gsc-act", "tycho2", NULL} extern char *query_catalog_names[]; --- 10,18 ---- QUERY_GSC_ACT, QUERY_TYCHO2, + QUERY_UCAC3, QUERY_CATALOGS, }; ! #define CAT_QUERY_NAMES {"ucac2", "gsc2", "usnob", "gsc-act", "tycho2", "ucac3", NULL} extern char *query_catalog_names[]; Index: query.c =================================================================== RCS file: /cvsroot/gcx/gcx/src/query.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** query.c 21 Mar 2011 02:01:38 -0000 1.13 --- query.c 22 Mar 2011 09:22:18 -0000 1.14 *************** *** 57,65 **** QTABLE_USNOB, QTABLE_GSC_ACT, QTABLES, }; char *table_names[] = {"I_289_out", "I_294_ucac2bss", "I_271_out", "I_284_out", ! "I_255_out"}; static int detabify(char *line, int cols[], int n) --- 57,66 ---- QTABLE_USNOB, QTABLE_GSC_ACT, + QTABLE_UCAC3, QTABLES, }; char *table_names[] = {"I_289_out", "I_294_ucac2bss", "I_271_out", "I_284_out", ! "I_255_out", "I_315_out"}; static int detabify(char *line, int cols[], int n) *************** *** 264,267 **** --- 265,363 ---- } + static struct cat_star * parse_cat_line_ucac3(char *line) + { + struct cat_star * cats; + int cols[32]; + int nc; + double u, v, w, x; + double uc, m, j, k; + char *endp; + int ret = 0; + + nc = detabify(line, cols, 32); + + d4_printf("[ucac3-%d]%s\n", nc, line); + + if (nc < 12) + return NULL; + + u = strtod(line+cols[1], &endp); + if (line+cols[1] == endp) + return NULL; + v = strtod(line+cols[2], &endp); + if (line+cols[2] == endp) + return NULL; + + cats = cat_star_new(); + snprintf(cats->name, CAT_STAR_NAME_SZ, "ucac3%s", line+cols[0]); + cats->ra = u; + cats->dec = v; + cats->equinox = 2000.0; + cats->flags = CAT_STAR_TYPE_SREF; + + /* + #Column 3UC (a10) UCAC3 designation (1) [ucd=meta.id;meta.main] + #Column RAJ2000 (F11.7) Right ascension (degrees), ICRS, Ep=J2000 [ucd=pos.eq.ra;meta.main] + #Column DEJ2000 (F11.7) Declination (degrees), ICRS, Ep=J2000 [ucd=pos.eq.dec;meta.main] + #Column ePos (I4) Error of position at Epoch=J2000 (9) [ucd=stat.error;pos] + #Column f.mag (F6.3) ? UCAC fit model magnitude (579-642nm) (2) [ucd=phot.mag;em.opt] + #Column ot (I2) [-2,3] UCAC object classification flag (4) [ucd=src.class.starGalaxy] + #Column db (I1) [0,7] double star flag (5) [ucd=meta.code] + #Column pmRA (F8.1) ? Proper motion in RA(*cos(Dec)) \ifnum\Vphase>3{\fg{gray40}(in gray if catflg indicates less than 2 good matches)}\fi [ucd=pos.pm;pos.eq.ra] + #Column pmDE (F8.1) ? Proper motion in Dec \ifnum\Vphase>3{\fg{gray40}(in gray if catflg indicates less than 2 good matches)}\fi [ucd=pos.pm;pos.eq.dec] + #Column Jmag (F6.3) ? J magnitude (1.2um) from 2MASS \ifnum\Vphase>3{\fg{gray40}(in gray if upper limit)}\fi [ucd=phot.mag;em.IR.J] + #Column Kmag (F6.3) ? K magnitude (2.2um) from 2MASS \ifnum\Vphase>3{\fg{gray40}(in gray if upper limit)}\fi [ucd=phot.mag;em.IR.K] + #Column catflg (a10) matching flags for 10 catalogues (12) [ucd=meta.code] + + */ + + u = strtod(line+cols[3], &endp); + if (u > 0) { + cats->perr = u / 1000; // is epos in mas ? + } else { + cats->perr = BIG_ERR; + } + + uc = strtod(line+cols[4], &endp); + cats->mag = uc; + + /* what is "p=..." ? */ + m = strtod(line+cols[5], &endp); + asprintf(&cats->comments, "ucac3_class=%.0f", m); + + j = strtod(line+cols[9], &endp); + k = strtod(line+cols[10], &endp); + cats->smags = NULL; + + if (j > 0.0 && k > 0.0) { + if (uc == 0) + ret = asprintf(&cats->smags, "j=%.3f k=%.3f", j, k); + else + ret = asprintf(&cats->smags, "uc=%.3f j=%.3f k=%.3f", uc, j, k); + } + + w = strtod(line+cols[7], &endp); + if (line+cols[7] == endp) + return cats; + x = strtod(line+cols[8], &endp); + if (line+cols[8] == endp) + return cats; + + cats->flags |= CAT_ASTROMET; + + cats->astro = calloc(1, sizeof(struct cats_astro)); + g_return_val_if_fail(cats->astro != NULL, cats); + + cats->astro->epoch = 2000.0; + cats->astro->ra_err = 0; // cats->perr instead ?! + cats->astro->dec_err = 0; + cats->astro->ra_pm = w; + cats->astro->dec_pm = x; + cats->astro->flags = ASTRO_HAS_PM; + + cats->astro->catalog = strdup("ucac3"); + return cats; + } + static struct cat_star * parse_cat_line_gsc2(char *line) { *************** *** 519,522 **** --- 615,620 ---- { switch(tnum) { + case QTABLE_UCAC3: + return parse_cat_line_ucac3(line); case QTABLE_UCAC2: return parse_cat_line_ucac2_main(line); *************** *** 854,857 **** --- 952,960 ---- } + void act_stars_add_cds_ucac3 (GtkAction *action, gpointer window) + { + cds_query (window, QUERY_UCAC3); + } + void act_stars_add_cds_gsc2 (GtkAction *action, gpointer window) { Index: gui.h =================================================================== RCS file: /cvsroot/gcx/gcx/src/gui.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** gui.h 20 Mar 2011 02:41:58 -0000 1.19 --- gui.h 22 Mar 2011 09:22:18 -0000 1.20 *************** *** 266,269 **** --- 266,270 ---- extern void act_stars_add_cds_gsc_act (GtkAction *action, gpointer window); extern void act_stars_add_cds_ucac2 (GtkAction *action, gpointer window); + extern void act_stars_add_cds_ucac3 (GtkAction *action, gpointer window); extern void act_stars_add_cds_gsc2 (GtkAction *action, gpointer window); extern void act_stars_add_cds_usnob (GtkAction *action, gpointer window); Index: mbandgui.c =================================================================== RCS file: /cvsroot/gcx/gcx/src/mbandgui.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** mbandgui.c 20 Mar 2011 02:41:58 -0000 1.14 --- mbandgui.c 22 Mar 2011 09:22:18 -0000 1.15 *************** *** 781,809 **** } ! ! void ofr_bpress_cb(GtkTreeView *ofr_list, GdkEventButton *event, gpointer data) { - int x, y; struct o_frame *ofr; GtkTreeModel *ofr_store; GtkTreePath *path; GtkTreeIter iter; ! g_return_if_fail(event->window == gtk_tree_view_get_bin_window(ofr_list)); ! ! x = floor(event->x); ! y = floor(event->y); ! ! if (gtk_tree_view_get_path_at_pos(ofr_list, x, y, &path, NULL, NULL, NULL)) { ! ! ofr_store = gtk_tree_view_get_model(ofr_list); ! if (gtk_tree_model_get_iter(ofr_store, &iter, path)) { gtk_tree_model_get(ofr_store, &iter, 0, &ofr, -1); g_return_if_fail(ofr != NULL); ! mb_rebuild_sob_list(data, ofr->sol); ! } } } --- 781,806 ---- } ! /* rebuild star list in stars tab based on the first frame in the current selection */ ! static void ofr_selection_cb(GtkWidget *selection, gpointer dialog) { struct o_frame *ofr; GtkTreeModel *ofr_store; GtkTreePath *path; GtkTreeIter iter; + GList *list; ! list = gtk_tree_selection_get_selected_rows (GTK_TREE_SELECTION(selection), &ofr_store); + if (list != NULL) { + path = list->data; + gtk_tree_model_get_iter (ofr_store, &iter, path); gtk_tree_model_get(ofr_store, &iter, 0, &ofr, -1); g_return_if_fail(ofr != NULL); ! mb_rebuild_sob_list (dialog, ofr->sol); } + + g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL); + g_list_free (list); } *************** *** 817,820 **** --- 814,818 ---- int i; GtkTreeViewColumn *column; + GtkTreeSelection *selection; ofr_list = g_object_get_data(G_OBJECT(dialog), "ofr_list"); *************** *** 845,853 **** ofr_list, (GDestroyNotify) gtk_widget_destroy); ! gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(ofr_list)), ! GTK_SELECTION_MULTIPLE); ! g_signal_connect(G_OBJECT(ofr_list), "button-press-event", ! G_CALLBACK(ofr_bpress_cb), dialog); gtk_widget_show(ofr_list); --- 843,851 ---- ofr_list, (GDestroyNotify) gtk_widget_destroy); ! selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(ofr_list)); ! gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); ! g_signal_connect (G_OBJECT(selection), "changed", ! G_CALLBACK(ofr_selection_cb), dialog); gtk_widget_show(ofr_list); Index: gui.c =================================================================== RCS file: /cvsroot/gcx/gcx/src/gui.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** gui.c 20 Mar 2011 02:41:58 -0000 1.30 --- gui.c 22 Mar 2011 09:22:18 -0000 1.31 *************** *** 505,508 **** --- 505,509 ---- { "catalogs-add-gsc-act", NULL, "Download GSC-_ACT stars from CDS", NULL, NULL, G_CALLBACK (act_stars_add_cds_gsc_act) }, { "catalogs-add-ucac2", NULL, "Download _UCAC-2 stars from CDS", NULL, NULL, G_CALLBACK (act_stars_add_cds_ucac2) }, + { "catalogs-add-ucac3", NULL, "Download UCAC-_3 stars from CDS", NULL, NULL, G_CALLBACK (act_stars_add_cds_ucac3) }, { "catalogs-add-gsc2", NULL, "Download G_SC-2 stars from CDS", NULL, NULL, G_CALLBACK (act_stars_add_cds_gsc2) }, { "catalogs-add-usnob", NULL, "Download USNO-_B stars from CDS", NULL, NULL, G_CALLBACK (act_stars_add_cds_usnob) }, *************** *** 645,648 **** --- 646,650 ---- " <menuitem name='catalogs-add-gsc-act' action='catalogs-add-gsc-act'/>" " <menuitem name='catalogs-add-ucac2' action='catalogs-add-ucac2'/>" + " <menuitem name='catalogs-add-ucac3' action='catalogs-add-ucac3'/>" " <menuitem name='catalogs-add-gsc2' action='catalogs-add-gsc2'/>" " <menuitem name='catalogs-add-usnob' action='catalogs-add-usnob'/>" |