Changeset 13465
- Timestamp:
- May 21, 2007, 6:29:09 PM (19 years ago)
- Location:
- branches/kapa-mods-2007-05/Ohana/src
- Files:
-
- 9 edited
-
kapa2/src/CheckPipe.c (modified) (4 diffs)
-
kapa2/src/InterpretKeys.c (modified) (4 diffs)
-
kapa2/src/InterpretPresses.c (modified) (3 diffs)
-
libkapa/include/kapa.h (modified) (1 diff)
-
libkapa/src/IOfuncs.c (modified) (2 diffs)
-
libkapa/src/KiiCursor.c (modified) (1 diff)
-
opihi/cmd.data/cursor.c (modified) (4 diffs)
-
opihi/dvo/scripts/navigate (modified) (4 diffs)
-
relphot/src/plotstuff.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c
r13434 r13465 10 10 InitSocket = KapaServerInit (&Address); 11 11 return; 12 } 13 14 int GetActiveSocket () { 15 return (sock); 12 16 } 13 17 … … 57 61 if (strcmp (word, "NCUR")) { 58 62 fprintf (stderr, "wrong end message %s\n", word); 63 KiiSendCommand (sock, 4, "DONE"); 59 64 FINISHED (TRUE); 60 65 } 61 66 ACTIVE_CURSOR = FALSE; 67 KiiSendCommand (sock, 4, "DONE"); 62 68 FINISHED (TRUE); 63 69 } … … 67 73 if (!strcmp (word, "CURS")) { 68 74 ACTIVE_CURSOR = TRUE; 75 KiiSendCommand (sock, 4, "DONE"); 69 76 FINISHED (TRUE); 70 77 } … … 269 276 270 277 fprintf (stderr, "unknown signal %s\n", word); 278 KiiSendCommand (sock, 4, "DONE"); 271 279 FINISHED (TRUE); 272 280 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretKeys.c
r13344 r13465 3 3 int InterpretKeys (Graphic *graphic, XKeyEvent *event) { 4 4 5 double X, Y, offset; 6 int modstate; 5 float *imdata; 6 double X, Y, Z, R, D, offset; 7 int sock, DX, DY, modstate; 7 8 char *name, string[16], line[40]; 8 9 KeySym keysym; … … 23 24 // XXX allow user to choose graph or image coords 24 25 if (ACTIVE_CURSOR) { 26 27 sock = GetActiveSocket (); 28 if (sock == -1) goto skip_cursor; 29 25 30 name = XKeysymToString (keysym); 26 31 … … 43 48 if (!strcmp (name, "(null)")) goto skip_cursor; 44 49 50 Z = -1; 51 45 52 if (graph) { 46 53 X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min; 47 54 Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min; 55 XY_to_RD (&R, &D, X, Y, &graph[0].data.coords); 48 56 } 49 57 if (image && !graph) { … … 53 61 if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor; 54 62 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 63 XY_to_RD (&R, &D, X, Y, &image[0].coords); 64 65 DX = image[0].matrix.Naxis[0]; 66 DY = image[0].matrix.Naxis[1]; 67 68 if (X < 0) goto off_image; 69 if (Y < 0) goto off_image; 70 if (X >= DX) goto off_image; 71 if (Y >= DY) goto off_image; 72 imdata = (float *) image[0].matrix.buffer; 73 Z = imdata[DX*(int)(Y) + (int)(X)]; 55 74 } 56 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y); 57 // XXX need to do something different here 58 // xxx write (sock, line, 40); 75 off_image: 76 KiiSendMessage (sock, "%12s %12.6f %12.6f %12.6f %12.6f %12.6f", name, X, Y, Z, R, D); 59 77 } 60 78 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretPresses.c
r13344 r13465 3 3 int InterpretPresses (Graphic *graphic, XButtonEvent *event) { 4 4 5 int s tatus, done, this_button, old_cursor;5 int sock, DX, DY, status, done, this_button, old_cursor; 6 6 char name[16], line[40]; 7 double X, Y; 7 double X, Y, Z, R, D; 8 float *imdata; 8 9 KeySym keysym; 9 10 Button *button; … … 20 21 // XXX allow user to choose graph or image coords 21 22 if (ACTIVE_CURSOR) { 23 sock = GetActiveSocket (); 24 if (sock == -1) goto skip_cursor; 25 22 26 sprintf (name, "Button%d", event[0].button); 23 27 if (graph) { 24 28 X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min; 25 29 Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min; 30 XY_to_RD (&R, &D, X, Y, &graph[0].data.coords); 26 31 } 27 32 if (image && !graph) { … … 30 35 if (event[0].x > image[0].picture.x + image[0].picture.dx) goto skip_cursor; 31 36 if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor; 32 33 37 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 38 39 XY_to_RD (&R, &D, X, Y, &image[0].coords); 40 41 DX = image[0].matrix.Naxis[0]; 42 DY = image[0].matrix.Naxis[1]; 43 44 if (X < 0) goto off_image; 45 if (Y < 0) goto off_image; 46 if (X >= DX) goto off_image; 47 if (Y >= DY) goto off_image; 48 imdata = (float *) image[0].matrix.buffer; 49 Z = imdata[DX*(int)(Y) + (int)(X)]; 34 50 } 35 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y); 36 // need to do something different here... 37 // xxx write (sock, line, 40); 51 off_image: 52 KiiSendMessage (sock, "%12s %12.6f %12.6f %12.6f %12.6f %12.6f", name, X, Y, Z, R, D); 38 53 } 39 54 -
branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h
r13434 r13465 142 142 int KiiCursorOn (int fd); 143 143 int KiiCursorOff (int fd); 144 int KiiCursorRead (int fd, double *x, double *y, char *key);144 int KiiCursorRead (int fd, double *x, double *y, double *z, double *r, double *d, char *key); 145 145 146 146 /* KapaWindow.c */ -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/IOfuncs.c
r13437 r13465 75 75 /* make the string easy to parse */ 76 76 77 // fprintf (stderr, " messagerecv: %s\n", message);77 // fprintf (stderr, "recv: %s\n", message); 78 78 79 79 /* scan the incoming message */ … … 109 109 110 110 write (device, string, length); 111 112 // fprintf (stderr, "send: %s\n", string); 113 111 114 free (string); 112 115 return (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KiiCursor.c
r13409 r13465 15 15 } 16 16 17 int KiiCursorRead (int fd, double *x, double *y, char *key) {17 int KiiCursorRead (int fd, double *x, double *y, double *z, double *r, double *d, char *key) { 18 18 19 char buffer[40]; 20 21 bzero (buffer, 40); 22 read (fd, buffer, 40); 23 buffer[39] = 0; 24 25 sscanf (buffer, "%s %lf %lf", key, x, y); 19 KiiScanMessage (fd, "%s %lf %lf %lf %lf %lf", key, x, y, z, r, d); 26 20 if (ispunct(key[0])) strcpy (key, "_"); 27 28 21 return (TRUE); 29 22 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/cursor.c
r13434 r13465 7 7 double X, Y, R, D, Z; 8 8 void *oldsignal; 9 Graphdata graphmode;10 Buffer *buf;11 9 12 10 // XXX need to be able to specify graph vs image coords … … 22 20 remove_argument (N, &argc, argv); 23 21 } 24 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE);22 if (!GetGraphData (NULL, &kapa, name)) return (FALSE); 25 23 FREE (name); 26 24 … … 33 31 } 34 32 35 buf = NULL;36 // if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE);37 // XXX this stuff will go away with 32bit image data38 39 33 KiiCursorOn (kapa); 40 34 41 35 oldsignal = signal (SIGINT, handle_interrupt); 42 36 interrupt = FALSE; 43 Z = -1.0; 37 44 38 for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) { 45 39 46 // XXX have kapa return x,y,z,ra,dec for all options 47 KiiCursorRead (kapa, &X, &Y, key); 40 KiiCursorRead (kapa, &X, &Y, &Z, &R, &D, key); 48 41 49 42 sprintf (string, "X%s", key); … … 51 44 sprintf (string, "Y%s", key); 52 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 53 53 set_str_variable ("KEY", key); 54 54 55 if (buf != NULL) { 56 Z = gfits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 57 // gprint (GP_LOG, "%s %f %f %f\n", key, X, Y, Z); 58 } else { 59 XY_to_RD (&R, &D, X, Y, &graphmode.coords); 60 sprintf (string, "R%s", key); 61 set_variable (string, R); 62 sprintf (string, "D%s", key); 63 set_variable (string, D); 64 gprint (GP_LOG, "%s %f %f\n", key, X, Y); 65 } 55 gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D); 56 66 57 if (!strcasecmp (key, "Q")) break; 67 58 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/scripts/navigate
r10847 r13465 11 11 $KEY = "none" 12 12 while ("$KEY" != "q") 13 cursor -g113 cursor 1 14 14 15 15 # help list … … 147 147 $ok = $KEY 148 148 echo "type 'd' again at endpoint" 149 cursor -g1149 cursor 1 150 150 $r1 = $R$KEY 151 151 $d1 = $D$KEY … … 168 168 $ok = $KEY 169 169 echo "type 'z' again at radius" 170 cursor -g1170 cursor 1 171 171 $r1 = $R$KEY 172 172 $d1 = $D$KEY … … 400 400 if ("$KEY" == "p") 401 401 echo "P - new coords; p - old coords" 402 cursor -g1402 cursor 1 403 403 exec echo $Rp $Dp $RP $DP >> fix.coords 404 404 end -
branches/kapa-mods-2007-05/Ohana/src/relphot/src/plotstuff.c
r13455 r13465 24 24 25 25 sprintf (name, "gastro [%d]", N); 26 Xgraph[N] = KapaOpen (" /home/kiawe/eugene/psconfig/dev.linux/bin/kapa2", name);26 Xgraph[N] = KapaOpen ("kapa2", name); 27 27 28 28 if (Xgraph[N] < 0) {
Note:
See TracChangeset
for help on using the changeset viewer.
