IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39737


Ignore:
Timestamp:
Oct 8, 2016, 5:24:51 AM (10 years ago)
Author:
eugene
Message:

fix errors with line type, point type, plot type abstractions

Location:
branches/czw_branch/20160809/Ohana/src/kapa2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20160809/Ohana/src/kapa2/include/prototypes.h

    r39729 r39737  
    3232void          DrawLabelsRaw       PROTO((Graphic *graphic, KapaGraphWidget *graph, int color));
    3333void          DrawTextlines       PROTO((KapaGraphWidget *graph));
    34 void          DrawConnect         PROTO((KapaGraphWidget *graph, Gobjects *objects));
    35 void          DrawHistogram       PROTO((KapaGraphWidget *graph, Gobjects *objects));
    36 int           DrawObjectN         PROTO((KapaGraphWidget *graph, Gobjects *objects));
    37 void          DrawPoints          PROTO((KapaGraphWidget *graph, Gobjects *objects));
    38 void          ClipLine            PROTO((double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1));
    39 void          DrawXErrors         PROTO((KapaGraphWidget *graph, Gobjects *objects));
    40 void          DrawYErrors         PROTO((KapaGraphWidget *graph, Gobjects *objects));
     34void          DrawConnect         PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects));
     35void          DrawHistogram       PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects));
     36int           DrawObjectN         PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects));
     37void          DrawPoints          PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects));
     38void          ClipLine            PROTO((Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1));
     39void          DrawXErrors         PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects));
     40void          DrawYErrors         PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects));
    4141void          DrawTick            PROTO((Graphic *graphic, Axis *axis, int P, TickMarkData *tick, int naxis));
    4242void          AxisTickScale       PROTO((Axis *axis, double *range, double *major, double *minor, int *nsignif));
  • branches/czw_branch/20160809/Ohana/src/kapa2/src/DrawObjects.c

    r39729 r39737  
    1414
    1515// XXX this is not thread safe, but that is OK
    16 static Graphic *graphic;
     16// static Graphic *graphic;
    1717
    1818/* draw all objects for this Graph */
     
    2222 
    2323  // the functions below use this global value
    24   graphic = GetGraphic();
     24  Graphic *graphic = GetGraphic();
    2525 
    2626  // this function calls all of the supporting Draw... functions below
     
    2828    if (DEBUG) fprintf (stderr, "object: %d\n", i);
    2929    if (DEBUG) fprintf (stderr, "Npts: %d\n", graph[0].objects[i].Npts);
    30     DrawObjectN (graph, &graph[0].objects[i]);
     30    DrawObjectN (graphic, graph, &graph[0].objects[i]);
    3131  }   
    3232  XSetLineAttributes (graphic->display, graphic->gc, 0, LineSolid, CAPSTYLE, JOINSTYLE);
     
    3636
    3737/* Draw a specific object in the graph */
    38 int DrawObjectN (KapaGraphWidget *graph, Gobjects *object) {
     38int DrawObjectN (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    3939 
    4040  static char dot[2] = {2,3};
     
    8787  switch (object[0].style) {
    8888    case KAPA_PLOT_CONNECT:
    89       DrawConnect (graph, object);
     89      DrawConnect (graphic, graph, object);
    9090      break;
    9191    case KAPA_PLOT_HISTOGRAM:
    92       DrawHistogram (graph, object);
     92      DrawHistogram (graphic, graph, object);
    9393      break;
    9494    case KAPA_PLOT_POINTS:
    9595    default:
    96       DrawPoints (graph, object);
     96      DrawPoints (graphic, graph, object);
    9797      break;
    9898  }
    9999   
    100100  if (object[0].etype & 0x01) {
    101     DrawYErrors (graph, object);
     101    DrawYErrors (graphic, graph, object);
    102102  }
    103103  if (object[0].etype & 0x02) {
    104     DrawXErrors (graph, object);
     104    DrawXErrors (graphic, graph, object);
    105105  }
    106106  return (TRUE);
     
    108108
    109109/******/
    110 void DrawConnect (KapaGraphWidget *graph, Gobjects *object) {
     110void DrawConnect (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    111111 
    112112  int i;
     
    145145    sy1 = x[i]*myi + y[i]*myj + by + YCENTER;
    146146   
    147     ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
     147    ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
    148148    /* DrawLine (sx0, sy0, sx1, sy1); */
    149149    sx0 = sx1; sy0 = sy1;
     
    152152}
    153153
    154 void ClipLine (double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) {
     154void ClipLine (Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) {
    155155
    156156  /* skip line segement if both points are beyond box */
     
    208208/* simplify the code abit by finding triplets, watch out for a histogram of 2 points */
    209209# if (1)
    210 void DrawHistogram (KapaGraphWidget *graph, Gobjects *object) {
     210void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    211211
    212212  int i;
     
    294294# else
    295295
    296 void DrawHistogram (KapaGraphWidget *graph, Gobjects *object) {
     296void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    297297
    298298  int i;
     
    403403
    404404/******/
    405 void DrawPoints (KapaGraphWidget *graph, Gobjects *object) {
     405void DrawPoints (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    406406
    407407  int i;
     
    423423  by = byi + byj;
    424424 
    425   Graphic *graphic = GetGraphic();
    426 
    427425  /**** point sizes are scaled by object.size, colors by object.color ***/
    428426  int scaleSize = (object[0].size < 0);
     
    701699        sx2 = x[i+1]*mxi + y[i+1]*mxj + bx + XCENTER;
    702700        sy2 = x[i+1]*myi + y[i+1]*myj + by + YCENTER;
    703         ClipLine (sx1, sy1, sx2, sy2, X0, Y0, X1, Y1);
     701        ClipLine (graphic, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1);
    704702      }
    705703      break;
     
    727725   
    728726/******/
    729 void DrawXErrors (KapaGraphWidget *graph, Gobjects *object) {
     727void DrawXErrors (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    730728 
    731729  int i, bar, dz, ds, D;
     
    780778         (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy)))
    781779    {
    782       ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
     780      ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
    783781      if (bar) {
    784782        sx10 = sy1 - sz;
    785783        sx11 = sy1 + sz;
    786         ClipLine (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);
     784        ClipLine (graphic, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);
    787785      }
    788786    }
     
    799797         (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy)))
    800798    {
    801       ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
     799      ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
    802800      if (bar) {
    803801        sx10 = sy1 - sz;
    804802        sx11 = sy1 + sz;
    805         ClipLine (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);
     803        ClipLine (graphic, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);
    806804      }
    807805    }
     
    810808   
    811809/******/
    812 void DrawYErrors (KapaGraphWidget *graph, Gobjects *object) {
     810void DrawYErrors (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {
    813811
    814812  int i, bar, dz, ds, D;
     
    863861         (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy)))
    864862    {
    865       ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
     863      ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
    866864      if (bar) {
    867865        sx10 = sx1 - sz;
    868866        sx11 = sx1 + sz;
    869         ClipLine (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);
     867        ClipLine (graphic, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);
    870868      }
    871869    }
     
    884882         (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy)))
    885883    {
    886       ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
     884      ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);
    887885      if (bar) {
    888886        sx10 = sx1 - sz;
    889887        sx11 = sx1 + sz;
    890         ClipLine (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);
     888        ClipLine (graphic, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);
    891889      }
    892890    }
  • branches/czw_branch/20160809/Ohana/src/kapa2/src/LoadObject.c

    r31665 r39737  
    102102  if (DEBUG) fprintf (stderr, "loaded %d objects, using object %d\n", graph[0].objects[N].Npts, N);
    103103
    104   if (USE_XWINDOW) DrawObjectN (graph, &graph[0].objects[graph[0].Nobjects-1]);
     104  if (USE_XWINDOW) {
     105    Graphic *graphic = GetGraphic();
     106    DrawObjectN (graphic, graph, &graph[0].objects[graph[0].Nobjects-1]);
     107  }
    105108  FlushDisplay ();
    106109
Note: See TracChangeset for help on using the changeset viewer.