Changeset 40165
- Timestamp:
- Oct 11, 2017, 10:10:18 AM (9 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 37 edited
- 2 copied
-
. (modified) (1 prop)
-
src/kapa2/include/prototypes.h (modified) (2 diffs)
-
src/kapa2/src/DrawObjects.c (modified) (9 diffs)
-
src/kapa2/src/LoadObject.c (modified) (1 diff)
-
src/kapa2/src/PSObjects.c (modified) (8 diffs)
-
src/kapa2/src/bDrawObjects.c (modified) (8 diffs)
-
src/libkapa/include/kapa.h (modified) (1 diff)
-
src/libkapa/src/KapaWindow.c (modified) (1 diff)
-
src/libkapa/src/PSRotFont.c (modified) (4 diffs)
-
src/libkapa/src/bDrawFuncs.c (modified) (2 diffs)
-
src/opihi/cmd.astro/cdot.c (modified) (1 diff)
-
src/opihi/cmd.astro/cgrid.c (modified) (1 diff)
-
src/opihi/cmd.astro/cline.c (modified) (1 diff)
-
src/opihi/cmd.astro/czplot.c (modified) (2 diffs)
-
src/opihi/cmd.data/Makefile (modified) (1 diff)
-
src/opihi/cmd.data/dot.c (modified) (1 diff)
-
src/opihi/cmd.data/grid.c (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (2 diffs)
-
src/opihi/cmd.data/line.c (modified) (1 diff)
-
src/opihi/cmd.data/periodogram-fm.c (copied) (copied from branches/eam_branches/ohana.20170822/src/opihi/cmd.data/periodogram-fm.c )
-
src/opihi/cmd.data/test/periodogram-fm.sh (copied) (copied from branches/eam_branches/ohana.20170822/src/opihi/cmd.data/test/periodogram-fm.sh )
-
src/opihi/cmd.data/test/periodogram.sh (modified) (3 diffs)
-
src/opihi/cmd.data/zplot.c (modified) (2 diffs)
-
src/opihi/dvo/catalog.c (modified) (1 diff)
-
src/opihi/dvo/dmt.c (modified) (1 diff)
-
src/opihi/dvo/fitcolors.c (modified) (4 diffs)
-
src/opihi/dvo/fitsed.c (modified) (1 diff)
-
src/opihi/dvo/images.c (modified) (1 diff)
-
src/opihi/dvo/imbox.c (modified) (1 diff)
-
src/opihi/dvo/imdense.c (modified) (1 diff)
-
src/opihi/dvo/imstats.c (modified) (1 diff)
-
src/opihi/dvo/paverage.c (modified) (1 diff)
-
src/opihi/dvo/pmeasure.c (modified) (1 diff)
-
src/opihi/dvo/procks.c (modified) (2 diffs)
-
src/opihi/dvo/showtile.c (modified) (1 diff)
-
src/opihi/dvo/simage.c (modified) (1 diff)
-
src/opihi/dvo/skycat.c (modified) (1 diff)
-
src/opihi/pantasks/JobIDOps.c (modified) (1 diff)
-
src/opihi/pantasks/test/nice_remote.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/eam_branches/ohana.20170822 (added) merged: 40122-40125,40141-40146,40155-40156,40158-40159,40163-40164
- Property svn:mergeinfo changed
-
trunk/Ohana/src/kapa2/include/prototypes.h
r39926 r40165 36 36 int DrawObjectN PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 37 37 void DrawPoints PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 38 void DrawBars PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *object, int mode)); 38 39 void ClipLine PROTO((Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1)); 39 40 void DrawXErrors PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); … … 139 140 void bDrawConnect PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 140 141 void bDrawHistogram PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 142 void bDrawBars PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object, int mode)); 141 143 void bDrawPoints PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 142 144 void bDrawXErrors PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); -
trunk/Ohana/src/kapa2/src/DrawObjects.c
r40116 r40165 1 1 # include "Ximage.h" 2 2 3 void DrawBars (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object, int mode); 3 /* DrawRectangle & FillRectangle : take rectangle lower-left corner and widths 4 DrawCircle & FillCircle : take circle center and radius 5 */ 4 6 5 7 # define DrawLine(X1,Y1,X2,Y2) (XDrawLine (graphic->display, graphic->window, graphic->gc, (int)(X1), (int)(Y1), (int)(X2), (int)(Y2))) 6 # define DrawRectangle(X1,Y1,X2,Y2) (XDrawRectangle (graphic->display, graphic->window, graphic->gc, (int)(X1), (int)(Y1), (int)(X2), (int)(Y2))) 7 # define FillRectangle(X1,Y1,X2,Y2) (XFillRectangle (graphic->display, graphic->window, graphic->gc, (int)(X1), (int)(Y1), (int)(X2), (int)(Y2))) 8 // # define FillRectangle(X1,Y1,X2,Y2) ; 8 # define DrawRectangle(X,Y,dX,dY) (XDrawRectangle (graphic->display, graphic->window, graphic->gc, (int)(X), (int)(Y), (int)(dX), (int)(dY))) 9 # define FillRectangle(X,Y,dX,dY) (XFillRectangle (graphic->display, graphic->window, graphic->gc, (int)(X), (int)(Y), (int)(dX), (int)(dY))) 9 10 # define DrawCircle(X,Y,R) (XDrawArc (graphic->display, graphic->window, graphic->gc, (int)(X-R), (int)(Y-R), abs(2*R), abs(2*R), 0, 23040)) 10 11 # define FillCircle(X,Y,R) (XFillArc (graphic->display, graphic->window, graphic->gc, (int)(X-R), (int)(Y-R), abs(2*R), abs(2*R), 0, 23040)) … … 162 163 sx1 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 163 164 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 164 165 165 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 166 /* DrawLine (sx0, sy0, sx1, sy1); */167 166 sx0 = sx1; sy0 = sy1; 168 167 } … … 225 224 /******/ 226 225 /* simplify the code abit by finding triplets, watch out for a histogram of 2 points */ 227 # if (1)228 226 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 229 227 … … 309 307 DrawLine (sxa, sy1, sxa, sya); 310 308 } 311 312 # else313 314 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {315 316 int i;317 float *x, *y;318 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by;319 double sx0, sy0, sx1, sy1, sxa, sya, sxo, syo;320 double X0, X1, Y0, Y1;321 322 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0);323 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0);324 myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0);325 myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0);326 327 bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0);328 bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0);329 byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0);330 byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0);331 332 bx = bxi + bxj;333 by = byi + byj;334 335 X0 = graph[0].axis[0].fx;336 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx;337 Y0 = graph[0].axis[1].fy;338 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy;339 340 /* find the first valid datapoint */341 x = object[0].x; y = object[0].y;342 343 /* we only worry about pairs of points of which one is on the screen. for each such344 pair, we draw the connecting lines from sx0,sy0 to sx1,sy1, passing through the point345 halfway between.346 347 if, for a given point, there was no valid x0,y0, then we call this the first point348 save both the current and previous points.349 */350 351 int firstPair = TRUE;352 sx0r = sy0r = NAN;353 sxPr = syPr = NAN;354 for (i = 0; i < object[0].Npts; i++) {355 if (!(finite(x[i]) && finite(y[i]))) continue;356 sx1r = x[i]*mxi + y[i]*mxj + bx + XCENTER;357 sy1r = x[i]*myi + y[i]*myj + by + YCENTER;358 359 // we have hit the first valid point, but not yet the second one360 if (!isfinite (sx0r)) {361 sx0r = sx1r; sy0r = sy1r;362 continue;363 }364 365 if ((sx1r < X0) && (sx0r < X0)) {366 // both points to left, skip the pair367 sxPr = sx0r; syPr = sy0r;368 sx0r = sx1r; sy0r = sy1r;369 continue;370 }371 if ((sx1r > X0) && (sx0r > X0)) {372 // both points to right, skip the pair373 sxPr = sx0r; syPr = sy0r;374 sx0r = sx1r; sy0r = sy1r;375 continue;376 }377 378 // saturated values for sx0,sy0379 sx0 = MIN (MAX (sx0r, X0), X1);380 sy0 = MAX (MIN (sy0r, Y0), Y1);381 382 // saturated values for sx1,sy1383 sx1 = MIN (MAX (sx1r, X0), X1);384 sy1 = MAX (MIN (sy1r, Y0), Y1);385 386 if (firstPair) {387 /* draw segment equal distance behind first point and down to x-axis */388 sxar = sx0r - 0.5*(sx1r - sx0r);389 sxa = MIN (MAX (sxar, X0), X1);390 sya = MAX (sy0r, Y0);391 XSetForeground (graphic->display, graphic->gc, graphic->fore);392 DrawLine (sx0, sy0, sxa, sy0);393 DrawLine (sxa, sy0, sxa, sya);394 XSetForeground (graphic->display, graphic->gc, graphic->color[object[0].color]);395 FillRectangle (sxa + 3, sy0 + 3, sx0 - sxa - 6, sya - sy0 - 6);396 firstPair = FALSE;397 }398 399 // midpoint & saturated version400 sxar = 0.5*(sx0r + sx1r);401 sxa = MIN (MAX (sxar, X0), X1);402 403 XSetForeground (graphic->display, graphic->gc, graphic->fore);404 DrawLine (sx0, sy0, sxa, sy0);405 DrawLine (sxa, sy0, sxa, sy1);406 DrawLine (sxa, sy1, sx1, sy1);407 XSetForeground (graphic->display, graphic->gc, graphic->color[object[0].color]);408 FillRectangle (sx0 + 3, sy0 + 3, sxa - sx0 - 6, Y0 - sy0 - 6);409 FillRectangle (sxa + 3, sy1 + 3, sx1 - sxa - 6, Y0 - sy1 - 6);410 sxPr = sx0r; syPr = sy0r;411 sx0r = sx1r; sy0r = sy1r;412 }413 414 /* draw segment equal distance after last point and down to x-axis */415 sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);416 sya = MAX (sy1, Y0);417 DrawLine (sx1, sy1, sxa, sy1);418 DrawLine (sxa, sy1, sxa, sya);419 }420 # endif421 309 422 310 // uses object->color … … 498 386 /* we are drawing bars which are filled rectangles of height y[i] and width 0.5*dx 499 387 one point at a time 388 389 I need to know the distance to the next and prev points to calculate dx 390 for the first point, dx is x[1] - x[0] 391 for the last point, dx is x[-1] - x[-2] (x[-1] is the last point) 392 for the rest, dx is 0.5*(x[i+1] - x[i-1]) 393 394 rather than working out complex on-the-fly logic, I want to find the first and last 395 valid point in an initial pass, then calculate the above for the remainder. 396 TBD: make an index vector of only valid points? 500 397 */ 501 502 // I need to know the distance to the next and prev points to calculate dx503 // for the first point, dx is x[1] - x[0]504 // for the last point, dx is x[-1] - x[-2] (x[-1] is the last point)505 // for the rest, dx is 0.5*(x[i+1] - x[i-1])506 507 // rather than working out complex on-the-fly logic, I want to find the first and last508 // valid point in an initial pass, the calculate the above for the remainder.509 // or make an index vector of only valid points?510 398 511 399 int Ngood = 0; … … 522 410 // coordinate on the screen of the point: 523 411 double sx1r = x[i]*mxi + y[i]*mxj + bx + XCENTER; 524 // double sy1r = x[i]*myi + y[i]*myj + by + YCENTER;525 412 526 413 if (sx1r < X0) { … … 576 463 n = goodPoint[1]; 577 464 double sx1r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 578 // double sy1r = x[n]*myi + y[n]*myj + by + YCENTER;579 465 580 466 n = goodPoint[0]; … … 605 491 n = goodPoint[i + 1]; 606 492 double sx2r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 607 // double sy2r = x[n]*myi + y[n]*myj + by + YCENTER;608 493 609 494 n = goodPoint[i - 1]; 610 495 double sx0r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 611 // double sy0r = x[n]*myi + y[n]*myj + by + YCENTER; 612 613 double dx = 0.5*0.5*object->size*(sx2r - sx0r); // 2 factors of 0.5 (we want half of the average spacing)496 497 // below we have 2 factors of 0.5 (we want half of the average spacing) 498 double dx = 0.5*0.5*object->size*(sx2r - sx0r); 614 499 615 500 n = goodPoint[i]; … … 642 527 n = goodPoint[Ngood - 2]; 643 528 double sx0r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 644 // double sy0r = x[n]*myi + y[n]*myj + by + YCENTER;645 529 646 530 double dx = 0.5*object->size*(sx1r - sx0r); -
trunk/Ohana/src/kapa2/src/LoadObject.c
r39926 r40165 42 42 graph[0].objects[N].color = KapaColormapSize() - 1; 43 43 } 44 if ((graph[0].objects[N].style != 2) && (graph[0].objects[N].color < 0)) {44 if ((graph[0].objects[N].style != KAPA_PLOT_POINTS) && (graph[0].objects[N].color < 0)) { 45 45 graph[0].objects[N].color = 0; 46 46 } -
trunk/Ohana/src/kapa2/src/PSObjects.c
r39926 r40165 1 1 # include "Ximage.h" 2 2 3 void PSBars (KapaGraphWidget *graph, Gobjects *object, FILE *f, int mode); 4 5 /* DrawRectangle & FillRectangle : take rectangle lower-left corner and widths 6 DrawCircle & FillCircle : take circle center and radius 7 */ 8 3 9 # define DrawLine(X1,Y1,X2,Y2) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f L\n", X1, graphic->dy - Y1, X2, graphic->dy - Y2)) 4 # define DrawRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f B\n", (dX), (dY), (X -0.5*dX), (graphic->dy-Y-0.5*dY)))5 # define FillRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f F\n", (dX), (dY), (X -0.5*dX), (graphic->dy-Y-0.5*dY)))10 # define DrawRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f B\n", (dX), (dY), (X), (graphic->dy-Y))) 11 # define FillRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f F\n", (dX), (dY), (X), (graphic->dy-Y))) 6 12 # define DrawCircle(X1,Y1,R) (fprintf (f, " %6.2f %6.2f %6.2f C\n", (X1), (graphic->dy - Y1), (R))) 7 13 # define FillCircle(X1,Y1,R) (fprintf (f, " %6.2f %6.2f %6.2f FC\n", (X1), (graphic->dy - Y1), (R))) … … 32 38 } 33 39 34 int PSObjectsN(KapaGraphWidget *graph, Gobjects *object, FILE *f) {35 40 void PSLineStyle (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 41 36 42 static char short_dash[] = "4 4"; 37 43 static char long_dash[] = "8 8"; … … 64 70 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(object->color)); 65 71 } 72 } 73 74 int PSObjectsN (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 75 76 PSLineStyle (graph, object, f); 66 77 67 78 switch (object->style) { … … 71 82 case KAPA_PLOT_HISTOGRAM: 72 83 PSHistogram (graph, object, f); 84 break; 85 case KAPA_PLOT_BARS_SOLID: 86 PSBars (graph, object, f, KAPA_PLOT_BARS_SOLID); 87 break; 88 case KAPA_PLOT_BARS_OUTLINE: 89 PSBars (graph, object, f, KAPA_PLOT_BARS_OUTLINE); 90 break; 91 case KAPA_PLOT_BARS_OUTFILL: 92 PSBars (graph, object, f, KAPA_PLOT_BARS_OUTFILL); 73 93 break; 74 94 case KAPA_PLOT_POINTS: … … 265 285 DrawLine (sx1, sy1, sxa, sy1); 266 286 DrawLine (sxa, sy1, sxa, sya); 267 268 # if (0) 269 sx0 = x[i]*mxi + y[i]*mxj + bx; 270 sy0 = x[i]*myi + y[i]*myj + by; 271 sx0 = MIN (MAX (sx0, X0), X1); 272 sy0 = MAX (MIN (sy0, Y0), Y1); 273 274 /* continue with rest of points */ 275 for (i++; i < object[0].Npts; i++) { 287 } 288 289 // uses object->color 290 # define HISTOGRAM_SOLID(X_VALUE, Y_VALUE, DX_VAL) { \ 291 /* histogram bar corners */ \ 292 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 293 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 294 double symin = Xaxis; \ 295 double symax = (Y_VALUE); \ 296 /* saturated values for corner coords: */ \ 297 sxmin = MIN (MAX (sxmin, X0), X1); \ 298 sxmax = MIN (MAX (sxmax, X0), X1); \ 299 symin = MAX (MIN (symin, Y0), Y1); \ 300 symax = MAX (MIN (symax, Y0), Y1); \ 301 double dy = fabs(symax - symin); \ 302 double ylow = MAX(symin, symax); \ 303 FillRectangle (sxmin, ylow, (DX_VAL), dy); } 304 305 // uses object->color 306 # define HISTOGRAM_OUTLINE(X_VALUE, Y_VALUE, DX_VAL) { \ 307 /* histogram bar corners */ \ 308 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 309 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 310 double symin = Xaxis; \ 311 double symax = (Y_VALUE); \ 312 /* saturated values for corner coords: */ \ 313 sxmin = MIN (MAX (sxmin, X0), X1); \ 314 sxmax = MIN (MAX (sxmax, X0), X1); \ 315 symin = MAX (MIN (symin, Y0), Y1); \ 316 symax = MAX (MIN (symax, Y0), Y1); \ 317 double dy = fabs(symax - symin); \ 318 double ylow = MAX(symin, symax); \ 319 DrawRectangle (sxmin, ylow, (DX_VAL), dy); } 320 321 # define HISTOGRAM_OUTFILL(X_VALUE, Y_VALUE, DX_VAL) { \ 322 /* histogram bar corners */ \ 323 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 324 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 325 double symin = Xaxis; \ 326 double symax = (Y_VALUE); \ 327 /* saturated values for corner coords: */ \ 328 sxmin = MIN (MAX (sxmin, X0), X1); \ 329 sxmax = MIN (MAX (sxmax, X0), X1); \ 330 symin = MAX (MIN (symin, Y0), Y1); \ 331 symax = MAX (MIN (symax, Y0), Y1); \ 332 double dy = fabs(symax - symin); \ 333 double ylow = MAX(symin, symax); \ 334 FillRectangle (sxmin, ylow, (DX_VAL), dy); \ 335 fprintf (f, "0.00 0.00 0.00 setrgbcolor\n"); \ 336 DrawRectangle (sxmin, ylow, (DX_VAL), dy); \ 337 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(object->color)); } 338 339 void PSBars (KapaGraphWidget *graph, Gobjects *object, FILE *f, int mode) { 340 341 double mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels 342 double mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); // slope of the x-axis in y-pixels (always 0 for now) 343 double myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels (always 0 for now) 344 double myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); // slope of the x-axis in x-pixels 345 346 // intercepts of axes 347 double bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 348 double bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 349 double byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 350 double byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 351 352 double bx = bxi + bxj; 353 double by = byi + byj; 354 355 // corner coords 356 double X0 = graph[0].axis[0].fx; 357 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 358 double Y0 = graph[0].axis[1].fy; 359 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 360 // NOTE: Y0 > Y1 (dfy is negative) 361 362 /* find the first valid datapoint */ 363 float *x = object[0].x; 364 float *y = object[0].y; 365 366 /* we are drawing bars which are filled rectangles of height y[i] and width 0.5*dx 367 one point at a time 368 369 I need to know the distance to the next and prev points to calculate dx 370 for the first point, dx is x[1] - x[0] 371 for the last point, dx is x[-1] - x[-2] (x[-1] is the last point) 372 for the rest, dx is 0.5*(x[i+1] - x[i-1]) 373 374 rather than working out complex on-the-fly logic, I want to find the first and last 375 valid point in an initial pass, then calculate the above for the remainder. 376 TBD: make an index vector of only valid points? 377 */ 378 379 int Ngood = 0; 380 ALLOCATE_PTR (goodPoint, int, object[0].Npts); 381 382 // x = ??, y = 0: this assumes the xaxis is parallel to the plot window (myi = 0) 383 // note: Y0 > Y1 : y runs from large on bottom to small on top 384 float Xaxis = by; 385 Xaxis = MAX (Y1, MIN (Xaxis, Y0)); 386 387 for (int i = 0; i < object[0].Npts; i++) { 276 388 if (!(finite(x[i]) && finite(y[i]))) continue; 277 sx1 = x[i]*mxi + y[i]*mxj + bx; 278 sy1 = x[i]*myi + y[i]*myj + by; 279 sx1 = MIN (MAX (sx1, X0), X1); 280 sy1 = MAX (MIN (sy1, Y0), Y1); 281 sxa = 0.5*(sx0 + sx1); 282 DrawLine (sx0, sy0, sxa, sy0); 283 DrawLine (sxa, sy0, sxa, sy1); 284 DrawLine (sxa, sy1, sx1, sy1); 285 sx0 = sx1; sy0 = sy1; 286 } 287 # endif 389 390 // coordinate on the screen of the point: 391 double sx1r = x[i]*mxi + y[i]*mxj + bx; 392 393 if (sx1r < X0) { 394 // point to the left, skip it 395 continue; 396 } 397 if (sx1r > X1) { 398 // point to the right, skip it 399 continue; 400 } 401 402 goodPoint[Ngood] = i; 403 Ngood ++; 404 } 405 406 if (Ngood == 0) { 407 free (goodPoint); 408 return; 409 } 410 411 // if we only have 1 point, draw bar half the width of the screen 412 // this works fine, but the auto limits for 1 value are somewhat silly 413 if (Ngood == 1) { 414 // coordinate on the screen of the point: 415 int n = goodPoint[0]; 416 double sx1r = x[n]*mxi + y[n]*mxj + bx; 417 double sy1r = x[n]*myi + y[n]*myj + by; 418 419 float dx = 0.5*object->size*(X1 - X0); 420 421 switch (mode) { 422 case KAPA_PLOT_BARS_SOLID: 423 HISTOGRAM_SOLID(sx1r, sy1r, dx); 424 break; 425 case KAPA_PLOT_BARS_OUTLINE: 426 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 427 break; 428 case KAPA_PLOT_BARS_OUTFILL: 429 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 430 break; 431 default: 432 HISTOGRAM_SOLID(sx1r, sy1r, dx); 433 break; 434 } 435 436 free (goodPoint); 437 return; 438 } 439 440 // first point: 441 { 442 int n; 443 n = goodPoint[1]; 444 double sx1r = x[n]*mxi + y[n]*mxj + bx; 445 446 n = goodPoint[0]; 447 double sx0r = x[n]*mxi + y[n]*mxj + bx; 448 double sy0r = x[n]*myi + y[n]*myj + by; 449 450 double dx = 0.5*object->size*(sx1r - sx0r); 451 452 switch (mode) { 453 case KAPA_PLOT_BARS_SOLID: 454 HISTOGRAM_SOLID(sx0r, sy0r, dx); 455 break; 456 case KAPA_PLOT_BARS_OUTLINE: 457 HISTOGRAM_OUTLINE(sx0r, sy0r, dx); 458 break; 459 case KAPA_PLOT_BARS_OUTFILL: 460 HISTOGRAM_OUTFILL(sx0r, sy0r, dx); 461 break; 462 default: 463 HISTOGRAM_SOLID(sx0r, sy0r, dx); 464 break; 465 } 466 } 467 468 for (int i = 1; i < Ngood - 1; i++) { 469 470 int n; 471 n = goodPoint[i + 1]; 472 double sx2r = x[n]*mxi + y[n]*mxj + bx; 473 474 n = goodPoint[i - 1]; 475 double sx0r = x[n]*mxi + y[n]*mxj + bx; 476 477 // below we have 2 factors of 0.5 (we want half of the average spacing) 478 double dx = 0.5*0.5*object->size*(sx2r - sx0r); 479 480 n = goodPoint[i]; 481 double sx1r = x[n]*mxi + y[n]*mxj + bx; 482 double sy1r = x[n]*myi + y[n]*myj + by; 483 484 switch (mode) { 485 case KAPA_PLOT_BARS_SOLID: 486 HISTOGRAM_SOLID(sx1r, sy1r, dx); 487 break; 488 case KAPA_PLOT_BARS_OUTLINE: 489 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 490 break; 491 case KAPA_PLOT_BARS_OUTFILL: 492 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 493 break; 494 default: 495 HISTOGRAM_SOLID(sx1r, sy1r, dx); 496 break; 497 } 498 } 499 500 // last point: 501 { 502 int n; 503 n = goodPoint[Ngood - 1]; 504 double sx1r = x[n]*mxi + y[n]*mxj + bx; 505 double sy1r = x[n]*myi + y[n]*myj + by; 506 507 n = goodPoint[Ngood - 2]; 508 double sx0r = x[n]*mxi + y[n]*mxj + bx; 509 510 double dx = 0.5*object->size*(sx1r - sx0r); 511 512 switch (mode) { 513 case KAPA_PLOT_BARS_SOLID: 514 HISTOGRAM_SOLID(sx1r, sy1r, dx); 515 break; 516 case KAPA_PLOT_BARS_OUTLINE: 517 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 518 break; 519 case KAPA_PLOT_BARS_OUTFILL: 520 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 521 break; 522 default: 523 HISTOGRAM_SOLID(sx1r, sy1r, dx); 524 break; 525 } 526 } 527 free (goodPoint); 528 return; 288 529 } 289 530 … … 310 551 by = byi + byj; 311 552 312 Graphic *graphic = GetGraphic(); 313 553 // scaled colors use the colormap defined for the graphic 314 554 ALLOCATE (pixel1, float, graphic[0].Npixels); 315 555 ALLOCATE (pixel2, float, graphic[0].Npixels); … … 347 587 } 348 588 D = scaleSize ? dz*z[i] : ds; 349 DrawRectangle (sx , sy, 2*D, 2*D);589 DrawRectangle (sx - D, sy - D, 2*D, 2*D); 350 590 } 351 591 } … … 605 845 } 606 846 D = scaleSize ? dz*z[i] : ds; 607 FillRectangle (sx , sy, 2*D, 2*D);847 FillRectangle (sx - D, sy - D, 2*D, 2*D); 608 848 } 609 849 } -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r39926 r40165 2 2 3 3 # define DrawLine(BUF,X1,Y1,X2,Y2) (bDrawLine (BUF, (X1), (Y1), (X2), (Y2))) 4 # define DrawRectangle(BUF,X,Y,dX,dY) (bDrawRectOpen (BUF, (X -0.5*dX), (Y-0.5*dY), (X+0.5*dX), (Y+0.5*dY)))5 # define FillRectangle(BUF,X,Y,dX,dY) (bDrawRectFill (BUF, (X -0.5*dX), (Y-0.5*dY), (X+0.5*dX+1), (Y+0.5*dY+1)))4 # define DrawRectangle(BUF,X,Y,dX,dY) (bDrawRectOpen (BUF, (X), (Y), (X+dX), (Y+dY))) 5 # define FillRectangle(BUF,X,Y,dX,dY) (bDrawRectFill (BUF, (X), (Y), (X+dX+1), (Y+dY+1))) 6 6 # define DrawCircle(BUF,X1,Y1,R) (bDrawCircle (BUF, (X1), (Y1), (R))) 7 7 # define FillCircle(BUF,X1,Y1,R) (bDrawCircleFill (BUF, (X1), (Y1), (R))) … … 9 9 # define OpenTriangle(BUF,X1,Y1,X2,Y2,X3,Y3) (bDrawTriOpen (BUF, (X1), (Y1), (X2), (Y2), (X3), (Y3))) 10 10 11 # define CONNECT 012 # define HISTOGRAM 113 # define POINTS 214 15 11 static Graphic *graphic; 16 12 … … 42 38 case KAPA_PLOT_HISTOGRAM: 43 39 bDrawHistogram (buffer, graph, object); 40 break; 41 case KAPA_PLOT_BARS_SOLID: 42 bDrawBars (buffer, graph, object, KAPA_PLOT_BARS_SOLID); 43 break; 44 case KAPA_PLOT_BARS_OUTLINE: 45 bDrawBars (buffer, graph, object, KAPA_PLOT_BARS_OUTLINE); 46 break; 47 case KAPA_PLOT_BARS_OUTFILL: 48 bDrawBars (buffer, graph, object, KAPA_PLOT_BARS_OUTFILL); 44 49 break; 45 50 case KAPA_PLOT_POINTS: … … 235 240 DrawLine (buffer, sx1, sy1, sxa, sy1); 236 241 DrawLine (buffer, sxa, sy1, sxa, sya); 237 238 # if (0) 239 sx0 = x[i]*mxi + y[i]*mxj + bx; 240 sy0 = x[i]*myi + y[i]*myj + by; 241 sx0 = MIN (MAX (sx0, X0), X1); 242 sy0 = MAX (MIN (sy0, Y0), Y1); 243 244 /* continue with rest of points */ 245 for (i++; i < object[0].Npts; i++) { 242 } 243 244 // uses object->color 245 # define HISTOGRAM_SOLID(X_VALUE, Y_VALUE, DX_VAL) { \ 246 /* histogram bar corners */ \ 247 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 248 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 249 double symin = Xaxis; \ 250 double symax = (Y_VALUE); \ 251 /* saturated values for corner coords: */ \ 252 sxmin = MIN (MAX (sxmin, X0), X1); \ 253 sxmax = MIN (MAX (sxmax, X0), X1); \ 254 symin = MAX (MIN (symin, Y0), Y1); \ 255 symax = MAX (MIN (symax, Y0), Y1); \ 256 double dy = fabs(symax - symin); \ 257 double ylow = MIN(symin, symax); \ 258 FillRectangle (buffer, sxmin, ylow, (DX_VAL), dy); } 259 260 // uses object->color 261 # define HISTOGRAM_OUTLINE(X_VALUE, Y_VALUE, DX_VAL) { \ 262 /* histogram bar corners */ \ 263 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 264 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 265 double symin = Xaxis; \ 266 double symax = (Y_VALUE); \ 267 /* saturated values for corner coords: */ \ 268 sxmin = MIN (MAX (sxmin, X0), X1); \ 269 sxmax = MIN (MAX (sxmax, X0), X1); \ 270 symin = MAX (MIN (symin, Y0), Y1); \ 271 symax = MAX (MIN (symax, Y0), Y1); \ 272 double dy = fabs(symax - symin); \ 273 double ylow = MIN(symin, symax); \ 274 DrawRectangle (buffer, sxmin, ylow, (DX_VAL), dy); } 275 276 # define HISTOGRAM_OUTFILL(X_VALUE, Y_VALUE, DX_VAL) { \ 277 /* histogram bar corners */ \ 278 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 279 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 280 double symin = Xaxis; \ 281 double symax = (Y_VALUE); \ 282 /* saturated values for corner coords: */ \ 283 sxmin = MIN (MAX (sxmin, X0), X1); \ 284 sxmax = MIN (MAX (sxmax, X0), X1); \ 285 symin = MAX (MIN (symin, Y0), Y1); \ 286 symax = MAX (MIN (symax, Y0), Y1); \ 287 double dy = fabs(symax - symin); \ 288 double ylow = MIN(symin, symax); \ 289 FillRectangle (buffer, sxmin, ylow, (DX_VAL), dy); \ 290 bDrawSetColor (buffer, graphic->fore); \ 291 DrawRectangle (buffer, sxmin, ylow, (DX_VAL), dy); \ 292 bDrawSetColor (buffer, object[0].color); } 293 294 void bDrawBars (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object, int mode) { 295 296 double mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels 297 double mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); // slope of the x-axis in y-pixels (always 0 for now) 298 double myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels (always 0 for now) 299 double myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); // slope of the x-axis in x-pixels 300 301 // intercepts of axes 302 double bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 303 double bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 304 double byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 305 double byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 306 307 double bx = bxi + bxj; 308 double by = byi + byj; 309 310 // corner coords 311 double X0 = graph[0].axis[0].fx; 312 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 313 double Y0 = graph[0].axis[1].fy; 314 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 315 316 /* find the first valid datapoint */ 317 float *x = object[0].x; 318 float *y = object[0].y; 319 320 /* we are drawing bars which are filled rectangles of height y[i] and width 0.5*dx 321 one point at a time 322 323 I need to know the distance to the next and prev points to calculate dx 324 for the first point, dx is x[1] - x[0] 325 for the last point, dx is x[-1] - x[-2] (x[-1] is the last point) 326 for the rest, dx is 0.5*(x[i+1] - x[i-1]) 327 328 rather than working out complex on-the-fly logic, I want to draw the first and last 329 valid points in an initial pass, then calculate the above for the remainder. 330 331 First, make an index vector of only valid points 332 */ 333 334 int Ngood = 0; 335 ALLOCATE_PTR (goodPoint, int, object[0].Npts); 336 337 // x = ??, y = 0: this assumes the xaxis is parallel to the plot window (myi = 0) 338 // since y runs from large on bottom to small on top, this is slightly backwards 339 float Xaxis = by; 340 Xaxis = MAX (Y1, MIN (Xaxis, Y0)); // MIN & MAX reversed for neg y dir 341 342 for (int i = 0; i < object[0].Npts; i++) { 246 343 if (!(finite(x[i]) && finite(y[i]))) continue; 247 sx1 = x[i]*mxi + y[i]*mxj + bx; 248 sy1 = x[i]*myi + y[i]*myj + by; 249 sx1 = MIN (MAX (sx1, X0), X1); 250 sy1 = MAX (MIN (sy1, Y0), Y1); 251 sxa = 0.5*(sx0 + sx1); 252 DrawLine (buffer, sx0, sy0, sxa, sy0); 253 DrawLine (buffer, sxa, sy0, sxa, sy1); 254 DrawLine (buffer, sxa, sy1, sx1, sy1); 255 sx0 = sx1; sy0 = sy1; 256 } 257 # endif 344 345 // coordinate on the screen of the point: 346 double sx1r = x[i]*mxi + y[i]*mxj + bx; 347 348 if (sx1r < X0) { 349 // point to the left, skip it 350 continue; 351 } 352 if (sx1r > X1) { 353 // point to the right, skip it 354 continue; 355 } 356 357 goodPoint[Ngood] = i; 358 Ngood ++; 359 } 360 361 if (Ngood == 0) { 362 free (goodPoint); 363 return; 364 } 365 366 // if we only have 1 point, draw bar half the width of the screen 367 // this works fine, but the auto limits for 1 value are somewhat silly 368 if (Ngood == 1) { 369 // coordinate on the screen of the point: 370 int n = goodPoint[0]; 371 double sx1r = x[n]*mxi + y[n]*mxj + bx; 372 double sy1r = x[n]*myi + y[n]*myj + by; 373 374 float dx = 0.5*object->size*(X1 - X0); 375 376 switch (mode) { 377 case KAPA_PLOT_BARS_SOLID: 378 HISTOGRAM_SOLID(sx1r, sy1r, dx); 379 break; 380 case KAPA_PLOT_BARS_OUTLINE: 381 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 382 break; 383 case KAPA_PLOT_BARS_OUTFILL: 384 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 385 break; 386 default: 387 HISTOGRAM_SOLID(sx1r, sy1r, dx); 388 break; 389 } 390 391 free (goodPoint); 392 return; 393 } 394 395 // first point: 396 { 397 int n; 398 n = goodPoint[1]; 399 double sx1r = x[n]*mxi + y[n]*mxj + bx; 400 401 n = goodPoint[0]; 402 double sx0r = x[n]*mxi + y[n]*mxj + bx; 403 double sy0r = x[n]*myi + y[n]*myj + by; 404 405 double dx = 0.5*object->size*(sx1r - sx0r); 406 407 switch (mode) { 408 case KAPA_PLOT_BARS_SOLID: 409 HISTOGRAM_SOLID(sx0r, sy0r, dx); 410 break; 411 case KAPA_PLOT_BARS_OUTLINE: 412 HISTOGRAM_OUTLINE(sx0r, sy0r, dx); 413 break; 414 case KAPA_PLOT_BARS_OUTFILL: 415 HISTOGRAM_OUTFILL(sx0r, sy0r, dx); 416 break; 417 default: 418 HISTOGRAM_SOLID(sx0r, sy0r, dx); 419 break; 420 } 421 } 422 423 for (int i = 1; i < Ngood - 1; i++) { 424 425 int n; 426 n = goodPoint[i + 1]; 427 double sx2r = x[n]*mxi + y[n]*mxj + bx; 428 429 n = goodPoint[i - 1]; 430 double sx0r = x[n]*mxi + y[n]*mxj + bx; 431 432 // below we have 2 factors of 0.5 (we want half of the average spacing) 433 double dx = 0.5*0.5*object->size*(sx2r - sx0r); 434 435 n = goodPoint[i]; 436 double sx1r = x[n]*mxi + y[n]*mxj + bx; 437 double sy1r = x[n]*myi + y[n]*myj + by; 438 439 switch (mode) { 440 case KAPA_PLOT_BARS_SOLID: 441 HISTOGRAM_SOLID(sx1r, sy1r, dx); 442 break; 443 case KAPA_PLOT_BARS_OUTLINE: 444 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 445 break; 446 case KAPA_PLOT_BARS_OUTFILL: 447 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 448 break; 449 default: 450 HISTOGRAM_SOLID(sx1r, sy1r, dx); 451 break; 452 } 453 } 454 455 // last point: 456 { 457 int n; 458 n = goodPoint[Ngood - 1]; 459 double sx1r = x[n]*mxi + y[n]*mxj + bx; 460 double sy1r = x[n]*myi + y[n]*myj + by; 461 462 n = goodPoint[Ngood - 2]; 463 double sx0r = x[n]*mxi + y[n]*mxj + bx; 464 465 double dx = 0.5*object->size*(sx1r - sx0r); 466 467 switch (mode) { 468 case KAPA_PLOT_BARS_SOLID: 469 HISTOGRAM_SOLID(sx1r, sy1r, dx); 470 break; 471 case KAPA_PLOT_BARS_OUTLINE: 472 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 473 break; 474 case KAPA_PLOT_BARS_OUTFILL: 475 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 476 break; 477 default: 478 HISTOGRAM_SOLID(sx1r, sy1r, dx); 479 break; 480 } 481 } 482 free (goodPoint); 483 return; 258 484 } 259 485 … … 280 506 by = byi + byj; 281 507 282 Graphic *graphic = GetGraphic(); 283 508 // scaled colors use the colormap defined for the graphic 284 509 ALLOCATE (pixel1, unsigned char, graphic[0].Npixels); 285 510 ALLOCATE (pixel2, unsigned char, graphic[0].Npixels); … … 293 518 } 294 519 295 /**** point s are scaled by object.z***/520 /**** point sizes are scaled by object.size, colors by object.color ***/ 296 521 int scaleSize = (object[0].size < 0); 297 522 int scaleColor = (object[0].color < 0); … … 317 542 } 318 543 D = scaleSize ? dz*z[i] : ds; 319 DrawRectangle (buffer, sx , sy, 2*D, 2*D);544 DrawRectangle (buffer, sx - D, sy - D, 2*D, 2*D); // DrawRectangle takes corner point 320 545 // plot range saturated by bDrawRectOpen 321 546 } … … 611 836 } 612 837 D = scaleSize ? dz*z[i] : ds; 613 FillRectangle (buffer, sx , sy, 2*D, 2*D);838 FillRectangle (buffer, sx - D, sy - D, 2*D, 2*D); 614 839 // plot range saturated by bDrawRectFill 615 840 } -
trunk/Ohana/src/libkapa/include/kapa.h
r40106 r40165 292 292 void bDrawBufferFree (bDrawBuffer *buffer); 293 293 void bDrawSetBuffer (bDrawBuffer *buffer); 294 void bDrawSetColor (bDrawBuffer *buffer, bDrawColor color); 294 295 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt); 295 296 void bDrawPoint (bDrawBuffer *buffer, int x, int y); -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r39926 r40165 94 94 graphdata[0].xmax = graphdata[0].ymax = 1.0; 95 95 96 graphdata[0].style = graphdata[0].ptype = 2; 96 graphdata[0].style = KAPA_PLOT_POINTS; 97 graphdata[0].ptype = KAPA_POINT_BOX_SOLID; 97 98 graphdata[0].ltype = graphdata[0].color = 0; 98 99 graphdata[0].etype = graphdata[0].ebar = 0; -
trunk/Ohana/src/libkapa/src/PSRotFont.c
r39457 r40165 90 90 /* check for special characters */ 91 91 if (!code && !protect) { 92 /* su perscript character (^) */92 /* subscript character (_) */ 93 93 if (N == 94) { 94 94 PSDumpRotSegment (f, segment, &Nseg); 95 SetRotFont (currentname, (int)(0.8*currentsize));95 PSSetFont (f, currentname, (int)(0.8*currentsize)); 96 96 currentfont = GetRotFontData (¤tscale); 97 97 Yoff = 0.75*currentscale*dY; 98 98 fprintf (f, "0 %d rmoveto\n", Yoff); 99 99 YoffBase += Yoff; 100 PSSetFont (f, currentname, currentsize);101 continue; 102 } 103 /* su bscript character (_) */100 // PSSetFont (f, currentname, currentsize); 101 continue; 102 } 103 /* superscript character (^) */ 104 104 if (N == 95) { 105 105 PSDumpRotSegment (f, segment, &Nseg); 106 SetRotFont (currentname, (int)(0.8*currentsize));106 PSSetFont (f, currentname, (int)(0.8*currentsize)); 107 107 currentfont = GetRotFontData (¤tscale); 108 108 Yoff = -0.5*currentscale*dY; 109 109 fprintf (f, "0 %d rmoveto\n", Yoff); 110 110 YoffBase += Yoff; 111 PSSetFont (f, currentname, currentsize);111 // PSSetFont (f, currentname, currentsize); 112 112 continue; 113 113 } … … 115 115 if (N == 124) { 116 116 PSDumpRotSegment (f, segment, &Nseg); 117 SetRotFont (currentname, basesize);117 PSSetFont (f, currentname, basesize); 118 118 currentfont = GetRotFontData (¤tscale); 119 119 fprintf (f, "0 %d rmoveto\n", -YoffBase); 120 120 YoffBase = 0; 121 PSSetFont (f, currentname, currentsize);121 // PSSetFont (f, currentname, currentsize); 122 122 continue; 123 123 } … … 145 145 PSDumpRotSegment (f, segment, &Nseg); 146 146 if (string[i+1] == 'h') { 147 SetRotFont ("helvetica", currentsize);148 currentfont = GetRotFontData (¤tscale); 149 PSSetFont (f, currentname, currentsize);147 PSSetFont (f, "helvetica", currentsize); 148 currentfont = GetRotFontData (¤tscale); 149 // PSSetFont (f, currentname, currentsize); 150 150 } 151 151 if (string[i+1] == 't') { 152 SetRotFont ("times", currentsize);153 currentfont = GetRotFontData (¤tscale); 154 PSSetFont (f, currentname, currentsize);152 PSSetFont (f, "times", currentsize); 153 currentfont = GetRotFontData (¤tscale); 154 // PSSetFont (f, currentname, currentsize); 155 155 } 156 156 if (string[i+1] == 'c') { 157 SetRotFont ("courier", currentsize);158 currentfont = GetRotFontData (¤tscale); 159 PSSetFont (f, currentname, currentsize);157 PSSetFont (f, "courier", currentsize); 158 currentfont = GetRotFontData (¤tscale); 159 // PSSetFont (f, currentname, currentsize); 160 160 } 161 161 if (string[i+1] == 's') { 162 SetRotFont ("symbol", currentsize);163 currentfont = GetRotFontData (¤tscale); 164 PSSetFont (f, currentname, currentsize);162 PSSetFont (f, "symbol", currentsize); 163 currentfont = GetRotFontData (¤tscale); 164 // PSSetFont (f, currentname, currentsize); 165 165 } 166 166 i++; … … 176 176 fprintf (f, "stroke grestore\n"); 177 177 free (segment); 178 SetRotFont (basename, basesize);178 PSSetFont (f, basename, basesize); 179 179 } 180 180 -
trunk/Ohana/src/libkapa/src/bDrawFuncs.c
r39926 r40165 76 76 // } 77 77 78 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt) { 78 // "bDrawColor color" is one of the hardwired colors in KapaColors.c 79 void bDrawSetColor (bDrawBuffer *buffer, bDrawColor color) { 79 80 buffer->bColor = color; 80 81 buffer->bColor_R = buffer->palette[color].red; 81 82 buffer->bColor_G = buffer->palette[color].green; 82 83 buffer->bColor_B = buffer->palette[color].blue; 84 85 return; 86 } 87 88 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt) { 89 bDrawSetColor (buffer, color); 83 90 84 91 buffer->bWeight = lw; … … 121 128 } 122 129 130 // x1,y1 is lower-left corner, x2,y2 is upper-right corner 123 131 void bDrawRectOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 124 132 -
trunk/Ohana/src/opihi/cmd.astro/cdot.c
r34088 r40165 22 22 23 23 /* set point style and errorbar mode (these are NOT sticky) */ 24 graphmode.style = 2;24 graphmode.style = KAPA_PLOT_POINTS; /* points */ 25 25 graphmode.etype = 0; 26 26 -
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r34584 r40165 276 276 /* send the line segments as connect-points */ 277 277 Xvec.Nelements = Yvec.Nelements = N; 278 graphmode.style = 2; /* points */279 graphmode.ptype = 100; /* connect a pair*/278 graphmode.style = KAPA_PLOT_POINTS; /* points */ 279 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 280 280 graphmode.etype = 0; 281 281 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/cmd.astro/cline.c
r34088 r40165 20 20 21 21 /* set point style and errorbar mode (these are NOT sticky) */ 22 graphmode.style = 0;22 graphmode.style = KAPA_PLOT_CONNECT; 23 23 graphmode.etype = 0; 24 24 -
trunk/Ohana/src/opihi/cmd.astro/czplot.c
r35757 r40165 111 111 Zvec.Nelements = Npts; 112 112 113 graphmode.style = 2;113 graphmode.style = KAPA_PLOT_POINTS; /* points */ 114 114 graphmode.size = -1; /* point size determined by Zvec */ 115 115 graphmode.etype = 0; … … 236 236 Zvec.Nelements = Npts; 237 237 238 graphmode.style = 2;238 graphmode.style = KAPA_PLOT_POINTS; 239 239 graphmode.color = -1; /* point color determined by Zvec */ 240 240 graphmode.etype = 0; -
trunk/Ohana/src/opihi/cmd.data/Makefile
r40007 r40165 102 102 $(SRC)/peak.$(ARCH).o \ 103 103 $(SRC)/periodogram.$(ARCH).o \ 104 $(SRC)/periodogram-fm.$(ARCH).o \ 104 105 $(SRC)/plot.$(ARCH).o \ 105 106 $(SRC)/dot.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/dot.c
r33963 r40165 29 29 30 30 /* set point style and errorbar mode (these are NOT sticky) */ 31 graphmode.style = 2;31 graphmode.style = KAPA_PLOT_POINTS; 32 32 graphmode.etype = 0; 33 33 -
trunk/Ohana/src/opihi/cmd.data/grid.c
r34584 r40165 175 175 176 176 Xvec.Nelements = Yvec.Nelements = N; 177 graphmode.style = 2; /* points */178 graphmode.ptype = 100; /* connect a pair*/177 graphmode.style = KAPA_PLOT_POINTS; /* points */ 178 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 179 179 graphmode.etype = 0; 180 180 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/cmd.data/init.c
r40007 r40165 91 91 int peak PROTO((int, char **)); 92 92 int periodogram PROTO((int, char **)); 93 int periodogram_fm PROTO((int, char **)); 93 94 int plot PROTO((int, char **)); 94 95 int dot PROTO((int, char **)); … … 270 271 {1, "parity", parity, "set image parity"}, 271 272 {1, "peak", peak, "find vector peak in range"}, 272 {1, "periodogram", periodogram, "measure periods in unevenly sampled data"}, 273 {1, "periodogram", periodogram, "measure periods in unevenly sampled data (Lomb-Scargle)"}, 274 {1, "periodogram_fm", periodogram_fm, "measure periods in unevenly sampled data (generalized Lomb-Scargle; floating mean)"}, 273 275 {1, "plot", plot, "plot a pair of vectors"}, 274 276 {1, "png", jpeg, "convert display graphic to PNG"}, -
trunk/Ohana/src/opihi/cmd.data/line.c
r33662 r40165 33 33 34 34 /* set point style and errorbar mode (these are NOT sticky) */ 35 graphmode.style = 0;35 graphmode.style = KAPA_PLOT_CONNECT; 36 36 graphmode.etype = 0; 37 37 -
trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh
r27435 r40165 1 2 if (not($?PLOT)) set PLOT = 0 1 3 2 4 list tests … … 28 30 echo "OFFSET: {$peakpos - $P}" 29 31 end 32 33 if ($PLOT) 34 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 35 end 30 36 end 31 37 … … 99 105 100 106 periodogram t f 2 30 period power 107 108 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 109 # lim -n 1 period power; clear; box; plot period power 110 111 peak -q period power 112 113 if (abs ($peakpos - $P) > 0.05) 114 $PASS = 0 115 end 116 end 117 118 # test using random samples, offset start, non-zero DC 119 macro test5 120 $PASS = 1 121 break -auto off 122 123 local P PI 124 $PI = 3.14159265359 125 $P = 15.0 126 127 delete -q x t f period power 128 129 create x 500 800 130 set t = 300 * rnd(x) + 500 131 set f = sin(2*$PI*t/$P) + 0.5 132 133 periodogram t f 2 30 period power 134 135 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 136 # lim -n 1 period power; clear; box; plot period power 137 138 peak -q period power 139 140 if (abs ($peakpos - $P) > 0.05) 141 $PASS = 0 142 end 143 end 144 145 # test using random samples, offset start, non-zero DC, some noise 146 macro test6 147 $PASS = 1 148 break -auto off 149 150 local P PI 151 $PI = 3.14159265359 152 $P = 15.0 153 154 delete -q x t f period power 155 156 create x 500 800 157 set t = 300 * rnd(x) + 500 158 set fraw = sin(2*$PI*t/$P) + 0.5 159 160 # 0.05 : peakpos = 14.95 161 # 0.10 : peakpos = 15.04 ( 162 gaussdev df t[] 0.0 0.25 163 set f = fraw + df 164 165 periodogram t f 2 30 period power 166 167 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 168 # lim -n 1 period power; clear; box; plot period power 169 170 peak -q period power 171 172 if (abs ($peakpos - $P) > 0.05) 173 $PASS = 0 174 end 175 end 176 177 # test using fewer random samples, offset start, non-zero DC, some noise 178 macro test7 179 $PASS = 1 180 break -auto off 181 182 local P PI 183 $PI = 3.14159265359 184 $P = 15.0 185 186 delete -q x t f period power 187 188 create x 0 100 189 set t = 100 * rnd(x) 190 set fraw = sin(2*$PI*t/$P) + 0.5 191 192 # 0.05 : peakpos = 14.95 193 # 0.10 : peakpos = 15.04 ( 194 gaussdev df t[] 0.0 0.25 195 set f = fraw + df 196 197 periodogram t f 2 30 period power 198 199 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 200 # lim -n 1 period power; clear; box; plot period power 201 202 peak -q period power 203 204 if (abs ($peakpos - $P) > 0.05) 205 $PASS = 0 206 end 207 end 208 209 # test using fewer random samples, high frequency, non-zero DC, some noise 210 macro test8 211 if ($0 != 2) 212 echo "USAGE: test8: Ndays") 213 break 214 end 215 216 local Ndays 217 $Ndays = $1 218 219 $PASS = 1 220 break -auto off 221 222 local P PI 223 $PI = 3.14159265359 224 $P = 0.8*rnd(0) + 0.2 225 $trueP = $P 226 227 delete -q x t f period power 228 229 create x 0 $Ndays 230 231 # t is a time in days, but we always have 4 within 1 hour: 232 set t0 = int(100 * rnd(x)) 233 set dtx = (3/24) * rnd(x) 234 set t0 = t0 + dtx 235 236 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 237 set dt2 = (15.0 / 1440) * rnd(x) + (15 + 7.5) / 1440 238 set dt3 = (15.0 / 1440) * rnd(x) + (30 + 7.5) / 1440 239 240 delete -q t 241 concat t0 t 242 set tmp = t0 + dt1; concat tmp t 243 set tmp = t0 + dt2; concat tmp t 244 set tmp = t0 + dt3; concat tmp t 245 246 set fraw = sin(2*$PI*t/$P) + 0.5 247 248 # 0.05 : peakpos = 14.95 249 # 0.10 : peakpos = 15.04 ( 250 gaussdev df t[] 0.0 0.25 251 set f = fraw + df 252 253 periodogram t f 0.1 2.0 period power 101 254 102 255 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f -
trunk/Ohana/src/opihi/cmd.data/zplot.c
r38062 r40165 117 117 118 118 /* point size determined by Zvec */ 119 graphmode.style = 2; /* plotpoints */119 graphmode.style = KAPA_PLOT_POINTS; /* points */ 120 120 graphmode.size = -1; /* point size determined by Zvec */ 121 121 PlotVectorTriplet (kapa, xvec, yvec, &Zvec, mask, &graphmode); … … 226 226 227 227 /* point size determined by Zvec */ 228 graphmode.style = 2; /* plot points */228 graphmode.style = KAPA_PLOT_POINTS; /* plot points */ 229 229 graphmode.color = -1; /* point color determined by Zvec */ 230 230 graphmode.etype = 0; /* no errorbars */ -
trunk/Ohana/src/opihi/dvo/catalog.c
r38471 r40165 390 390 REALLOCATE (Zvec.elements, float, MAX (Zvec.Nelements, 1)); 391 391 392 graphmode.style = 2; /* set style topoints */392 graphmode.style = KAPA_PLOT_POINTS; /* points */ 393 393 graphmode.size = -1; /* point size determined by Zvec */ 394 394 graphmode.etype = 0; /* no errorbars */ -
trunk/Ohana/src/opihi/dvo/dmt.c
r39457 r40165 150 150 vec5[0].Nelements = Dvec.Nelements; 151 151 } else { 152 graphmode.style = 2; /* set style topoints */152 graphmode.style = KAPA_PLOT_POINTS; /* points */ 153 153 PlotVector (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 154 154 -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r39457 r40165 92 92 graphdata.ymin = minDelta; 93 93 graphdata.ymax = maxDelta; 94 graph data.style = 2;95 graph data.ptype = 2;94 graphmode.style = KAPA_PLOT_POINTS; /* points */ 95 graphmode.ptype = KAPA_POINT_CIRCLE_SOLID; /* connect pairs of points */ 96 96 KapaClearSections (kapa); 97 97 KapaSetFont (kapa, "helvetica", 14); … … 192 192 graphdata.ymin = minDelta; 193 193 graphdata.ymax = maxDelta; 194 graph data.style = 2;195 graph data.ptype = 2;194 graphmode.style = KAPA_PLOT_POINTS; /* points */ 195 graphmode.ptype = KAPA_POINT_CIRCLE_SOLID; /* connect pairs of points */ 196 196 } 197 197 … … 315 315 deltaFit[i] = C0 + C1*colorFit[i]; 316 316 } 317 graph data.style = 0;317 graphmode.style = KAPA_PLOT_CONNECT; /* lines */ 318 318 graphdata.color = KapaColorByName ("red"); 319 319 … … 329 329 KapaSetFont (kapa, "helvetica", 14); 330 330 331 graph data.style = 2;331 graphmode.style = KAPA_PLOT_POINTS; /* points */ 332 332 graphdata.color = KapaColorByName ("black"); 333 333 -
trunk/Ohana/src/opihi/dvo/fitsed.c
r39457 r40165 157 157 if (!GetGraph (&graphdata, &kapa, NULL)) return (FALSE); 158 158 SetLimitsRaw (wavecode, NULL, Nfilter, &graphdata); 159 graphdata.style = 2;160 graphdata.ptype = 2;159 graphdata.style = KAPA_PLOT_POINTS; /* points */ 160 graphdata.ptype = KAPA_POINT_CIRCLE_SOLID; 161 161 KapaClearSections (kapa); 162 162 magSection.name = strcreate ("mag"); -
trunk/Ohana/src/opihi/dvo/images.c
r37807 r40165 352 352 Xvec.Nelements = Yvec.Nelements = N; 353 353 if (N > 0) { 354 graphmode.style = 2; /* points */355 graphmode.ptype = 100; /* connect pairs of points */354 graphmode.style = KAPA_PLOT_POINTS; /* points */ 355 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 356 356 graphmode.etype = 0; 357 357 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/dvo/imbox.c
r39926 r40165 156 156 Xvec.Nelements = Yvec.Nelements = Npts; 157 157 if (Npts > 0) { 158 graphmode.style = 2; /* points */159 graphmode.ptype = 100; /* connect pairs of points */158 graphmode.style = KAPA_PLOT_POINTS; /* points */ 159 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 160 160 graphmode.etype = 0; 161 161 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/dvo/imdense.c
r39926 r40165 59 59 Xvec.Nelements = Yvec.Nelements = N; 60 60 if (N > 0) { 61 graphmode.style = 2; /* points */61 graphmode.style = KAPA_PLOT_POINTS; /* points */ 62 62 graphmode.etype = 0; 63 63 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/dvo/imstats.c
r37807 r40165 51 51 if (AutoLimits) SetLimits (&Xvec, &Yvec, &graphmode); 52 52 53 graphmode.style = 2;53 graphmode.style = KAPA_PLOT_POINTS; /* points */ 54 54 graphmode.etype = 0; 55 55 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/dvo/paverage.c
r39457 r40165 81 81 return (FALSE); 82 82 } 83 graphmode.style = 2; /* set style topoints */83 graphmode.style = KAPA_PLOT_POINTS; /* points */ 84 84 graphmode.size = -1; /* point size determined by Zvec */ 85 85 graphmode.etype = 0; /* no errorbars */ -
trunk/Ohana/src/opihi/dvo/pmeasure.c
r39457 r40165 154 154 return (FALSE); 155 155 } 156 graphmode.style = 2; /* set style topoints */156 graphmode.style = KAPA_PLOT_POINTS; /* points */ 157 157 graphmode.size = -1; /* point size determined by Zvec */ 158 158 graphmode.etype = 0; /* no errorbars */ -
trunk/Ohana/src/opihi/dvo/procks.c
r39457 r40165 111 111 Yvec.Nelements = Xvec.Nelements = N; 112 112 113 graphmode.style = 2; /* set style topoints */113 graphmode.style = KAPA_PLOT_POINTS; /* points */ 114 114 graphmode.etype = 0; /* no errorbars */ 115 115 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); … … 142 142 Yvec.Nelements = Xvec.Nelements = N; 143 143 144 graphmode.style = 2; /* set style topoints */145 graphmode.ptype = 100; /* connect pairs */144 graphmode.style = KAPA_PLOT_POINTS; /* points */ 145 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 146 146 graphmode.etype = 0; /* no errorbars */ 147 147 -
trunk/Ohana/src/opihi/dvo/showtile.c
r39457 r40165 78 78 Xvec.Nelements = Yvec.Nelements = N; 79 79 if (N > 0) { 80 graphmode.style = 2; /* points */81 graphmode.ptype = 100; /* connect pairs of points */80 graphmode.style = KAPA_PLOT_POINTS; /* points */ 81 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 82 82 graphmode.etype = 0; 83 83 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/dvo/simage.c
r37807 r40165 118 118 } 119 119 120 graphmode.style = 2;120 graphmode.style = KAPA_PLOT_POINTS; 121 121 graphmode.size = -1; 122 122 graphmode.etype = 0; -
trunk/Ohana/src/opihi/dvo/skycat.c
r39926 r40165 121 121 Xvec.Nelements = Yvec.Nelements = Npts; 122 122 if (Npts > 0) { 123 graphmode.style = 2; /* points */124 graphmode.ptype = 100; /* connect pairs of points */123 graphmode.style = KAPA_PLOT_POINTS; /* points */ 124 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 125 125 graphmode.etype = 0; 126 126 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
trunk/Ohana/src/opihi/pantasks/JobIDOps.c
r23557 r40165 1 1 # include "pantasks.h" 2 2 3 # define MAX_N_JOBS 100003 # define MAX_N_JOBS 50000 4 4 static char *JobIDList; 5 5 static int JobIDPtr; -
trunk/Ohana/src/opihi/pantasks/test/nice_remote.sh
r32632 r40165 10 10 periods -timeout 20 11 11 active true 12 npending 5 12 npending 50 13 13 14 14 stdout tmp.txt … … 38 38 task meantask_local 39 39 command sleep 10 40 host anyhost40 host local 41 41 42 42 periods -poll 0.1 … … 44 44 periods -timeout 20 45 45 active true 46 npending 5 46 npending 50 47 47 48 48 stdout tmp.txt
Note:
See TracChangeset
for help on using the changeset viewer.
