Changeset 420 for trunk/Jgraph/process.c
- Timestamp:
- 02/27/08 07:13:31 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Jgraph/process.c
r418 r420 8 8 #include <stdio.h> 9 9 #include <math.h> 10 #include <string.h> 10 11 11 12 #include "jgraph.h" … … 19 20 static double Pi; 20 21 21 process_title(g) 22 Graph g; 22 void process_label(Label l, Graph g, int adjust); 23 24 void process_title(Graph g) 23 25 { 24 26 … … 44 46 } 45 47 46 process_legend(g) 47 Graph g; 48 void process_label_max_n_mins(Label l, float len, float height) 49 { 50 float xlen, ylen, xheight, yheight; 51 float x, y; 52 53 xlen = len * cos(l->rotate * Pi / 180.00); 54 ylen = height * cos((l->rotate + 90.0) * Pi / 180.00); 55 xheight = len * sin(l->rotate * Pi / 180.00); 56 yheight = height * sin((l->rotate + 90.0) * Pi / 180.00); 57 58 x = l->x; 59 y = l->y; 60 61 if (l->hj == 'c') { 62 x -= xlen / 2.0; 63 y -= xheight / 2.0; 64 } else if (l->hj == 'r') { 65 x -= xlen; 66 y -= xheight; 67 } 68 if (l->vj == 'c') { 69 x -= ylen / 2.0; 70 y -= yheight / 2.0; 71 } else if (l->vj == 't') { 72 x -= ylen; 73 y -= yheight; 74 } 75 76 l->xmin = MIN(x, x + xlen); 77 l->xmin = MIN(l->xmin, x + xlen + ylen); 78 l->xmin = MIN(l->xmin, x + ylen); 79 80 l->ymin = MIN(y, y + xheight); 81 l->ymin = MIN(l->ymin, y + yheight); 82 l->ymin = MIN(l->ymin, y + xheight + yheight); 83 84 l->xmax = MAX(x, x + xlen); 85 l->xmax = MAX(l->xmax, x + xlen + ylen); 86 l->xmax = MAX(l->xmax, x + ylen); 87 88 l->ymax = MAX(y, y + xheight); 89 l->ymax = MAX(l->ymax, y + yheight); 90 l->ymax = MAX(l->ymax, y + xheight + yheight); 91 92 } 93 94 void process_legend(Graph g) 48 95 { 49 96 Legend l; … … 209 256 } 210 257 211 float find_reasonable_hash_interval(a) 212 Axis a; 258 float find_reasonable_hash_interval(Axis a) 213 259 { 214 260 float s, d; … … 238 284 } 239 285 240 float find_reasonable_hash_start(a) 241 Axis a; 286 float find_reasonable_hash_start(Axis a) 242 287 { 243 288 int i; … … 249 294 } 250 295 251 int find_reasonable_precision(a) 252 Axis a; 296 int find_reasonable_precision(Axis a) 253 297 { 254 298 int i, b, b2, done; … … 293 337 } 294 338 295 int find_reasonable_minor_hashes(a) 296 Axis a; 339 int find_reasonable_minor_hashes(Axis a) 297 340 { 298 341 float d; … … 316 359 } 317 360 318 process_axis1(a, g) 319 Axis a; 320 Graph g; 361 void process_axis1(Axis a, Graph g) 321 362 { 322 363 float tmp; … … 386 427 } 387 428 388 process_axis2(a, g) 389 Axis a; 390 Graph g; 429 void process_axis2(Axis a, Graph g) 391 430 { 392 431 float t1, t2, t3, minor_hashes, hloc, tmp; … … 576 615 } 577 616 578 process_label(l, g, adjust) 579 Label l; 580 Graph g; 581 int adjust; 617 void process_label(Label l, Graph g, int adjust) 582 618 { 583 619 float len, height; … … 618 654 } 619 655 620 process_label_max_n_mins(l, len, height) 621 Label l; 622 float len; 623 float height; 624 { 625 float xlen, ylen, xheight, yheight; 626 float x, y; 627 628 xlen = len * cos(l->rotate * Pi / 180.00); 629 ylen = height * cos((l->rotate + 90.0) * Pi / 180.00); 630 xheight = len * sin(l->rotate * Pi / 180.00); 631 yheight = height * sin((l->rotate + 90.0) * Pi / 180.00); 632 633 x = l->x; 634 y = l->y; 635 636 if (l->hj == 'c') { 637 x -= xlen / 2.0; 638 y -= xheight / 2.0; 639 } else if (l->hj == 'r') { 640 x -= xlen; 641 y -= xheight; 642 } 643 if (l->vj == 'c') { 644 x -= ylen / 2.0; 645 y -= yheight / 2.0; 646 } else if (l->vj == 't') { 647 x -= ylen; 648 y -= yheight; 649 } 650 651 l->xmin = MIN(x, x + xlen); 652 l->xmin = MIN(l->xmin, x + xlen + ylen); 653 l->xmin = MIN(l->xmin, x + ylen); 654 655 l->ymin = MIN(y, y + xheight); 656 l->ymin = MIN(l->ymin, y + yheight); 657 l->ymin = MIN(l->ymin, y + xheight + yheight); 658 659 l->xmax = MAX(x, x + xlen); 660 l->xmax = MAX(l->xmax, x + xlen + ylen); 661 l->xmax = MAX(l->xmax, x + ylen); 662 663 l->ymax = MAX(y, y + xheight); 664 l->ymax = MAX(l->ymax, y + yheight); 665 l->ymax = MAX(l->ymax, y + xheight + yheight); 666 667 } 668 669 process_strings(g) 670 Graph g; 656 void process_strings(Graph g) 671 657 { 672 658 String s; … … 677 663 } 678 664 679 process_curve(c, g) 680 Curve c; 681 Graph g; 665 void process_curve(Curve c, Graph g) 682 666 { 683 667 if (c->bezier && (c->npts < 4 || (c->npts % 3 != 1))) { … … 705 689 } 706 690 707 process_curves(g) 708 Graph g; 691 void process_curves(Graph g) 709 692 { 710 693 Curve c; … … 713 696 } 714 697 } 698 699 void process_label_extrema(Label l, Graph g) 700 { 701 if (l->label == CNULL) return; 702 g->yminval = MIN(g->yminval, l->ymin); 703 g->ymaxval = MAX(g->ymaxval, l->ymax); 704 g->xminval = MIN(g->xminval, l->xmin); 705 g->xmaxval = MAX(g->xmaxval, l->xmax); 706 } 715 707 716 process_extrema(g) /* This finds all the minval/maxvals for bbox calc */ 717 Graph g; 708 void process_extrema(Graph g) /* Finds all the minval/maxvals for bbox calc */ 718 709 { 719 710 Curve c; … … 764 755 } 765 756 766 process_label_extrema(l, g) 767 Label l; 768 Graph g; 769 { 770 if (l->label == CNULL) return; 771 g->yminval = MIN(g->yminval, l->ymin); 772 g->ymaxval = MAX(g->ymaxval, l->ymax); 773 g->xminval = MIN(g->xminval, l->xmin); 774 g->xmaxval = MAX(g->xmaxval, l->xmax); 775 } 776 777 process_graph(g) 778 Graph g; 757 void process_graph(Graph g) 779 758 { 780 759 g->x_translate = intop(g->x_translate); … … 791 770 } 792 771 793 process_graphs(gs) 794 Graphs gs; 772 void process_graphs(Graphs gs) 795 773 { 796 774 Graphs the_g;
Note:
See TracChangeset
for help on using the changeset viewer.