IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14500


Ignore:
Timestamp:
Aug 15, 2007, 9:10:13 AM (19 years ago)
Author:
eugene
Message:

adding image projection I/O APIs

Location:
trunk/Ohana/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/include/prototypes.h

    r13479 r14500  
    6767int           SetImageData        PROTO((int sock));
    6868int           GetImageData        PROTO((int sock));
     69int           SetImageCoords      PROTO((int sock));
     70int           GetImageCoords      PROTO((int sock));
     71int           GetImageRange       PROTO((int sock));
    6972
    7073int           LoadVectorData      PROTO((int sock, KapaGraphWidget *graph, int N, char *type));
  • trunk/Ohana/src/kapa2/src/CheckPipe.c

    r13899 r14500  
    155155  }
    156156 
     157  if (!strcmp (word, "SIMC")) {
     158    SetImageCoords (sock);
     159    KiiSendCommand (sock, 4, "DONE");
     160    FINISHED (TRUE);
     161  }
     162 
     163  if (!strcmp (word, "GIMC")) {
     164    GetImageCoords (sock);
     165    KiiSendCommand (sock, 4, "DONE");
     166    FINISHED (TRUE);
     167  }
     168 
     169  if (!strcmp (word, "GIMR")) {
     170    GetImageRange (sock);
     171    KiiSendCommand (sock, 4, "DONE");
     172    FINISHED (TRUE);
     173  }
     174 
    157175  if (!strcmp (word, "GIMD")) {
    158176    GetImageData (sock);
  • trunk/Ohana/src/kapa2/src/SetImageData.c

    r13479 r14500  
    5252  return (TRUE);
    5353}
     54
     55int SetImageCoords (int sock) {
     56 
     57  int i;
     58  double xmin, xmax, ymin, ymax;
     59  Graphic *graphic;
     60  Section *section;
     61  KapaImageWidget *image;
     62
     63  graphic = GetGraphic();
     64
     65  section = GetActiveSection();
     66  if (section->image == NULL) {
     67    section->image = InitImage ();
     68    SetSectionSizes (section);
     69  }
     70  image = section->image;
     71 
     72  KiiScanMessage (sock, "%f %f %f %f",
     73                  &image[0].coords.pc1_1, &image[0].coords.pc2_2,
     74                  &image[0].coords.pc1_2, &image[0].coords.pc2_1);
     75
     76  KiiScanMessage (sock, "%s", image[0].coords.ctype);
     77
     78  KiiScanMessage (sock, "%lf %lf %f %f %f %f",
     79                  &image[0].coords.crval1,
     80                  &image[0].coords.crval2,
     81                  &image[0].coords.crpix1,
     82                  &image[0].coords.crpix2,
     83                  &image[0].coords.cdelt1,
     84                  &image[0].coords.cdelt2);
     85
     86  return (TRUE); 
     87}
     88
     89int GetImageCoords (int sock) {
     90 
     91  Section *section;
     92  KapaImageWidget *image;
     93
     94  section = GetActiveSection();
     95  if (section->image == NULL) {
     96    section->image = InitImage ();
     97    SetSectionSizes (section);
     98  }
     99  image = section->image;
     100
     101  KiiSendMessage (sock, "%g %g %g %g",
     102                  image[0].coords.pc1_1, image[0].coords.pc2_2,
     103                  image[0].coords.pc1_2, image[0].coords.pc2_1);
     104
     105  KiiSendMessage (sock, "%s", image[0].coords.ctype);
     106
     107  KiiSendMessage (sock, "%g %g %g %g %g %g",
     108                  image[0].coords.crval1,
     109                  image[0].coords.crval2,
     110                  image[0].coords.crpix1,
     111                  image[0].coords.crpix2,
     112                  image[0].coords.cdelt1,
     113                  image[0].coords.cdelt2);
     114
     115  return (TRUE);
     116}
     117
     118int GetImageRange (int sock) {
     119 
     120  Section *section;
     121  KapaImageWidget *image;
     122  double Xmin, Xmax, Ymin, Ymax;
     123
     124  section = GetActiveSection();
     125  if (section->image == NULL) {
     126    section->image = InitImage ();
     127    SetSectionSizes (section);
     128  }
     129  image = section->image;
     130
     131  Screen_to_Image (&Xmin, &Ymin, 0.0, 0.0, image);
     132  Screen_to_Image (&Xmax, &Ymax, image[0].picture.dx, image[0].picture.dy, image);
     133
     134  KiiSendMessage (sock, "%g %g %g %g", Xmin, Xmax, Ymin, Ymax);
     135
     136  return (TRUE);
     137}
     138
  • trunk/Ohana/src/kapa2/src/SetImageSize.c

    r13479 r14500  
    7777      image[0].text_dx = ZOOM_X;
    7878      image[0].text_dy = 6*textpad + 7*PAD1;
     79      image[0].text_dyo = 3*textpad + 4*PAD1;
    7980
    8081      image[0].overlay_button[0].x = image[0].text_x;
     
    144145      image[0].text_dx = ZOOM_X;
    145146      image[0].text_dy = 6*textpad + 7*PAD1;
     147      image[0].text_dyo = 3*textpad + 4*PAD1;
    146148
    147149      image[0].overlay_button[0].x = image[0].text_x;
     
    209211      image[0].text_dx = ZOOM_X;
    210212      image[0].text_dy = 6*textpad + 7*PAD1;
     213      image[0].text_dyo = 3*textpad + 4*PAD1;
    211214
    212215      image[0].overlay_button[0].x = image[0].text_x;
     
    274277      image[0].text_dx = ZOOM_X;
    275278      image[0].text_dy = 6*textpad + 7*PAD1;
     279      image[0].text_dyo = 3*textpad + 4*PAD1;
    276280
    277281      image[0].overlay_button[0].x = image[0].text_x;
  • trunk/Ohana/src/libkapa/include/kapa.h

    r13899 r14500  
    124124int KiiNewPicture1D (int fd, KiiImage *image, KapaImageData *data, Coords *coords);
    125125int KiiNewPicture2D (int fd, KiiImage *image, KapaImageData *data, Coords *coords);
     126
     127int KapaSetImageCoords (int fd, Coords *coords);
     128int KapaGetImageCoords (int fd, Coords *coords);
     129int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax);
    126130
    127131/* KiiOverlay.c */
  • trunk/Ohana/src/libkapa/src/KiiPicture.c

    r13479 r14500  
    155155}
    156156
     157int KapaSetImageCoords (int fd, Coords *coords) {
     158
     159  /* tell kapa to look for the incoming image */
     160  KiiSendCommand (fd, 4, "SIMC");
     161 
     162  KiiSendMessage (fd, "%g %g %g %g",
     163                  coords[0].pc1_1, coords[0].pc2_2,
     164                  coords[0].pc1_2, coords[0].pc2_1);
     165
     166  KiiSendMessage (fd, "%s", coords[0].ctype);
     167
     168  KiiSendMessage (fd, "%g %g %g %g %g %g",
     169                  coords[0].crval1,
     170                  coords[0].crval2,
     171                  coords[0].crpix1,
     172                  coords[0].crpix2,
     173                  coords[0].cdelt1,
     174                  coords[0].cdelt2);
     175
     176  KiiWaitAnswer (fd, "DONE");
     177  return (TRUE);
     178}
     179
     180int KapaGetImageCoords (int fd, Coords *coords) {
     181
     182  /* tell kapa to look for the incoming image */
     183  KiiSendCommand (fd, 4, "GIMC");
     184 
     185  KiiScanMessage (fd, "%f %f %f %f",
     186                  &coords[0].pc1_1, &coords[0].pc2_2,
     187                  &coords[0].pc1_2, &coords[0].pc2_1);
     188
     189  KiiScanMessage (fd, "%s", coords[0].ctype);
     190
     191  KiiScanMessage (fd, "%lf %lf %f %f %f %f",
     192                  &coords[0].crval1,
     193                  &coords[0].crval2,
     194                  &coords[0].crpix1,
     195                  &coords[0].crpix2,
     196                  &coords[0].cdelt1,
     197                  &coords[0].cdelt2);
     198
     199  // XXX at some point, we need to add polynomials and 2-level mosaic
     200  // astrometry here.
     201
     202  coords[0].Npolyterms = 0;
     203
     204  KiiWaitAnswer (fd, "DONE");
     205  return (TRUE);
     206}
     207
     208int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax) {
     209
     210  /* tell kapa to look for the incoming image */
     211  KiiSendCommand (fd, 4, "GIMR");
     212 
     213  KiiScanMessage (fd, "%lf %lf %lf %lf", Xmin, Xmax, Ymin, Ymax);
     214
     215  KiiWaitAnswer (fd, "DONE");
     216  return (TRUE);
     217}
     218
     219
    157220/* this function should be broken into pieces:
    158221   KiiSendImage
Note: See TracChangeset for help on using the changeset viewer.