Changeset 13479 for trunk/Ohana/src/opihi/cmd.data/cursor.c
- Timestamp:
- May 22, 2007, 12:23:09 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/cursor.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/cursor.c
r7917 r13479 3 3 int cursor (int argc, char **argv) { 4 4 5 char string[20], key[20] ;6 int i, N, Nsource, Source, IsImage;5 char string[20], key[20], *name; 6 int i, N, kapa; 7 7 double X, Y, R, D, Z; 8 8 void *oldsignal; 9 Graphdata graphmode;10 Buffer *buf;11 9 12 Nsource = -1; 10 // XXX need to be able to specify graph vs image coords 11 // currently, if only one exists, that frame will be used 12 // if both exist, defaults to ?? 13 // if ((N = get_argument (argc, argv, "-g"))) { 14 // if ((N = get_argument (argc, argv, "-i"))) { 15 16 name = NULL; 13 17 if ((N = get_argument (argc, argv, "-n"))) { 14 18 remove_argument (N, &argc, argv); 15 Nsource = atof(argv[N]);19 name = strcreate (argv[N]); 16 20 remove_argument (N, &argc, argv); 17 21 } 18 if ((N = get_argument (argc, argv, "-g"))) { 19 remove_argument (N, &argc, argv); 20 SetImageDevice (FALSE); 21 } 22 if ((N = get_argument (argc, argv, "-i"))) { 23 remove_argument (N, &argc, argv); 24 SetImageDevice (TRUE); 25 } 26 IsImage = GetCurrentDevice (); 27 if (IsImage) { 28 if (!GetImage (&Source, &Nsource)) return (FALSE); 29 } else { 30 if (!GetGraph (&graphmode, &Source, &Nsource)) return (FALSE); 31 } 22 if (!GetGraphData (NULL, &kapa, name)) return (FALSE); 23 FREE (name); 32 24 33 25 N = 0; … … 39 31 } 40 32 41 buf = NULL; 42 if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE); 43 44 KiiCursorOn (Source); 33 KiiCursorOn (kapa); 45 34 46 35 oldsignal = signal (SIGINT, handle_interrupt); 47 36 interrupt = FALSE; 48 Z = -1.0; 37 49 38 for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) { 50 KiiCursorRead (Source, &X, &Y, key); 39 40 KiiCursorRead (kapa, &X, &Y, &Z, &R, &D, key); 51 41 52 42 sprintf (string, "X%s", key); … … 54 44 sprintf (string, "Y%s", key); 55 45 set_variable (string, Y); 46 sprintf (string, "Z%s", key); 47 set_variable (string, Z); 48 sprintf (string, "R%s", key); 49 set_variable (string, R); 50 sprintf (string, "D%s", key); 51 set_variable (string, D); 52 56 53 set_str_variable ("KEY", key); 57 54 58 if (IsImage) { 59 if (buf != NULL) { 60 Z = gfits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 61 } 62 gprint (GP_LOG, "%s %f %f %f\n", key, X, Y, Z); 63 } else { 64 XY_to_RD (&R, &D, X, Y, &graphmode.coords); 65 sprintf (string, "R%s", key); 66 set_variable (string, R); 67 sprintf (string, "D%s", key); 68 set_variable (string, D); 69 gprint (GP_LOG, "%s %f %f\n", key, X, Y); 70 } 55 gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D); 56 71 57 if (!strcasecmp (key, "Q")) break; 72 58 } 73 59 74 60 signal (SIGINT, oldsignal); 75 KiiCursorOff ( Source);61 KiiCursorOff (kapa); 76 62 return (TRUE); 77 63 }
Note:
See TracChangeset
for help on using the changeset viewer.
