IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13432


Ignore:
Timestamp:
May 18, 2007, 7:24:04 AM (19 years ago)
Author:
eugene
Message:

fixing style arguments, graphmode from kapa

Location:
branches/kapa-mods-2007-05/Ohana/src
Files:
2 added
48 edited

Legend:

Unmodified
Added
Removed
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/Makefile

    r13405 r13432  
    4949$(SRC)/Graphs.$(ARCH).o                   $(SRC)/SetGraphSize.$(ARCH).o       \
    5050$(SRC)/Resize.$(ARCH).o                   $(SRC)/ErasePlots.$(ARCH).o         \
    51 $(SRC)/EraseImage.$(ARCH).o         \
     51$(SRC)/EraseImage.$(ARCH).o               $(SRC)/SetToolbox.$(ARCH).o         \
    5252$(SRC)/EraseCurrentPlot.$(ARCH).o         $(SRC)/EraseSections.$(ARCH).o      \
    5353$(SRC)/SetSection.$(ARCH).o               $(SRC)/DefineSection.$(ARCH).o      \
     
    6565$(SRC)/CreatePicture.$(ARCH).o            $(SRC)/CreateColorbar.$(ARCH).o     \
    6666$(SRC)/MakeColormap.$(ARCH).o             $(SRC)/SetColormap.$(ARCH).o        \
    67 $(SRC)/PaintOverlay.$(ARCH).o             $(SRC)/PaintTickmarks.$(ARCH).o     \
     67$(SRC)/PaintOverlay.$(ARCH).o             $(SRC)/SetGraphStyle.$(ARCH).o      \
    6868$(SRC)/LoadOverlay.$(ARCH).o              $(SRC)/EraseOverlay.$(ARCH).o       \
    69 $(SRC)/LoadTickmarks.$(ARCH).o            $(SRC)/SaveOverlay.$(ARCH).o        \
     69$(SRC)/SaveOverlay.$(ARCH).o        \
    7070$(SRC)/CSaveOverlay.$(ARCH).o             $(SRC)/EraseOverlay.$(ARCH).o       \
    7171$(SRC)/CheckVisual.$(ARCH).o              $(SRC)/CursorOps.$(ARCH).o          \
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/include/prototypes.h

    r13404 r13432  
    6363int           EraseSections       PROTO((void));
    6464int           EraseImage          PROTO((void));
     65int           SetGraphStyle       PROTO((int sock));
     66int           GetGraphStyle       PROTO((int sock));
    6567
    6668int           LoadVectorData      PROTO((int sock, KapaGraphWidget *graph, int N, char *type));
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/include/structures.h

    r13401 r13432  
    9595  int Nobjects;
    9696  unsigned long color;
    97   Object *objects;
     97  KiiOverlay *objects;
    9898} Overlay;
    9999 
     
    116116  Axis      axis[4];    /* coordinate axes */
    117117  Label     label[8];   /* fixed axis labels */
     118  Graphdata style;      /* current graph style */
    118119
    119120  Gobjects *objects;    /* graphic objects */   
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CSaveOverlay.c

    r13344 r13432  
    33int CSaveOverlay (int sock) {
    44
    5   char filename[256];
     5  char filename[256], *type;
    66  int i, N;
    77  double ra, dec, ra1, dec1, x1, y1, dra, ddec;
     
    2323
    2424  for (i = 0; i < image[0].overlay[N].Nobjects; i++) {
    25     if (!strcmp (image[0].overlay[N].objects[i].type, "LINE")) {
     25    if (image[0].overlay[N].objects[i].type == KII_OVERLAY_LINE) {
    2626      XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].coords);
    2727      x1 = image[0].overlay[N].objects[i].x + image[0].overlay[N].objects[i].dx;
     
    4141      dra = cos (dec*RAD_DEG) * fabs (ra1 - ra);
    4242    }
    43     fprintf (f, "%s %lf %lf %lf %lf\n", image[0].overlay[N].objects[i].type, ra, dec, dra, ddec);
     43    type = KiiOverlayTypeByNumber (image[0].overlay[N].objects[i].type);
     44    if (type == NULL) continue;
     45    fprintf (f, "%s %lf %lf %lf %lf\n", type, ra, dec, dra, ddec);
    4446   }
    4547  fclose (f);
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c

    r13409 r13432  
    119119  }
    120120
    121   if (!strcmp (word, "LIMS")) {
     121  if (!strcmp (word, "GLIM")) {
    122122    GetLimits (sock);
    123123    KiiSendCommand (sock, 4, "DONE");
     
    127127  if (!strcmp (word, "SLIM")) {
    128128    status = SetLimits (sock);
     129    KiiSendCommand (sock, 4, "DONE");
     130    FINISHED (TRUE);
     131  }
     132 
     133  if (!strcmp (word, "GSTY")) {
     134    GetGraphStyle (sock);
     135    KiiSendCommand (sock, 4, "DONE");
     136    FINISHED (TRUE);
     137  }
     138 
     139  if (!strcmp (word, "SSTY")) {
     140    status = SetGraphStyle (sock);
     141    KiiSendCommand (sock, 4, "DONE");
     142    FINISHED (TRUE);
     143  }
     144 
     145  if (!strcmp (word, "TOOL")) {
     146    status = SetToolbox (sock);
    129147    KiiSendCommand (sock, 4, "DONE");
    130148    FINISHED (TRUE);
     
    208226  }
    209227
    210   /* this is not currently used?
    211      tickmarks were equivalent to the overlays, but fixed wrt the window.
    212      this functionality is probably supplanted by the graph
    213   if (!strcmp (word, "TICK")) {
    214     status = LoadTickmarks (sock);
    215     KiiSendCommand (sock, 4, "DONE");
    216     FINISHED (status);
    217   }
    218   */
    219 
    220228  if (!strcmp (word, "SAVE")) {
    221229    status = SaveOverlay (sock);
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseOverlay.c

    r13344 r13432  
    1717
    1818  if (N > NOVERLAYS) {
    19     REALLOCATE (image[0].tickmarks.objects, Object, 1);
     19    REALLOCATE (image[0].tickmarks.objects, KiiOverlay, 1);
    2020    image[0].tickmarks.Nobjects = 0;
    2121  } else {
    2222    for (i = 0; i < image[0].overlay[N].Nobjects; i++) {
    23       if (!strcmp (image[0].overlay[N].objects[i].type, "TEXT")) {
     23      if (image[0].overlay[N].objects[i].type == KII_OVERLAY_TEXT) {
    2424        free (image[0].overlay[N].objects[i].text);
    2525      }
    2626    }
    27     REALLOCATE (image[0].overlay[N].objects, Object, 1);
     27    REALLOCATE (image[0].overlay[N].objects, KiiOverlay, 1);
    2828    image[0].overlay[N].Nobjects = 0;
    2929    image[0].overlay[N].active = FALSE;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Image.c

    r13401 r13432  
    2121  image[0].start = 0;
    2222  image[0].slope = 1;
     23  image[0].location = 4;
    2324
    2425  image[0].coords.Npolyterms = 0;
    2526  for (i = 0; i < NOVERLAYS; i++) {
    2627    image[0].overlay[i].Nobjects = 0;
    27     ALLOCATE (image[0].overlay[i].objects, Object, 1);  /* allocate so later free will not crash! */
     28    ALLOCATE (image[0].overlay[i].objects, KiiOverlay, 1);  /* allocate so later free will not crash! */
    2829    image[0].overlay[i].active = FALSE;
    2930    image[0].overlay[i].color = graphic[0].overlay_color[i];
     
    111112    }
    112113  }
    113 # if (0)
    114   PaintTickmarks (graphic, image);
    115 # endif
    116114
    117115  if (image[0].location) {
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadObject.c

    r13409 r13432  
    106106int LoadVectorData (int sock, KapaGraphWidget *graph, int N, char *type) {
    107107 
    108   int Npts, Ninpts, status, Ntry;
     108  int i, Npts, Ninpts, status, Ntry;
    109109  int bytes_left;
    110   char *buff, type_send[16];
    111   int Npts_send, Nbytes_send;
    112 
    113   buff = NULL;
     110  char *byte, *buffer, type_send[16], tmp;
     111  int Npts_send, Nbytes_send, swap_client, swap_host;
     112
     113  buffer = NULL;
    114114  Npts = graph[0].objects[N].Npts;
    115115
    116116  KiiWaitAnswer (sock, "PLOB");
    117   KiiScanMessage (sock, "%s %d %d", type_send, &Npts_send, &Nbytes_send);
     117  KiiScanMessage (sock, "%s %d %d %d", type_send, &Npts_send, &Nbytes_send, &swap_client);
    118118  if (strcmp (type, type_send)) {
    119119    fprintf (stderr, "Kapa Communication error: unexpected data type %s vs %s\n", type_send, type);
     
    129129  if (!strcmp (type, "x")) {
    130130    ALLOCATE (graph[0].objects[N].x, float, MAX (1, Npts));
    131     buff = (char *) graph[0].objects[N].x;
     131    buffer = (char *) graph[0].objects[N].x;
    132132  }
    133133  if (!strcmp (type, "y")) {
    134134    ALLOCATE (graph[0].objects[N].y, float, MAX (1, Npts));
    135     buff = (char *) graph[0].objects[N].y;
     135    buffer = (char *) graph[0].objects[N].y;
    136136  }
    137137  if (!strcmp (type, "z")) {
    138138    ALLOCATE (graph[0].objects[N].z, float, MAX (1, Npts));
    139     buff = (char *) graph[0].objects[N].z;
     139    buffer = (char *) graph[0].objects[N].z;
    140140  }
    141141  if (!strcmp (type, "dxm")) {
    142142    ALLOCATE (graph[0].objects[N].dxm, float, MAX (1, Npts));
    143     buff = (char *) graph[0].objects[N].dxm;
     143    buffer = (char *) graph[0].objects[N].dxm;
    144144  }
    145145  if (!strcmp (type, "dxp")) {
    146146    ALLOCATE (graph[0].objects[N].dxp, float, MAX (1, Npts));
    147     buff = (char *) graph[0].objects[N].dxp;
     147    buffer = (char *) graph[0].objects[N].dxp;
    148148  }
    149149  if (!strcmp (type, "dym")) {
    150150    ALLOCATE (graph[0].objects[N].dym, float, MAX (1, Npts));
    151     buff = (char *) graph[0].objects[N].dym;
     151    buffer = (char *) graph[0].objects[N].dym;
    152152  }
    153153  if (!strcmp (type, "dyp")) {
    154154    ALLOCATE (graph[0].objects[N].dyp, float, MAX (1, Npts));
    155     buff = (char *) graph[0].objects[N].dyp;
     155    buffer = (char *) graph[0].objects[N].dyp;
    156156  }
    157157
     
    160160  fcntl (sock, F_SETFL, O_NONBLOCK); 
    161161
     162  // read the vector data as raw binary in client machine byte order (floats)
    162163  Ntry = 0;
    163164  if (DEBUG) fprintf (stderr, "starting vector load\n");
    164165  Ninpts = 0;
     166  byte = buffer;
    165167  while (bytes_left > 0) {
    166     status = read (sock, buff, bytes_left);
     168    status = read (sock, byte, bytes_left);
    167169    if (DEBUG) fprintf (stderr, "status: %d, %d\n", status, bytes_left);
    168170    if (status == 0) {  /* No more pipe */
     
    173175      Ninpts += status;
    174176      bytes_left -= status;
    175       buff = (char *)(buff + status);
     177      byte = (char *)(byte + status);
    176178      Ntry = 0;
    177179      continue;
     
    192194  KiiSendCommand (sock, 4, "DONE");
    193195
     196# ifdef BYTE_SWAP
     197  swap_host = 1;
     198# else
     199  swap_host = 0;
     200# endif 
     201
     202  // if host and client have opposite swap parities, word swap the incoming data
     203  // SWAP_WORD is strangely defined... it takes the number of the start byte in a
     204  // buffer called 'byte'
     205  if ((swap_host && !swap_client) || (!swap_host && swap_client)) {
     206    byte = buffer;
     207    for (i = 0; i < Nbytes_send; i+=4) {
     208      SWAP_WORD (i);
     209    }
     210  }
     211
    194212  if (Ninpts != Npts*sizeof(float)) { 
    195213    fprintf (stderr, "error: expected %d bytes, but got only %d\n", Ninpts, (unsigned int)(Npts*sizeof(float)));
     
    212230  if (object[0].dyp != (float *) NULL) free (object[0].dyp);
    213231}
    214 
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadOverlay.c

    r13409 r13432  
    11# include "Ximage.h"
    22
    3 // XXX this is a very inefficient method to send the data: binary would be better
    43int LoadOverlay (int sock) {
    54 
    6   char word[17], type[16], string[128];
    7   char *buffer, *buff;
    8   double x, y, dx, dy;
    9   int Nin, bytes, status;
    10   int i, N, NOBJECTS, Nobjects, Nstart;
     5  int i, j, Ntotal, Nbytes, Nread, Nfound, Ntext, Nobjects, overnum;
     6  int Noverlay, NOVERLAY, Ntextdata;
     7  char *textdata, *buffer, *p, *q;
    118  Section *section;
    129  KapaImageWidget *image;
    1310  Graphic *graphic;
     11  KiiOverlayBase *overlay;
    1412
    1513  graphic = GetGraphic ();
     
    1917    SetSectionSizes (section);
    2018  }
    21   image   = section->image;
     19  image = section->image;
    2220
    23   ALLOCATE (buffer, char, 65536);  /* space for 512 lines of 128 bytes */
    24   bzero (buffer, 65536);
     21  KiiScanMessage (sock, "%d %d %d %d", &overnum, &Noverlay, &Ntext, &Ntextdata);
    2522
    26   KiiScanCommand (sock, 16, "%*s %d", &N);
    27   Nstart = image[0].overlay[N].Nobjects;
     23  // XXX need to validate overnum
     24  if ((overnum < 0) || (overnum >= NOVERLAYS)) overnum = 0;
    2825
    29   while (1) {
    30     KiiScanCommand (sock, 16, "%s %d", word, &Nin);
    31     if (!strcmp (word, "DONE")) break;
    32     if (strcmp (word, "NLINES")) abort();
     26  // read the overlay data as binary
     27  Ntotal = 0;
     28  Nbytes = Noverlay*sizeof(KiiOverlayBase);
     29  fcntl (sock, F_SETFL, O_NONBLOCK); 
     30  ALLOCATE (overlay, KiiOverlayBase, Noverlay);
     31  buffer = (char *) overlay;
     32  while (Nbytes > 0) {
     33    Nread = read (sock, &buffer[Ntotal], Nbytes);
     34    // fprintf (stderr, "read: %d of %d remaining, %d so far, %d expected\n", Nread, Nbytes, Ntotal, Noverlay*sizeof(KiiOverlayBase));
     35    if (Nread == 0) {  /* No more pipe */
     36      fprintf (stderr, "error: pipe closed\n");
     37      free (overlay);
     38      fcntl (sock, F_SETFL, !O_NONBLOCK); 
     39      return (FALSE);
     40    }
     41    if (Nread != -1) { /* pipe has data */
     42      Nbytes -= Nread;
     43      Ntotal += Nread;
     44    }
     45  }
     46  fcntl (sock, F_SETFL, !O_NONBLOCK); 
     47  KiiSendCommand (sock,  4, "DONE");
    3348
    34     buff = buffer;
    35     bytes = 128*Nin;
     49  // read the textdata as binary
     50  Ntotal = 0;
     51  Nbytes = Ntextdata;
     52  fcntl (sock, F_SETFL, O_NONBLOCK); 
     53  ALLOCATE (textdata, char, Ntextdata);
     54  while (Nbytes > 0) {
     55    Nread = read (sock, &textdata[Ntotal], Nbytes);
     56    if (Nread == 0) {  /* No more pipe */
     57      fprintf (stderr, "error: pipe closed\n");
     58      free (textdata);
     59      free (overlay);
     60      fcntl (sock, F_SETFL, !O_NONBLOCK); 
     61      return (FALSE);
     62    }
     63    if (Nread != -1) { /* pipe has data */
     64      Nbytes -= Nread;
     65      Ntotal += Nread;
     66    }
     67  }
     68  fcntl (sock, F_SETFL, !O_NONBLOCK); 
     69  KiiSendCommand (sock,  4, "DONE");
    3670
    37     /* accept data from the socket until we have all of the bytes */
    38     fcntl (sock, F_SETFL, O_NONBLOCK); 
    39     while (bytes > 0) {
    40       status = read (sock, buff, bytes);
    41       if (status == 0) {  /* No more pipe */
    42         fprintf (stderr, "error: pipe closed\n");
    43         free (buffer);
    44         fcntl (sock, F_SETFL, !O_NONBLOCK); 
    45         return (FALSE);
    46       }
    47       if (status != -1) { /* pipe has data */
    48         bytes -= status;
    49         buff = (char *)(buff + status);
    50       }
    51     }
    52     fcntl (sock, F_SETFL, !O_NONBLOCK); 
     71  // add new overlay objects to existing data
     72  Nobjects = image[0].overlay[overnum].Nobjects + Noverlay;
     73  REALLOCATE (image[0].overlay[overnum].objects, KiiOverlay, Nobjects);
    5374
    54     /* parse buffer data */
    55     NOBJECTS = image[0].overlay[N].Nobjects + Nin;
    56     Nobjects = image[0].overlay[N].Nobjects;
    57     REALLOCATE (image[0].overlay[N].objects, Object, NOBJECTS);
    58     for (i = 0; i < Nin; i++) {
    59       sscanf (&buffer[i*128], "%s %lf %lf %lf %lf\n", type, &x, &y, &dx, &dy);
    60 
    61       if (strcasecmp (type, "TEXT") && strcasecmp (type, "LINE") && strcasecmp (type, "BOX") && strcasecmp (type, "CIRCLE")) {  /* skip */
    62         fprintf (stderr, "don't know %s, skipping\n", type);
    63         continue;
    64       }
    65 
    66       if (!strcasecmp (type, "TEXT")) { /* end of objects */
    67         sscanf (&buffer[i*128], "%s %lf %lf %s\n", type, &x, &y, string);
    68       }
    69        
    70       strcpy (image[0].overlay[N].objects[Nobjects].type, type);
    71       image[0].overlay[N].objects[Nobjects].x = x;
    72       image[0].overlay[N].objects[Nobjects].y = y;
    73       if (!strcmp (type, "TEXT")) {
    74         image[0].overlay[N].objects[Nobjects].dx = 0;
    75         image[0].overlay[N].objects[Nobjects].dy = 0;
    76         image[0].overlay[N].objects[Nobjects].text = strcreate (string);
    77       } else {
    78         image[0].overlay[N].objects[Nobjects].dx = dx;
    79         image[0].overlay[N].objects[Nobjects].dy = dy;
    80       }
    81       Nobjects++;
    82     }
    83     REALLOCATE (image[0].overlay[N].objects, Object, MAX(Nobjects, 1));
    84     image[0].overlay[N].Nobjects = Nobjects;
     75  j = image[0].overlay[overnum].Nobjects;
     76  for (i = 0; i < Noverlay; i++, j++) {
     77    image[0].overlay[overnum].objects[j].x = overlay[i].x;
     78    image[0].overlay[overnum].objects[j].y = overlay[i].y;
     79    image[0].overlay[overnum].objects[j].dx = overlay[i].dx;
     80    image[0].overlay[overnum].objects[j].dy = overlay[i].dy;
     81    image[0].overlay[overnum].objects[j].type = overlay[i].type;
     82    image[0].overlay[overnum].objects[j].text = NULL;
    8583  }
    8684
    87   /* cleanup */
    88   free (buffer);
    89   REALLOCATE (image[0].overlay[N].objects, Object, MAX (1, image[0].overlay[N].Nobjects));
    90   image[0].overlay[N].active = TRUE;
     85  // parse the text data : text lines are separated by '\n', one per text entry
     86  p = textdata;
     87  Nfound = 0;
     88  for (i = 0; i < Noverlay; i++) {
     89    if (overlay[i].type != KII_OVERLAY_TEXT) continue;
     90    if (Nfound >= Ntext) {
     91      fprintf (stderr, "inconsistent number of text lines\n");
     92      break;
     93    }
     94    if (! *p) {
     95      fprintf (stderr, "inconsistent number of text lines\n");
     96      break;
     97    }
     98    q = strchr (p, '\n');
     99    if (q == NULL) {
     100      fprintf (stderr, "inconsistent text line\n");
     101      break;
     102    }
     103    j = image[0].overlay[overnum].Nobjects + i;
     104    image[0].overlay[overnum].objects[j].text = strncreate (p, q-p);
     105    p = q + 1;
     106    Nfound ++;
     107  }
     108  if (Nfound != Ntext) {
     109    fprintf (stderr, "read %d text lines, expected %d\n", Nfound, Ntext);
     110  }
     111
     112  free (textdata);
     113  free (overlay);
     114
     115  image[0].overlay[overnum].Nobjects = Nobjects;
     116  image[0].overlay[overnum].active = TRUE;
    91117
    92118  if (USE_XWINDOW) {
     
    96122      }
    97123    }
    98     PaintTickmarks (graphic, image);
    99124    XFlush (graphic[0].display);
    100125  }
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTickmarks.c

    r13409 r13432  
    1818  Nobjects = image[0].tickmarks.Nobjects;
    1919  NOBJECTS = Nobjects + 100;
    20   REALLOCATE (image[0].tickmarks.objects, Object, NOBJECTS);
     20  REALLOCATE (image[0].tickmarks.objects, KiiOverlay, NOBJECTS);
    2121 
    2222  done = FALSE;
     
    5454    if (Nobjects >= NOBJECTS) {
    5555      NOBJECTS = Nobjects + 100;
    56       REALLOCATE (image[0].tickmarks.objects, Object, NOBJECTS);
     56      REALLOCATE (image[0].tickmarks.objects, KiiOverlay, NOBJECTS);
    5757    }
    5858
    5959  }
    6060
    61   REALLOCATE (image[0].tickmarks.objects, Object, MAX(Nobjects, 1));
     61  REALLOCATE (image[0].tickmarks.objects, KiiOverlay, MAX(Nobjects, 1));
    6262  image[0].tickmarks.Nobjects = Nobjects;
    6363
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PSOverlay.c

    r13331 r13432  
    3131    dY = (image[0].overlay[N].objects[i].dy)/expand;
    3232   
    33     if (!strcmp (image[0].overlay[N].objects[i].type, "LINE")) {
    34       if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) ||
    35           ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) {
    36         continue;
    37       }
    38       fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", X + extra, Y + extra, (X+dX + extra), (Y-dY + extra));
    39       continue;
     33    switch (image[0].overlay[N].objects[i].type) {
     34      case KII_OVERLAY_LINE:
     35        if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) ||
     36            ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) {
     37          break;
     38        }
     39        fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", X + extra, Y + extra, (X+dX + extra), (Y-dY + extra));
     40        break;
     41      case KII_OVERLAY_TEXT:
     42        if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) ||
     43            ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) {
     44          break;
     45        }
     46        fprintf (f, "(%s) %6.1f %6.1f T\n", image[0].overlay[N].objects[i].text, X + extra, Y + extra);
     47        break;
     48      case KII_OVERLAY_BOX:
     49        if (((X - 0.5*dX < Xmin) && (X + 0.5*dX < Xmin)) || ((X - 0.5*dX > Xmax) && (X + 0.5*dX > Xmax)) ||
     50            ((Y - 0.5*dY < Ymin) && (Y + 0.5*dY < Ymin)) || ((Y - 0.5*dY > Ymax) && (Y + 0.5*dY > Ymax))) {
     51          break;
     52        }
     53        fprintf (f, " %6.1f %6.1f %6.1f %6.1f B\n", (dX + 2*extra), (dY + 2*extra), (X - 0.5*dX - extra), (Y - 0.5*dY - extra));
     54        break;
     55      case KII_OVERLAY_CIRCLE:
     56        if (((X - dX < Xmin) && (X + dX < Xmin)) || ((X - dX > Xmax) && (X + dX > Xmax)) ||
     57            ((Y - dY < Ymin) && (Y + dY < Ymin)) || ((Y - dY > Ymax) && (Y + dY > Ymax))) {
     58          break;
     59        }
     60        fprintf (f, " %6.1f %6.1f %6.1f C\n", X, Y, fabs(dX + extra));
     61        break;
     62      default:
     63        fprintf (stderr, "skipping unknown object\n");
     64        break;
    4065    }
    41     if (!strcmp (image[0].overlay[N].objects[i].type, "TEXT")) {
    42       if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) ||
    43           ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) {
    44         continue;
    45       }
    46       fprintf (f, "(%s) %6.1f %6.1f T\n", image[0].overlay[N].objects[i].text, X + extra, Y + extra);
    47       continue;
    48     }
    49     if (!strcmp (image[0].overlay[N].objects[i].type, "BOX")) {
    50       if (((X - 0.5*dX < Xmin) && (X + 0.5*dX < Xmin)) || ((X - 0.5*dX > Xmax) && (X + 0.5*dX > Xmax)) ||
    51           ((Y - 0.5*dY < Ymin) && (Y + 0.5*dY < Ymin)) || ((Y - 0.5*dY > Ymax) && (Y + 0.5*dY > Ymax))) {
    52         continue;
    53       }
    54       fprintf (f, " %6.1f %6.1f %6.1f %6.1f B\n", (dX + 2*extra), (dY + 2*extra), (X - 0.5*dX - extra), (Y - 0.5*dY - extra));
    55       continue;
    56     }
    57     if (!strcmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {
    58       if (((X - dX < Xmin) && (X + dX < Xmin)) || ((X - dX > Xmax) && (X + dX > Xmax)) ||
    59           ((Y - dY < Ymin) && (Y + dY < Ymin)) || ((Y - dY > Ymax) && (Y + dY > Ymax))) {
    60         continue;
    61       }
    62       fprintf (f, " %6.1f %6.1f %6.1f C\n", X, Y, fabs(dX + extra));
    63       continue;
    64     }
    65     fprintf (stderr, "don't know %s, skipping\n", image[0].overlay[N].objects[i].type);
    6666  }
    67  
    6867}
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PaintOverlay.c

    r13320 r13432  
    4141       for a BOX (x, y) is the center, (dx, dy) is the width */
    4242
    43     if (!strcasecmp (image[0].overlay[N].objects[i].type, "LINE")) {
    44       XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY));
    45       continue;
     43    switch (image[0].overlay[N].objects[i].type) {
     44      case KII_OVERLAY_LINE:
     45        XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY));
     46        break;
     47      case KII_OVERLAY_TEXT:
     48        XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].overlay[N].objects[i].text, strlen(image[0].overlay[N].objects[i].text));
     49        break;
     50      case KII_OVERLAY_BOX:
     51        dx = MAX (abs(dX),2) / 2;
     52        dy = MAX (abs(dY),2) / 2;
     53        XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy);
     54        break;
     55      case KII_OVERLAY_CIRCLE:
     56        dx = MAX (abs(dX),2);
     57        dy = MAX (abs(dY),2);
     58        XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy, 0, 23040);
     59        break;
     60      default:
     61        fprintf (stderr, "skipping unknown object\n");
     62        break;
    4663    }
    47     if (!strcasecmp (image[0].overlay[N].objects[i].type, "TEXT")) {
    48       XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].overlay[N].objects[i].text, strlen(image[0].overlay[N].objects[i].text));
    49       continue;
    50     }
    51     if (!strcasecmp (image[0].overlay[N].objects[i].type, "BOX")) {
    52       dx = MAX (abs(dX),2) / 2;
    53       dy = MAX (abs(dY),2) / 2;
    54       XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy);
    55        continue;
    56     }
    57     if (!strcasecmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {
    58       dx = MAX (abs(dX),2);
    59       dy = MAX (abs(dY),2);
    60       XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy, 0, 23040);
    61       continue;
    62     }
    63     fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].overlay[N].objects[i].type);
    6464  }
    6565 
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PaintTickmarks.c

    r13320 r13432  
    2222    dY = image[0].tickmarks.objects[i].dy * Yrange;
    2323
    24     if (!strcmp (image[0].tickmarks.objects[i].type, "LINE")) {
    25       XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY));
    26       continue;
     24    switch (image[0].overlay[0].objects[i].type) {
     25      case KII_OVERLAY_LINE:
     26        XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY));
     27        break;
     28      case KII_OVERLAY_TEXT:
     29        if (image[0].tickmarks.objects[i].dy == 0) {
     30            XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);
     31            XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-11, 6*strlen(image[0].tickmarks.objects[i].text), 11);
     32            XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);
     33            XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text));
     34        }
     35        if (image[0].tickmarks.objects[i].dy == 90) {
     36            XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);
     37            XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-6*strlen(image[0].tickmarks.objects[i].text), 11, 6*strlen(image[0].tickmarks.objects[i].text));
     38            XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);
     39            /* XDrawRotString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); */
     40        }
     41        break;
     42      case KII_OVERLAY_BOX:
     43        XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (int)(X - 0.5*dX), (int)(Y - 0.5*dY), abs(dX), abs(dY));
     44        break;
     45      case KII_OVERLAY_CIRCLE:
     46        XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, X - dX, Y - dY, abs(2*dX), abs(2*dY), 0, 23040);
     47        break;
     48      default:
     49        fprintf (stderr, "skipping unknown object\n");
     50        break;
    2751    }
    28     if (!strcmp (image[0].tickmarks.objects[i].type, "TEXT")) {
    29       if (image[0].tickmarks.objects[i].dy == 0) {
    30         XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);
    31         XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-11, 6*strlen(image[0].tickmarks.objects[i].text), 11);
    32         XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);
    33         XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text));
    34       }
    35       if (image[0].tickmarks.objects[i].dy == 90) {
    36         XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);
    37         XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-6*strlen(image[0].tickmarks.objects[i].text), 11, 6*strlen(image[0].tickmarks.objects[i].text));
    38         XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);
    39         /* XDrawRotString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); */
    40       }
    41       continue;
    42     }
    43     if (!strcmp (image[0].tickmarks.objects[i].type, "BOX")) {
    44       XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (int)(X - 0.5*dX), (int)(Y - 0.5*dY), abs(dX), abs(dY));
    45        continue;
    46     }
    47     if (!strcmp (image[0].tickmarks.objects[i].type, "CIRCLE")) {
    48       XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, X - dX, Y - dY, abs(2*dX), abs(2*dY), 0, 23040);
    49       continue;
    50     }
    51     fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].tickmarks.objects[i].type);
    5252  }
    53  
    5453  XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);
    55 
    5654}
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SaveOverlay.c

    r13344 r13432  
    44
    55  int i, N;
    6   char filename[256];
     6  char filename[256], *type;
    77  FILE *f;
    88  Section *section;
     
    2222
    2323  for (i = 0; i < image[0].overlay[N].Nobjects; i++) {
     24    type = KiiOverlayTypeByNumber (image[0].overlay[N].objects[i].type);
     25    if (type == NULL) continue;
    2426    fprintf (f, "%s %lf %lf %lf %lf\n",
    25              image[0].overlay[N].objects[i].type,
     27             type,
    2628             image[0].overlay[N].objects[i].x,
    2729             image[0].overlay[N].objects[i].y,
     
    3234  return (TRUE);
    3335}
     36
     37/* this is asymmetric with LoadOverlay.c.  In that case, the client reads the file and sends
     38 * the overlay objects to kapa.  In this case, kapa writes the file directly...
     39 */
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Sections.c

    r13405 r13432  
    176176      tmpSection = sections[N];
    177177      sections[N] = sections[N+1];
    178       sections[N] = tmpSection;
     178      sections[N+1] = tmpSection;
    179179      Refresh (1);
    180180      return (TRUE);
     
    186186      tmpSection = sections[N];
    187187      sections[N] = sections[N-1];
    188       sections[N] = tmpSection;
     188      sections[N-1] = tmpSection;
    189189      Refresh (1);
    190190      return (TRUE);
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetImageSize.c

    r13401 r13432  
    2525  dX = graphic[0].dx * section[0].dx;
    2626  dY = graphic[0].dy * section[0].dy;
    27 
    28   // XXX make this user-setable
    29   image[0].location = 0;
    3027
    3128  switch (image[0].location) {
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/bDrawOverlay.c

    r13320 r13432  
    2424  }
    2525  /*
    26   X = 0.5*image[0].matrix.Naxis[0] - expand*((int)(0.5*image[0].picture.dx + 0.5) - 0.0) - image[0].X;
    27   Y = 0.5*image[0].matrix.Naxis[1] - expand*((int)(0.5*image[0].picture.dy + 0.5) - 0.0) - image[0].Y; 
    28   X0 =  (image[0].X + 1 - (int)(0.5*image[0].matrix.Naxis[0] + 0.5) - X + (int)X)/expand + image[0].picture.x + 0.5*image[0].picture.dx;
    29   Y0 =  (image[0].Y + 1 - (int)(0.5*image[0].matrix.Naxis[1] + 0.5) - Y + (int)Y)/expand + image[0].picture.y + 0.5*image[0].picture.dy;
     26     X = 0.5*image[0].matrix.Naxis[0] - expand*((int)(0.5*image[0].picture.dx + 0.5) - 0.0) - image[0].X;
     27     Y = 0.5*image[0].matrix.Naxis[1] - expand*((int)(0.5*image[0].picture.dy + 0.5) - 0.0) - image[0].Y; 
     28     X0 =  (image[0].X + 1 - (int)(0.5*image[0].matrix.Naxis[0] + 0.5) - X + (int)X)/expand + image[0].picture.x + 0.5*image[0].picture.dx;
     29     Y0 =  (image[0].Y + 1 - (int)(0.5*image[0].matrix.Naxis[1] + 0.5) - Y + (int)Y)/expand + image[0].picture.y + 0.5*image[0].picture.dy;
    3030  */
    3131
     
    6262       for a BOX (x, y) is the center, (dx, dy) is the width */
    6363
    64     if (!strcasecmp (image[0].overlay[N].objects[i].type, "LINE")) {
    65       bDrawLine (X, Y, (X+dX), (Y+dY));
    66       continue;
     64    switch (image[0].overlay[N].objects[i].type) {
     65      case KII_OVERLAY_LINE:
     66        bDrawLine (X, Y, (X+dX), (Y+dY));
     67        break;
     68      case KII_OVERLAY_TEXT:
     69        bDrawRotText (X, Y, image[0].overlay[N].objects[i].text, 8, 0.0);
     70        break;
     71      case KII_OVERLAY_BOX:
     72        dx = MAX (abs(dX),2) / 2;
     73        dy = MAX (abs(dY),2) / 2;
     74        bDrawRectOpen ((X-dx), (Y-dy), (X+dx), (Y+dy));
     75        // bDrawRectOpen ((X-dx), (Y-dy), (X), (Y));
     76        break;
     77      case KII_OVERLAY_CIRCLE:
     78        dx = MAX (abs(dX),2);
     79        dy = MAX (abs(dY),2);
     80        bDrawArc (X, Y, dx, dy, 0, 360);
     81        break;
     82      default:
     83        fprintf (stderr, "skipping unknown object\n");
     84        break;
    6785    }
    68     if (!strcasecmp (image[0].overlay[N].objects[i].type, "TEXT")) {
    69       bDrawRotText (X, Y, image[0].overlay[N].objects[i].text, 8, 0.0);
    70       continue;
    71     }
    72     if (!strcasecmp (image[0].overlay[N].objects[i].type, "BOX")) {
    73       dx = MAX (abs(dX),2) / 2;
    74       dy = MAX (abs(dY),2) / 2;
    75       bDrawRectOpen ((X-dx), (Y-dy), (X+dx), (Y+dy));
    76       // bDrawRectOpen ((X-dx), (Y-dy), (X), (Y));
    77        continue;
    78     }
    79     if (!strcasecmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {
    80       dx = MAX (abs(dX),2);
    81       dy = MAX (abs(dY),2);
    82       bDrawArc (X, Y, dx, dy, 0, 360);
    83       continue;
    84     }
    85     fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].overlay[N].objects[i].type);
    8686  }
    8787 
  • branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h

    r13409 r13432  
    2929  int logflux;
    3030} KiiDisplayMode;
     31
     32typedef struct {
     33  float x;
     34  float y;
     35  float dx;
     36  float dy;
     37  int type;
     38} KiiOverlayBase;
    3139
    3240typedef struct {
     
    156164int KapaGetSection (int fd, char *name);
    157165int KapaMoveSection (int fd, char *name, char *direction);
     166int KapaSetGraphStyle (int fd, Graphdata *graphmode);
     167int KapaGetGraphStyle (int fd, Graphdata *graphmode);
    158168
    159169/* KapaColors */
  • branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KapaWindow.c

    r13409 r13432  
    5353 
    5454  KiiSendCommand (fd, 4, "ERSI");
     55  KiiWaitAnswer (fd, "DONE");
     56  return (TRUE);
     57}
     58
     59int KapaSetToolbox (int fd, int location) {
     60 
     61  KiiSendCommand (fd, 4, "TOOL");
     62  KiiSendMessage (fd, "%d", location);
    5563  KiiWaitAnswer (fd, "DONE");
    5664  return (TRUE);
     
    101109}
    102110
     111int KapaSetGraphStyle (int fd, Graphdata *graphmode) {
     112
     113  /* tell kapa to look for the incoming image */
     114  KiiSendCommand (fd, 4, "SSTY");
     115 
     116  /* send Xgraph the plot details */
     117  KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f",
     118                  graphmode[0].style,
     119                  graphmode[0].ptype, graphmode[0].ltype,
     120                  graphmode[0].etype, graphmode[0].ebar, graphmode[0].color,
     121                  graphmode[0].lweight, graphmode[0].size);
     122  KiiSendMessage (fd, "%g %g %g %g",
     123                  graphmode[0].xmin, graphmode[0].xmax,
     124                  graphmode[0].ymin, graphmode[0].ymax);
     125  KiiWaitAnswer (fd, "DONE");
     126  return (TRUE);
     127}
     128
     129int KapaGetGraphStyle (int fd, Graphdata *graphmode) {
     130
     131  /* tell kapa to look for the incoming image */
     132  KiiSendCommand (fd, 4, "GSTY");
     133 
     134  /* send Xgraph the plot details */
     135  KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf",
     136                  &graphmode[0].style,
     137                  &graphmode[0].ptype, &graphmode[0].ltype,
     138                  &graphmode[0].etype, &graphmode[0].ebar, &graphmode[0].color,
     139                  &graphmode[0].lweight, &graphmode[0].size);
     140  KiiScanMessage (fd, "%lf %lf %lf %lf",
     141                  &graphmode[0].xmin, &graphmode[0].xmax,
     142                  &graphmode[0].ymin, &graphmode[0].ymax);
     143  KiiWaitAnswer (fd, "DONE");
     144  return (TRUE);
     145}
     146
    103147int KapaPlotVector (int fd, int Npts, float *values, char *type) {
    104148
    105149  int Nbytes;
     150  int swap;
     151
     152# ifdef BYTE_SWAP
     153  swap = 1;
     154# else
     155  swap = 0;
     156# endif
    106157
    107158  Nbytes = Npts * sizeof (float);
     
    118169valid:
    119170  KiiSendCommand (fd, 4, "PLOB");
    120   KiiSendMessage (fd, "%s %d %d", type, Npts, Nbytes);
    121   // XXX send the byte-swap as well...
     171  KiiSendMessage (fd, "%s %d %d %d", type, Npts, Nbytes, swap);
    122172
    123173  write (fd, values, Nbytes);
     
    164214int KapaGetLimits (int fd, float *dx, float *dy) {
    165215
    166   KiiSendCommand (fd, 4, "LIMS");
     216  KiiSendCommand (fd, 4, "GLIM");
    167217  KiiScanMessage (fd, "%lf %lf", dx, dy);
    168218  KiiWaitAnswer (fd, "DONE");
  • branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KiiOverlay.c

    r13409 r13432  
    5050}
    5151
    52 int KiiLoadOverlay (int fd, KiiOverlay *overlay, int Noverlay, char *overname) {
     52int KiiLoadOverlayOld (int fd, KiiOverlay *overlay, int Noverlay, char *overname) {
    5353
    5454  int i, n, Nline;
     
    9393}
    9494
     95int KiiLoadOverlay (int fd, KiiOverlay *overlay, int Noverlay, char *overname) {
     96
     97  int i, overnum, Ntextdata, NTEXTDATA, Ntext, Nchar;
     98  char *textdata;
     99  KiiOverlayBase *buffer;
     100
     101  Ntext = 0;
     102  KiiSelectOverlay (overname, &overnum);
     103
     104  Ntextdata = 0;
     105  NTEXTDATA = 1024;
     106  ALLOCATE (textdata, char, 1024);
     107
     108  // we send the position information as a binary block
     109  ALLOCATE (buffer, KiiOverlayBase, Noverlay);
     110  for (i = 0; i < Noverlay; i++) {
     111    buffer[i].x    = overlay[i].x;
     112    buffer[i].y    = overlay[i].y;
     113    buffer[i].dx   = overlay[i].dx;
     114    buffer[i].dy   = overlay[i].dy;
     115    buffer[i].type = overlay[i].type;
     116    if (buffer[i].type == KII_OVERLAY_TEXT) {
     117      Ntext ++;
     118      Nchar = strlen(overlay[i].text) + 1;
     119      if (Ntextdata + Nchar >= NTEXTDATA) {
     120        NTEXTDATA += 1024;
     121        REALLOCATE (textdata, char, NTEXTDATA);
     122      }
     123      sprintf (&textdata[Ntextdata], "%s\n", overlay[i].text);
     124      Ntextdata += Nchar;
     125    }
     126  }
     127
     128  KiiSendCommand (fd,  4, "LOAD");
     129  KiiSendMessage (fd, "%d %d %d %d", overnum, Noverlay, Ntext, Ntextdata);
     130
     131  // we could break this into segments if we want to trap an interrupt, but why bother?
     132  Nchar = write (fd, buffer, Noverlay*sizeof(KiiOverlayBase));
     133  fprintf (stderr, "sent %d of %d bytes\n", Nchar, Noverlay*sizeof(KiiOverlayBase));
     134  KiiWaitAnswer (fd, "DONE");
     135
     136  write (fd, textdata, Ntextdata);
     137  KiiWaitAnswer (fd, "DONE");
     138
     139  free (buffer);
     140  free (textdata);
     141
     142  KiiWaitAnswer (fd, "DONE");
     143  return (TRUE);
     144}
     145
    95146int KiiEraseOverlay (int fd, char *overname) {
    96147
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/cgrid.c

    r13409 r13432  
    1414  double x, y;
    1515  Vector Xvec, Yvec;
    16   int NorthPole, SouthPole, N, OnPic, LOnPic, status, NELEMENTS, First;
     16  int kapa, NorthPole, SouthPole, N, OnPic, LOnPic, status, NELEMENTS, First;
    1717  Graphdata graphmode;
    1818
    19   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     19  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    2020
    2121  if (argc != 1) {
     
    2323    return (FALSE);
    2424  }
    25   SetGraph (graphmode);
    2625
    2726  /* are we plotting one of the poles? */
     
    392391  graphmode.ptype = 100; /* connect a pair */
    393392  graphmode.etype = 0;
    394   PrepPlotting (N, &graphmode);
    395   PlotVector (N, Xvec.elements, "x");
    396   PlotVector (N, Yvec.elements, "y");
     393  PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    397394
    398395  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/cplot.c

    r13409 r13432  
    33int cplot (int argc, char **argv) {
    44 
    5   int i, Npts, status;
     5  int i, kapa, Npts, status;
    66  float *x, *y, *r, *d, Rmin, Rmax;
    77  Vector Xvec, Yvec, *xvec, *yvec;
    88  Graphdata graphmode;
    99
    10   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     10  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    1111
    1212  if (argc != 3) {
     
    1414    return (FALSE);
    1515  }
    16   SetGraph (graphmode);
    1716
    1817  Rmin = graphmode.coords.crval1 - 182.0;
     
    6766
    6867  graphmode.etype = 0;
    69   PrepPlotting (Npts, &graphmode);
    70   PlotVector (Npts, Xvec.elements, "x");
    71   PlotVector (Npts, Yvec.elements, "y");
     68  PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode);
    7269 
    7370  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/czplot.c

    r13409 r13432  
    33int czplot (int argc, char **argv) {
    44 
    5   int i, Npts;
     5  int i, kapa, Npts;
    66  double min, range, Rmin, Rmax;
    77  float *in, *out, *r, *d, *x, *y;
     
    99  Graphdata graphmode;
    1010
    11   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     11  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    1212
    1313  if (argc != 6) {
     
    1515    return (FALSE);
    1616  }
    17   SetGraph (graphmode);
    1817
    1918  min = atof(argv[4]);
     
    5958  graphmode.etype = 0;
    6059  Npts = Xvec.Nelements;
    61   PrepPlotting (Npts, &graphmode);
    62 
    63   PlotVector (Npts, Xvec.elements, "x");
    64   PlotVector (Npts, Yvec.elements, "y");
    65   PlotVector (Npts, Zvec.elements, "z");
     60  PlotVectorTriplet (kapa, Npts, Xvec.elements, Yvec.elements, Zvec.elements, &graphmode);
    6661
    6762  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/region.c

    r13404 r13432  
    114114  KapaSendLabel (kapa, string, 2);
    115115
    116   SetGraph (graphmode);
     116  // XXX is this the right thing to be doing?
     117  SetGraph (&graphmode);
    117118  return (TRUE);
    118119}
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/dot.c

    r13409 r13432  
    33int dot (int argc, char **argv) {
    44 
     5  int kapa;
    56  Graphdata graphmode;
    67  float x, y;
    78
    8   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     9  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    910
    1011  if (argc != 3) {
     
    1516  y = atof(argv[2]);
    1617
    17   /* set plotting options (these are sticky) */
    18   SetGraph (graphmode);
    19 
    2018  /* set point style and errorbar mode (these are NOT sticky) */
    2119  graphmode.style = 2;
    2220  graphmode.etype = 0;
    2321
    24   if (!PrepPlotting (1, &graphmode)) return (FALSE);
    25  
    26   PlotVector (1, &x, "x");
    27   PlotVector (1, &y, "y");
     22  if (!KapaPrepPlot (kapa, 1, &graphmode)) return (FALSE);
     23  KapaPlotVector (kapa, 1, &x, "x");
     24  KapaPlotVector (kapa, 1, &y, "y");
    2825 
    2926  return (TRUE);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/grid.c

    r13409 r13432  
    33int grid (int argc, char **argv) {
    44 
    5   int j, N, MinorTick, MajorTick;
     5  int j, kapa, N, MinorTick, MajorTick;
    66  Vector Xvec, Yvec;
    77  double range, lrange, factor, mantis, fmantis, power, major, minor, first, next;
    88  Graphdata graphmode;
    99
    10   if (!style_args (&graphmode, &argc, argv, NULL)) return (FALSE);
     10  if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE);
    1111
    1212  MajorTick = TRUE;
     
    193193  graphmode.ptype = 100; /* connect a pair */
    194194  graphmode.etype = 0;
    195   PrepPlotting (N, &graphmode);
    196   PlotVector (N, Xvec.elements, "x");
    197   PlotVector (N, Yvec.elements, "y");
     195  PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    198196
    199197  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/line.c

    r13409 r13432  
    33int line (int argc, char **argv) {
    44 
     5  int kapa;
    56  Graphdata graphmode;
    67  float x[2], y[2];
    78
    8   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     9  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    910
    1011  if (argc != 6) {
     
    1718  y[1] = atof(argv[5]);
    1819
    19   SetGraph (graphmode);
    20 
    2120  /* set point style and errorbar mode (these are NOT sticky) */
    2221  graphmode.style = 0;
    2322  graphmode.etype = 0;
    2423
    25   if (!PrepPlotting (2, &graphmode)) return (FALSE);
    26  
    27   PlotVector (2, x, "x");
    28   PlotVector (2, y, "y");
     24  if (!KapaPrepPlot (kapa, 2, &graphmode)) return (FALSE);
     25  KapaPlotVector (kapa, 2, x, "x");
     26  KapaPlotVector (kapa, 2, y, "y");
    2927 
    3028  return (TRUE);
    31 
    3229}
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/plot.c

    r13409 r13432  
    33int plot (int argc, char **argv) {
    44 
    5   int N, Npts;
     5  int kapa, N, Npts;
    66  Graphdata graphmode;
    77  Vector *xvec, *yvec, *dxmvec, *dxpvec, *dymvec, *dypvec;
    88
    9   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     9  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    1010
    1111  /* decide on error bars */
     
    3636    return (FALSE);
    3737  }
    38   SetGraph (graphmode);
    3938
    4039  /* set errorbar mode (these are NOT sticky) */
     
    5756  if (Npts == 0) return (TRUE);
    5857
    59   if (!PrepPlotting (Npts, &graphmode)) return (FALSE);
     58  if (!KapaPrepPlot (kapa, Npts, &graphmode)) return (FALSE);
    6059 
    61   PlotVector (Npts, xvec[0].elements, "x");
    62   PlotVector (Npts, yvec[0].elements, "y");
     60  KapaPlotVector (kapa, Npts, xvec[0].elements, "x");
     61  KapaPlotVector (kapa, Npts, yvec[0].elements, "y");
    6362  if (graphmode.etype & 0x01) {
    64     PlotVector (Npts, dymvec[0].elements, "dym");
    65     PlotVector (Npts, dypvec[0].elements, "dyp");
     63    KapaPlotVector (kapa, Npts, dymvec[0].elements, "dym");
     64    KapaPlotVector (kapa, Npts, dypvec[0].elements, "dyp");
    6665  }
    6766  if (graphmode.etype & 0x02) {
    68     PlotVector (Npts, dxmvec[0].elements, "dxm");
    69     PlotVector (Npts, dxpvec[0].elements, "dxp");
     67    KapaPlotVector (kapa, Npts, dxmvec[0].elements, "dxm");
     68    KapaPlotVector (kapa, Npts, dxpvec[0].elements, "dxp");
    7069  }
    71  
    7270  return (TRUE);
    73 
    7471}
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/section.c

    r13404 r13432  
    11# include "data.h"
    22
    3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM};
     3enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL};
    44
    55int section (int argc, char **argv) {
    66 
    7   int N, action;
    8   int kapa;
    9   char *name;
     7  int N, action, kapa;
     8  char *name, *location;
    109  Graphdata graphmode;
    1110  KapaSection section;
     
    1312  action = NONE;
    1413  if ((N = get_argument (argc, argv, "-list"))) {
     14    action = LIST;
    1515    remove_argument (N, &argc, argv);
    16     action = LIST;
    1716  }
    1817  if ((N = get_argument (argc, argv, "-up"))) {
     18    action = UP;
    1919    remove_argument (N, &argc, argv);
    20     action = UP;
    2120  }
    2221  if ((N = get_argument (argc, argv, "-down"))) {
     22    action = DOWN;
    2323    remove_argument (N, &argc, argv);
    24     action = DOWN;
    2524  }
    2625  if ((N = get_argument (argc, argv, "-top"))) {
     26    action = TOP;
    2727    remove_argument (N, &argc, argv);
    28     action = TOP;
    2928  }
    3029  if ((N = get_argument (argc, argv, "-bottom"))) {
     30    action = BOTTOM;
    3131    remove_argument (N, &argc, argv);
    32     action = BOTTOM;
     32  }
     33  if ((N = get_argument (argc, argv, "-imtool"))) {
     34    action = TOOL;
     35    remove_argument (N, &argc, argv);
     36    location = argv[N];
     37    remove_argument (N, &argc, argv);
    3338  }
    3439
     
    4348
    4449  /* list sections */
    45   if (argc == 1) {
     50  if ((argc == 1) && (action == NONE)) {
    4651    KapaGetSection (kapa, "*");
    4752    gprint (GP_ERR, "USAGE: section name [x y dx dy]\n");
     
    6974        KapaMoveSection (kapa, argv[1], "bottom");
    7075        break;
     76
     77      case TOOL:
     78        if (!strcmp(location, "-x")) {
     79          KapaSetToolbox (kapa, 1);
     80          break;
     81        }
     82        if (!strcmp(location, "+x")) {
     83          KapaSetToolbox (kapa, 3);
     84          break;
     85        }
     86        if (!strcmp(location, "-y")) {
     87          KapaSetToolbox (kapa, 2);
     88          break;
     89        }
     90        if (!strcmp(location, "+y")) {
     91          KapaSetToolbox (kapa, 4);
     92          break;
     93        }
     94        if (!strcmp(location, "none")) {
     95          KapaSetToolbox (kapa, 0);
     96          break;
     97        }
     98        gprint (GP_ERR, "unknown toolbox location %s\n", location);
     99        gprint (GP_ERR, "valid values: -x, +x, -y, +y, none\n");
     100        return (FALSE);
    71101
    72102      case LIST:
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/style.c

    r13391 r13432  
    33int style (int argc, char **argv) {
    44 
     5  int kapa;
    56  Graphdata graphmode;
    67
    7   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     8  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    89
    910  if (argc > 1) {
     
    1112    return (FALSE);
    1213  }
    13   SetGraph (graphmode);
     14  KapaSetGraphStyle (kapa, &graphmode);
    1415
    1516  return (TRUE);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/zplot.c

    r13409 r13432  
    33int zplot (int argc, char **argv) {
    44 
    5   int i, N, Npts;
     5  int i, kapa, N, Npts;
    66  float *in, *out;
    77  double min, range;
     
    99  Vector *xvec, *yvec, *zvec, Zvec;
    1010
    11   if (!style_args (&graphmode, &argc, argv, NULL)) return (FALSE);
     11  if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE);
    1212
    1313  if (argc != 6) {
     
    4545  graphmode.etype = 0; /* no errorbars */
    4646  Npts = xvec[0].Nelements;
    47   PrepPlotting (Npts, &graphmode);
    48 
    49   PlotVector (Npts, xvec[0].elements, "x");
    50   PlotVector (Npts, yvec[0].elements, "y");
    51   PlotVector (Npts, Zvec.elements, "z");
     47  PlotVectorTriplet (kapa, Npts, xvec[0].elements, yvec[0].elements, Zvec.elements, &graphmode);
    5248
    5349  free (Zvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dmt.c

    r13409 r13432  
    4040  // XXX this needs to be fixed: how to access different graphs at once?
    4141  gprint (GP_ERR, "ERROR: this function is currently disabled\n");
    42   if (!GetGraphData (&graphsky, NULL, NULL)) return (FALSE);
     42  return (FALSE);
     43  if (!GetGraphData (&graphsky, &kapa, NULL)) return (FALSE);
    4344  if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);
    4445
     
    143144  } else {
    144145    graphmode.style = 2; /* set style to points */
    145     PrepPlotting (N, &graphmode);
    146    
    147     PlotVector (N, Xvec.elements, "x");
    148     PlotVector (N, Yvec.elements, "y");
     146    PlotVector (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    149147
    150148    free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/images.c

    r13409 r13432  
    1414  int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN;
    1515  time_t tzero, tend;
    16   int N, NPTS, n, npts, Npts;
     16  int N, NPTS, n, npts, Npts, kapa;
    1717  Vector Xvec, Yvec;
    1818  double r[8], d[8], x[8], y[8], Rmin, Rmax, Rmid, trange, Radius;
     
    2222  int typehash;
    2323
    24   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     24  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    2525
    2626  WITH_MOSAIC = FALSE;
     
    101101    return (FALSE);
    102102  }
    103   SetGraph (graphmode);
    104103 
    105104  /* it is not an error for the database not to have any images */
     
    282281    graphmode.ptype = 100; /* connect pairs of points */
    283282    graphmode.etype = 0;
    284     PrepPlotting (N, &graphmode);
    285     PlotVector (N, Xvec.elements, "x");
    286     PlotVector (N, Yvec.elements, "y");
     283    PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    287284  }
    288285
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/imbox.c

    r13409 r13432  
    33int imbox (int argc, char **argv) {
    44 
    5   int j, Nskip, status, InPic, flipped;
     5  int j, kapa, Nskip, status, InPic, flipped;
    66  Vector Xvec, Yvec;
    77  double r, d, x[4], y[4], Rmin, Rmax, Rmid;
     
    1212  FILE *f;
    1313
    14   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     14  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    1515
    1616  if (argc != 2) {
     
    7676      graphmode.ptype = 100; /* connect pairs of points */
    7777      graphmode.etype = 0;
    78       PrepPlotting (8, &graphmode);
    79       PlotVector (8, Xvec.elements, "x");
    80       PlotVector (8, Yvec.elements, "y");
     78      PlotVectorPair (kapa, 8, Xvec.elements, Yvec.elements, &graphmode);
    8179    }
    8280  skip:
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/imdense.c

    r13409 r13432  
    55 
    66  long A, B;
    7   int i, N, Nimage, status, NPTS;
     7  int i, kapa, N, Nimage, status, NPTS;
    88  double r, d, x, y, Rmin, Rmax;
    99  Vector Xvec, Yvec;
     
    1111  Graphdata graphmode;
    1212
    13   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     13  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    1414
    1515  /* need options to list only images in region and only images in a time range */
     
    6262    graphmode.style = 2; /* points */
    6363    graphmode.etype = 0;
    64     PrepPlotting (N, &graphmode);
    65     PlotVector (N, Xvec.elements, "x");
    66     PlotVector (N, Yvec.elements, "y");
     64    PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    6765  }
    6866
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/imstats.c

    r13409 r13432  
    33int imstats (int argc, char **argv) {
    44 
    5   int i, Nimage, N;
     5  int i, kapa, Nimage, N;
    66  int Mcal, AutoLimits;
    77  double r, d;
     
    1010  Graphdata graphmode;
    1111
    12   if (!style_args (&graphmode, &argc, argv, NULL)) return (FALSE);
     12  if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE);
    1313
    1414  Mcal = TRUE;
     
    5454  graphmode.style = 2;
    5555  graphmode.etype = 0;
    56   PrepPlotting (Nimage, &graphmode);
    57   PlotVector (Nimage, Xvec.elements, "x");
    58   PlotVector (Nimage, Yvec.elements, "y");
     56  PlotVectorPair (kapa, Nimage, Xvec.elements, Yvec.elements, &graphmode);
    5957 
    6058  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/lcurve.c

    r13409 r13432  
    154154    graphmode.etype = 0; 
    155155
    156   PrepPlotting (N, &graphmode);
    157   PlotVector (N, Xvec.elements, "x");
    158   PlotVector (N, Yvec.elements, "y");
     156  KapaPrepPlot (kapa, N, &graphmode);
     157  KapaPlotVector (kapa, N, Xvec.elements, "x");
     158  KapaPlotVector (kapa, N, Yvec.elements, "y");
    159159  if (ErrorBars) {
    160     PlotVector (N, dYvec.elements, "x");
    161     PlotVector (N, dYvec.elements, "y");
     160    KapaPlotVector (kapa, N, dYvec.elements, "dym");
     161    KapaPlotVector (kapa, N, dYvec.elements, "dyp");
    162162  }
    163163
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/paverage.c

    r13391 r13432  
    55 
    66  FILE *f;
    7   int i, j, Narg, Npts, NPTS, status, VERBOSE;
     7  int i, j, kapa, Narg, Npts, NPTS, status, VERBOSE;
    88  int Nsecfilt, Nsec;
    99  double Mz, Mr, mag;
     
    2323  Nsecfilt = GetPhotcodeNsecfilt ();
    2424
    25   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     25  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    2626
    2727  f = (FILE *) NULL;
     
    8282    return (FALSE);
    8383  }
    84   SetGraph (graphmode);
    8584  graphmode.style = 2; /* set style to points */
    8685  graphmode.size = -1; /* point size determined by Zvec */
     
    141140      }
    142141      if (Npts > NCHUNK) {
    143           PlotVectorTriplet (Npts, Xvec, Yvec, Zvec, &graphmode);
     142          PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode);
    144143          Npts = 0;
    145144      }
     
    147146    dvo_catalog_free (&catalog);
    148147  }
    149   if (Npts > 0) PlotVectorTriplet (Npts, Xvec, Yvec, Zvec, &graphmode);
     148  if (Npts > 0) PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode);
    150149
    151150  free (Xvec);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/pcat.c

    r13409 r13432  
    66 
    77  double Radius;
    8   int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside;
     8  int i, j, kapa, N, Nregions, ShowAll, NPTS, Npts, leftside;
    99  RegionFile *regions;
    1010  char filename[128];
     
    3333    return (FALSE);
    3434  }
    35   if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);
     35  if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE);
    3636 
    3737  Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
     
    8383    graphmode.ptype = 100; /* connect pairs of points */
    8484    graphmode.etype = 0;
    85     PrepPlotting (Npts, &graphmode);
    86     PlotVector (Npts, Xvec.elements, "x");
    87     PlotVector (Npts, Yvec.elements, "y");
     85    PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode);
    8886  }
    8987
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/pmeasure.c

    r13391 r13432  
    55 
    66  FILE *f;
    7   int i, j, k, m, Narg, Npts, NPTS, status, VERBOSE;
     7  int i, j, k, m, kapa, Narg, Npts, NPTS, status, VERBOSE;
    88  double Mz, Mr, mag;
    99  double Radius, Rmin, Rmax, R, D;
     
    1919
    2020  if (!InitPhotcodes ()) return (FALSE);
    21   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     21  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    2222
    2323  f = (FILE *) NULL;
     
    7575    return (FALSE);
    7676  }
    77   SetGraph (graphmode);
    7877  graphmode.style = 2; /* set style to points */
    7978  graphmode.size = -1; /* point size determined by Zvec */
     
    144143        }
    145144        if (Npts > NCHUNK) {
    146             PlotVectorTriplet (Npts, Xvec, Yvec, Zvec, &graphmode);
     145            PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode);
    147146            Npts = 0;
    148147        }
     
    151150    dvo_catalog_free (&catalog);
    152151  }
    153   if (Npts > 0) PlotVectorTriplet (Npts, Xvec, Yvec, Zvec, &graphmode);
     152  if (Npts > 0) PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode);
    154153
    155154  free (Xvec);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/procks.c

    r13409 r13432  
    1616  FILE *f;
    1717  Vector Xvec, Yvec;
    18   int i, j, N, NROCKS;
     18  int kapa, i, j, N, NROCKS;
    1919  int N0, N1, SpeedClip, Reload;
    2020  unsigned int t0, t1;
     
    2525
    2626  VarConfig ("ROCK_CATALOG", "%s", rockcat);
    27   if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);
     27  if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE);
    2828
    2929  f = (FILE *) NULL;
     
    113113  graphmode.style = 2; /* set style to points */
    114114  graphmode.etype = 0; /* no errorbars */
    115   PrepPlotting (N, &graphmode);
    116  
    117   PlotVector (N, Xvec.elements, "x");
    118   PlotVector (N, Yvec.elements, "y");
     115  PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    119116
    120117  /* now plot vectors between two extrema */
     
    146143  graphmode.ptype = 100; /* connect pairs */
    147144  graphmode.etype = 0; /* no errorbars */
    148   PrepPlotting (N, &graphmode);
    149  
    150   PlotVector (N, Xvec.elements, "x");
    151   PlotVector (N, Yvec.elements, "y");
     145
     146  PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    152147
    153148  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/showtile.c

    r13409 r13432  
    55int showtile (int argc, char **argv) {
    66
    7   int Nd, N, NPTS, status, i, InPic;
     7  int kapa, Nd, N, NPTS, status, i, InPic;
    88  Graphdata graphmode;
    99  Coords coords;
     
    1313
    1414  /* show tile pattern in viewed region */
    15   if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);
     15  if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE);
    1616
    1717  if (argc != 1) {
     
    8686    graphmode.ptype = 100; /* connect pairs of points */
    8787    graphmode.etype = 0;
    88     PrepPlotting (N, &graphmode);
    89     PlotVector (N, Xvec.elements, "x");
    90     PlotVector (N, Yvec.elements, "y");
     88    PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode);
    9189  }
    9290
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/simage.c

    r13409 r13432  
    1212  Header header;
    1313  Coords coords;
    14   int i, j, Nstars, nstars, Nbytes, nbytes, Npts, N;
     14  int i, j, kapa, Nstars, nstars, Nbytes, nbytes, Npts, N;
    1515  Graphdata graphmode;
    1616
    17   if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);
     17  if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE);
    1818
    1919  zero = 17.0;
     
    154154  graphmode.etype = 0;
    155155  Npts = Xvec.Nelements;
    156   PrepPlotting (Npts, &graphmode);
    157156
    158   PlotVector (Npts, Xvec.elements, "x");
    159   PlotVector (Npts, Yvec.elements, "y");
    160   PlotVector (Npts, Zvec.elements, "z");
     157  PlotVectorTriplet (kapa, Npts, Xvec.elements, Yvec.elements, Zvec.elements, &graphmode);
    161158
    162159  free (Xvec.elements);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/skycat.c

    r13409 r13432  
    66 
    77  double Radius;
    8   int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside, Depth, VERBOSE;
     8  int i, j, N, Nregions, kapa, ShowAll, NPTS, Npts, leftside, Depth, VERBOSE;
    99  struct stat filestat;
    1010  Vector Xvec, Yvec;
     
    3232  }
    3333
    34   if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;
     34  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    3535
    3636  if (argc != 1) {
     
    3838    return (FALSE);
    3939  }
    40   SetGraph (graphmode);
    4140
    4241  Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
     
    9796    graphmode.ptype = 100; /* connect pairs of points */
    9897    graphmode.etype = 0;
    99     PrepPlotting (Npts, &graphmode);
    100     PlotVector (Npts, Xvec.elements, "x");
    101     PlotVector (Npts, Yvec.elements, "y");
     98    PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode);
    10299  }
    103100
  • branches/kapa-mods-2007-05/Ohana/src/opihi/include/display.h

    r13409 r13432  
    77/*** plotting functions ***/
    88int           GetCurrentDevice      PROTO((void));
    9 int           PrepPlotting          PROTO((int Npts, Graphdata *graphmode));
    10 int           PlotVector            PROTO((int Npts, float *values, char *type));
    11 int           PlotVectorTriplet     PROTO((int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode));
     9int           PlotVectorPair        PROTO((int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode));
     10int           PlotVectorTriplet     PROTO((int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode));
    1211int           GetGraphData          PROTO((Graphdata *data, int *kapa, char *name));
    1312int           GetGraph              PROTO((Graphdata *data, int *kapa, char *name));
     
    1615int           close_graph           PROTO((int N));
    1716void          QuitGraph             PROTO((void));
    18 void          SetGraph              PROTO((Graphdata data));
     17void          SetGraph              PROTO((Graphdata *data));
    1918void          XGraphDead            PROTO((int input));
    2019int           GetColor              PROTO((char *name));
  • branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/PlotVectors.c

    r13409 r13432  
    11# include "display.h"
    22
    3 static int kapa;
     3int PlotVectorPair (int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode) {
    44
    5 int PrepPlotting (int Npts, Graphdata *graphmode) {
    6 
    7   if (!GetGraph (NULL, &kapa, NULL)) return (FALSE);
    85  KapaPrepPlot (kapa, Npts, graphmode);
    9   return (TRUE);
    10 }
    11 
    12 int PlotVector (int Npts, float *values, char *type) {
    13 
    14   KapaPlotVector (kapa, Npts, values, type);
    15   return (TRUE);
    16 }
    17 
    18 int PlotVectorPair (int N, float *xValues, float *yValues, Graphdata *graphmode) {
    19 
    20   PrepPlotting (N, graphmode);
    21   PlotVector (N, xValues, "x");
    22   PlotVector (N, yValues, "y");
     6  KapaPlotVector (kapa, Npts, xValues, "x");
     7  KapaPlotVector (kapa, Npts, yValues, "y");
    238
    249  return (TRUE);
    2510}
    2611
    27 int PlotVectorTriplet (int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode) {
     12int PlotVectorTriplet (int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode) {
    2813
    29   PrepPlotting (N, graphmode);
    30   PlotVector (N, xValues, "x");
    31   PlotVector (N, yValues, "y");
    32   PlotVector (N, zValues, "z");
     14  KapaPrepPlot   (kapa, Npts, graphmode);
     15  KapaPlotVector (kapa, Npts, xValues, "x");
     16  KapaPlotVector (kapa, Npts, yValues, "y");
     17  KapaPlotVector (kapa, Npts, zValues, "z");
    3318
    3419  return (TRUE);
    3520}
    36 
    37 /* we don't use GetGraph in PlotVector because it flushes the connection */
    38 /* PlotVector currently operates on the static identified socket
    39    rather than the currently active socket -- must be preceeded by PrepPlotting */
  • branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/graphtools.c

    r7680 r13432  
    3333    graphmode[0].ymax = maxY + 0.05*range;
    3434  }
    35   SetGraph (graphmode[0]);
     35  SetGraph (graphmode);
    3636
    3737  set_variable ("XMIN", graphmode[0].xmin);
     
    7373    graphmode[0].ymax = maxY + 0.05*range;
    7474  }
    75   SetGraph (graphmode[0]);
     75  SetGraph (graphmode);
    7676
    7777  set_variable ("XMIN", graphmode[0].xmin);
  • branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/open_kapa.c

    r13394 r13432  
    180180  }
    181181 
    182   if (data != NULL) *data = graphdata;
     182  if (data != NULL) KapaGetGraphStyle (Socket[Active], data);
    183183  if (fd != NULL) *fd = Socket[Active];
    184184
     
    206206
    207207  if (fd != NULL) *fd = Socket[entry];
    208   if (data != NULL) *data = graphdata;
     208  if (data != NULL) KapaGetGraphStyle (Socket[entry], data);
    209209  return (TRUE);
    210210}
    211211
    212212/* assign given values to current Xgraph */
    213 void SetGraph (Graphdata data) {
    214   graphdata = data;
     213void SetGraph (Graphdata *data) {
     214  if (Active < 0) {
     215    gprint (GP_ERR, "no active kapa window\n");
     216    return (FALSE);
     217  }
     218  if (Socket[Active] == -1) {
     219    gprint (GP_ERR, "no active kapa window\n");
     220    return (FALSE);
     221  }
     222  KapaSetGraphStyle (Socket[Active], data);
    215223}
    216224
Note: See TracChangeset for help on using the changeset viewer.