IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

adding image projection I/O APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.