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/tvcontour.c

    r4689 r5846  
    4242
    4343# define DUMP { \
    44 sprintf (&buffer[Nline*128], "%14s %20.10f %20.10f %20.10f %20.10f ", "LINE", Npix*x, Npix*y, Npix*dx, Npix*dy); \
    45 Nline ++; \
    46 if (Nline == 512) { \
    47   SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline); \
    48   write (Ximage, buffer, Nline*128); \
    49   bzero (buffer, 65536); \
    50   Nline = 0; \
    51 } \
    52 continue; }
    53 
    54 # define NUMP { \
    55 sprintf (&buffer[Nline*128], "%14s %20.10f %20.10f %20.10f %20.10f ", "LINE", Npix*x, Npix*y, Npix*dx, Npix*dy); \
    56 Nline ++; \
    57 if (Nline == 512) { \
    58   SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline); \
    59   write (Ximage, buffer, Nline*128); \
    60   bzero (buffer, 65536); \
    61   Nline = 0; \
    62 } }
     44overlay[Noverlay].type = KII_OVERLAY_LINE; \
     45overlay[Noverlay].x = Npix*x; \
     46overlay[Noverlay].y = Npix*y; \
     47overlay[Noverlay].dx = Npix*dx; \
     48overlay[Noverlay].dy = Npix*dy; \
     49Noverlay ++; \
     50CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 1000); \
     51}
    6352
    6453int tvcontour (int argc, char **argv) {
    6554
    66   int i, j, ii, jj, n, Npix, Nx, Ny, Nline;
     55  int i, j, ii, jj, Npix, Nx, Ny;
    6756  float level, d00, d01, d10, d11, tmp;
    6857  float x, y, dx, dy;
    6958  float *v00, *v01, *v10, *v11;
    7059  float *Vout, *Vin, *matrix;
    71   char *buffer;
    72   int Ximage, Nimage, N;
     60  int Ximage, Nimage, N, Noverlay, NOVERLAY;
    7361  Buffer *buf;
     62  KiiOverlay *overlay;
    7463 
    7564  Nimage = -1;
     
    8776
    8877  if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE);
    89   if (!SelectOverlay (argv[2], &n)) return (FALSE);
    9078
    9179  level = atof (argv[3]);
     
    115103      }
    116104    }
    117   }
    118   else {
     105  } else {
    119106    fprintf (stderr, "using scale of 1\n");
    120107    matrix = (float *)(buf[0].matrix.buffer);
    121108  }
    122109
    123   SendGraphCommand (Ximage, 4, "LOAD"); /* force Ximage to look for the incoming image */
    124   SendGraphCommand (Ximage, 16, "OVERLAY %7d ", n);
    125   ALLOCATE (buffer, char, 65536);  /* space for 512 lines of 128 bytes */
    126   bzero (buffer, 65536);
    127   Nline = 0;
     110  Noverlay = 0;
     111  NOVERLAY = 1000;
     112  ALLOCATE (overlay, KiiOverlay, NOVERLAY);
    128113
    129114  v00 = matrix;
     
    150135          LL;
    151136          DUMP;
     137          continue;
    152138        }
    153139        if ((d01 > 0) && (d11 <= 0)) { /* -  */
    154140          HZ;
    155141          DUMP;
     142          continue;
    156143        }
    157144        if ((d01 > 0) && (d11 > 0)) { /* /  */
    158145          UL;
    159146          DUMP;
     147          continue;
    160148        }
    161149        if ((d01 <= 0) && (d11 > 0)) { /* \\  */
    162150          LL;
    163           NUMP;
     151          DUMP;
    164152          UR;
    165153          DUMP;
     154          continue;
    166155        }
    167156      }
     
    171160          LL;
    172161          DUMP;
     162          continue;
    173163        }
    174164        if ((d01 <= 0) && (d11 > 0)) { /* -  */
    175165          HZ;
    176166          DUMP;
     167          continue;
    177168        }
    178169        if ((d01 <= 0) && (d11 <= 0)) { /* /  */
    179170          UL;
    180171          DUMP;
     172          continue;
    181173        }
    182174        if ((d01 > 0) && (d11 <= 0)) { /* //  */
    183175          UL;
    184           NUMP;
     176          DUMP;
    185177          LR;
    186178          DUMP;
     179          continue;
    187180        }
    188181      }
     
    193186          LR;
    194187          DUMP;
     188          continue;
    195189        }
    196190        if ((d01 <= 0) && (d11 > 0)) {
    197191          UR;
    198192          DUMP;
     193          continue;
    199194        }
    200195        if ((d01 > 0) && (d11 > 0)) {
    201196          VT;
    202197          DUMP;
     198          continue;
    203199        }
    204200      }
     
    208204          LR;
    209205          DUMP;
     206          continue;
    210207        }
    211208        if ((d01 > 0) && (d11 <= 0)) {
    212209          UR;
    213210          DUMP;
     211          continue;
    214212        }
    215213        if ((d01 <= 0) && (d11 <= 0)) {
    216214          VT;
    217215          DUMP;
     216          continue;
    218217        }
    219218      }
     
    235234    if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) {
    236235      x = i + (level - *v01)/(*v01 - *v00);
    237       NUMP;
     236      DUMP;
    238237    }
    239238  }
     
    248247    if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) {
    249248      x = i + (level - *v01)/(*v01 - *v00);
    250       NUMP;
     249      DUMP;
    251250    }
    252251  }
     
    261260    if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) {
    262261      y = j + (level - *v01)/(*v01 - *v00);
    263       NUMP;
     262      DUMP;
    264263    }
    265264  }
     
    274273    if (((*v00 > level) && (*v01 <= level)) || ((*v00 <= level) && (*v01 > level))) {
    275274      y = j + (level - *v01)/(*v01 - *v00);
    276       NUMP;
     275      DUMP;
    277276    }
    278277  }
    279278 
    280   if (Nline > 0) {
    281     SendGraphCommand (Ximage, 16, "NLINES  %7d ", Nline);
    282     write (Ximage, buffer, Nline*128);
    283   }
    284 
    285   free (buffer);
    286   SendGraphCommand (Ximage, 16, "DONE");
     279  KiiLoadOverlay (Ximage, overlay, Noverlay, argv[2]);
     280  free (overlay);
    287281
    288282  if (Npix != 1) free (matrix);
Note: See TracChangeset for help on using the changeset viewer.