IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 27, 2005, 5:06:32 AM (21 years ago)
Author:
eugene
Message:

converting to use libkapa commands instead of raw graph commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/cursor.c

    r5349 r5846  
    33int cursor (int argc, char **argv) {
    44
    5   char buffer[40], string[20], key[20], keyname[20];
     5  char string[20], key[20];
    66  int i, N, Nsource, Source, IsImage;
    77  double X, Y, R, D, Z;
     
    4242  if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE);
    4343 
    44   sprintf (string, "CURS");
    45   write (Source, string, 4); /* ask Source to look for the keystrokes */
     44  KiiCursorOn (Source);
    4645 
    4746  oldsignal = signal (SIGINT, handle_interrupt);
     
    4948  Z = -1.0;
    5049  for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) {
    51     bzero (buffer, 40);
    52     read (Source, buffer, 40);
    53     buffer[39] = 0;
    54     sscanf (buffer, "%s %lf %lf", key, &X, &Y);
    55     if (ispunct(key[0])) {
    56       strcpy (keyname, "_");
    57     } else {
    58       strcpy (keyname, key);
    59     }
    60     sprintf (string, "X%s", keyname);
     50    KiiCursorRead (Source, &X, &Y, key);
     51
     52    sprintf (string, "X%s", key);
    6153    set_variable (string, X);
    62     sprintf (string, "Y%s", keyname);
     54    sprintf (string, "Y%s", key);
    6355    set_variable (string, Y);
    6456    set_str_variable ("KEY", key);
    6557   
    66     if (IsImage && (buf != NULL))
    67       Z = fits_get_matrix_value (&buf[0].matrix, (int)X, (int)Y);
    68 
    69     if (!IsImage) {
    70       XY_to_RD (&R, &D, X, Y, &graphmode.coords);
    71       sprintf (string, "R%s", keyname);
    72       set_variable (string, R);
    73       sprintf (string, "D%s", keyname);
    74       set_variable (string, D);
    75     }
    76 
    77     /* I still don't like this, but I have to decide which to print... */
    7858    if (IsImage) {
     59      if (buf != NULL) {
     60        Z = fits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y);
     61      }
    7962      fprintf (GetOutfile(), "%s %f %f  %f\n", key, X, Y, Z);
    8063    } 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);
    8169      fprintf (GetOutfile(), "%s %f %f\n", key, X, Y);
    8270    }
    83 
    84     if (!strcasecmp (key, "Q")) {
    85       signal (SIGINT, (void *) oldsignal);
    86       write (Source, "NCUR", 4); /* ask Source to stop looking for the keystrokes */
    87       return (TRUE);
    88     }
    89 
     71    if (!strcasecmp (key, "Q")) break;
    9072  }
    9173
    9274  signal (SIGINT, oldsignal);
    93   write (Source, "NCUR", 4); /* ask Source to look for the keystrokes */
     75  KiiCursorOff (Source);
    9476  return (TRUE);
    95      
    9677}
Note: See TracChangeset for help on using the changeset viewer.