Changeset 39737
- Timestamp:
- Oct 8, 2016, 5:24:51 AM (10 years ago)
- Location:
- branches/czw_branch/20160809/Ohana/src/kapa2
- Files:
-
- 3 edited
-
include/prototypes.h (modified) (1 diff)
-
src/DrawObjects.c (modified) (19 diffs)
-
src/LoadObject.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20160809/Ohana/src/kapa2/include/prototypes.h
r39729 r39737 32 32 void DrawLabelsRaw PROTO((Graphic *graphic, KapaGraphWidget *graph, int color)); 33 33 void 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));34 void DrawConnect PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 35 void DrawHistogram PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 36 int DrawObjectN PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 37 void DrawPoints PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 38 void ClipLine PROTO((Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1)); 39 void DrawXErrors PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 40 void DrawYErrors PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 41 41 void DrawTick PROTO((Graphic *graphic, Axis *axis, int P, TickMarkData *tick, int naxis)); 42 42 void AxisTickScale PROTO((Axis *axis, double *range, double *major, double *minor, int *nsignif)); -
branches/czw_branch/20160809/Ohana/src/kapa2/src/DrawObjects.c
r39729 r39737 14 14 15 15 // XXX this is not thread safe, but that is OK 16 static Graphic *graphic;16 // static Graphic *graphic; 17 17 18 18 /* draw all objects for this Graph */ … … 22 22 23 23 // the functions below use this global value 24 graphic = GetGraphic();24 Graphic *graphic = GetGraphic(); 25 25 26 26 // this function calls all of the supporting Draw... functions below … … 28 28 if (DEBUG) fprintf (stderr, "object: %d\n", i); 29 29 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]); 31 31 } 32 32 XSetLineAttributes (graphic->display, graphic->gc, 0, LineSolid, CAPSTYLE, JOINSTYLE); … … 36 36 37 37 /* Draw a specific object in the graph */ 38 int DrawObjectN ( KapaGraphWidget *graph, Gobjects *object) {38 int DrawObjectN (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 39 39 40 40 static char dot[2] = {2,3}; … … 87 87 switch (object[0].style) { 88 88 case KAPA_PLOT_CONNECT: 89 DrawConnect (graph , object);89 DrawConnect (graphic, graph, object); 90 90 break; 91 91 case KAPA_PLOT_HISTOGRAM: 92 DrawHistogram (graph , object);92 DrawHistogram (graphic, graph, object); 93 93 break; 94 94 case KAPA_PLOT_POINTS: 95 95 default: 96 DrawPoints (graph , object);96 DrawPoints (graphic, graph, object); 97 97 break; 98 98 } 99 99 100 100 if (object[0].etype & 0x01) { 101 DrawYErrors (graph , object);101 DrawYErrors (graphic, graph, object); 102 102 } 103 103 if (object[0].etype & 0x02) { 104 DrawXErrors (graph , object);104 DrawXErrors (graphic, graph, object); 105 105 } 106 106 return (TRUE); … … 108 108 109 109 /******/ 110 void DrawConnect ( KapaGraphWidget *graph, Gobjects *object) {110 void DrawConnect (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 111 111 112 112 int i; … … 145 145 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 146 146 147 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);147 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 148 148 /* DrawLine (sx0, sy0, sx1, sy1); */ 149 149 sx0 = sx1; sy0 = sy1; … … 152 152 } 153 153 154 void ClipLine ( double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) {154 void ClipLine (Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) { 155 155 156 156 /* skip line segement if both points are beyond box */ … … 208 208 /* simplify the code abit by finding triplets, watch out for a histogram of 2 points */ 209 209 # if (1) 210 void DrawHistogram ( KapaGraphWidget *graph, Gobjects *object) {210 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 211 211 212 212 int i; … … 294 294 # else 295 295 296 void DrawHistogram ( KapaGraphWidget *graph, Gobjects *object) {296 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 297 297 298 298 int i; … … 403 403 404 404 /******/ 405 void DrawPoints ( KapaGraphWidget *graph, Gobjects *object) {405 void DrawPoints (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 406 406 407 407 int i; … … 423 423 by = byi + byj; 424 424 425 Graphic *graphic = GetGraphic();426 427 425 /**** point sizes are scaled by object.size, colors by object.color ***/ 428 426 int scaleSize = (object[0].size < 0); … … 701 699 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx + XCENTER; 702 700 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); 704 702 } 705 703 break; … … 727 725 728 726 /******/ 729 void DrawXErrors ( KapaGraphWidget *graph, Gobjects *object) {727 void DrawXErrors (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 730 728 731 729 int i, bar, dz, ds, D; … … 780 778 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 781 779 { 782 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);780 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 783 781 if (bar) { 784 782 sx10 = sy1 - sz; 785 783 sx11 = sy1 + sz; 786 ClipLine ( sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);784 ClipLine (graphic, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 787 785 } 788 786 } … … 799 797 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 800 798 { 801 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);799 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 802 800 if (bar) { 803 801 sx10 = sy1 - sz; 804 802 sx11 = sy1 + sz; 805 ClipLine ( sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);803 ClipLine (graphic, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 806 804 } 807 805 } … … 810 808 811 809 /******/ 812 void DrawYErrors ( KapaGraphWidget *graph, Gobjects *object) {810 void DrawYErrors (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 813 811 814 812 int i, bar, dz, ds, D; … … 863 861 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 864 862 { 865 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);863 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 866 864 if (bar) { 867 865 sx10 = sx1 - sz; 868 866 sx11 = sx1 + sz; 869 ClipLine ( sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);867 ClipLine (graphic, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 870 868 } 871 869 } … … 884 882 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 885 883 { 886 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);884 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 887 885 if (bar) { 888 886 sx10 = sx1 - sz; 889 887 sx11 = sx1 + sz; 890 ClipLine ( sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);888 ClipLine (graphic, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 891 889 } 892 890 } -
branches/czw_branch/20160809/Ohana/src/kapa2/src/LoadObject.c
r31665 r39737 102 102 if (DEBUG) fprintf (stderr, "loaded %d objects, using object %d\n", graph[0].objects[N].Npts, N); 103 103 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 } 105 108 FlushDisplay (); 106 109
Note:
See TracChangeset
for help on using the changeset viewer.
