Changeset 27693
- Timestamp:
- Apr 14, 2010, 6:21:53 PM (16 years ago)
- Location:
- branches/eam_branches/Ohana.20100407/src
- Files:
-
- 1 added
- 2 deleted
- 11 edited
-
kapa2/doc/mark.issues.txt (modified) (1 diff)
-
kapa2/doc/notes.txt (added)
-
kapa2/include/prototypes.h (modified) (1 diff)
-
kapa2/include/structures.h (modified) (1 diff)
-
kapa2/src/DrawFrame.c (modified) (5 diffs)
-
kapa2/src/Graphs.c (modified) (2 diffs)
-
kapa2/src/LoadFrame.c (modified) (3 diffs)
-
kapa2/src/SetGraphData.c (modified) (2 diffs)
-
kapa2/src/SetGraphSize.c (modified) (7 diffs)
-
libkapa/include/kapa.h (modified) (1 diff)
-
libkapa/src/KapaWindow.c (modified) (3 diffs)
-
opihi/cmd.data/box.c (modified) (6 diffs)
-
opihi/lib.data/open_graph.c (deleted)
-
opihi/lib.data/open_image.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/Ohana.20100407/src/kapa2/doc/mark.issues.txt
r25918 r27693 1 2 1 3 -> The "plot" command needs to be fixed so that boundaries of contours do 2 4 not cause it to draw excessive amounts of lines connecting unrelated -
branches/eam_branches/Ohana.20100407/src/kapa2/include/prototypes.h
r27637 r27693 39 39 void DrawXErrors PROTO((KapaGraphWidget *graph, Gobjects *objects)); 40 40 void DrawYErrors PROTO((KapaGraphWidget *graph, Gobjects *objects)); 41 void DrawTick PROTO(( int fx, int fy, int dfx, int dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis));41 void DrawTick PROTO((Axis *axis, int P, double value, int IsLabel, int IsMajor, int naxis)); 42 42 void AxisTickScale PROTO((Axis *axis, double *major, double *minor)); 43 43 -
branches/eam_branches/Ohana.20100407/src/kapa2/include/structures.h
r27637 r27693 137 137 double min, max; 138 138 char isaxis, areticks, islabel, islog; 139 double pad, labelPad, ticktextPad; 139 140 double fx, dfx, fy, dfy; /* axis location on graphic */ 140 141 double lweight; -
branches/eam_branches/Ohana.20100407/src/kapa2/src/DrawFrame.c
r27603 r27693 8 8 9 9 int i, fx, fy, dfx, dfy, P, IsLabel, IsMajor; 10 double range, major, minor, first, next, lweight;10 double range, major, minor, first, value, lweight; 11 11 12 12 graphic = GetGraphic(); … … 62 62 first -= minor; 63 63 } 64 for ( next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next>= graph[0].axis[i].max));) {64 for (value = first; ((range > 0) && (value <= graph[0].axis[i].max)) || ((range < 0) && (value >= graph[0].axis[i].max));) { 65 65 IsMajor = FALSE; 66 IsMajor |= (fabs((int)( next/major) - (next/major)) < 0.5*(minor/major));67 IsMajor |= (fabs((int)(( next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));68 IsMajor |= (fabs ((int)(( next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));66 IsMajor |= (fabs((int)(value/major) - (value/major)) < 0.5*(minor/major)); 67 IsMajor |= (fabs((int)((value + 0.5*minor)/major) - (value/major)) < 0.5*(minor/major)); 68 IsMajor |= (fabs ((int)((value - 0.5*minor)/major) - (value/major)) < 0.5*(minor/major)); 69 69 IsLabel = (IsMajor && graph[0].axis[i].islabel); 70 DrawTick ( fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i);70 DrawTick (&graph[0].axis[i], P, value, IsLabel, IsMajor, i); 71 71 if (range > 0) 72 next+= minor;72 value += minor; 73 73 else 74 next-= minor;74 value -= minor; 75 75 } 76 76 } … … 78 78 } 79 79 80 void DrawTick (int fx, int fy, int dfx, int dfy, 81 int P, double min, double max, 82 double value, int IsLabel, int IsMajor, int naxis) { 80 void DrawTick (Axis *axis, int P, double value, int IsLabel, int IsMajor, int naxis) { 83 81 84 82 int x, y, dx, dy, pos, dir, fontsize; 85 double size, n ;83 double size, n, pad; 86 84 char string[64], *fontname; 85 86 int fx = axis->fx; 87 int fy = axis->fy; 88 int dfx = axis->dfx; 89 int dfy = axis->dfy; 90 91 double min = axis->min; 92 double max = axis->max; 87 93 88 94 if (IsMajor) { … … 96 102 y = fy + (value-min)*dfy/(max - min); 97 103 98 dir = +1; 99 if ((naxis == 0) || (naxis == 1)) dir *= -1; 104 dir = ((naxis == 0) || (naxis == 1)) ? -1 : +1; 100 105 dx = dir*size*dfy*n; 101 106 dy = dir*size*dfx*n; … … 103 108 DrawLine (x, y, dx, dy); 104 109 105 # ifdef IN_AND_OUT_TICKS106 # define GAP 0.03107 # else108 # define GAP 0.01109 # endif110 111 110 if (IsLabel) { 112 111 fontname = GetRotFont (&fontsize); 113 112 pos = 0; 114 113 114 pad = isfinite(axis->ticktextPad) ? axis->ticktextPad*fontsize : 0.8*fontsize + 1.0; 115 115 116 /* temporarily assume rectilinear axes */ 116 if (naxis == 0) { dx = 0; dy = -dir*(0.8*fontsize + 1); pos = 1; }117 if (naxis == 2) { dx = 0; dy = - dir*(0.8*fontsize + 1); pos = 7; }117 if (naxis == 0) { dx = 0; dy = +pad; pos = 1; } 118 if (naxis == 2) { dx = 0; dy = -pad; pos = 7; } 118 119 119 if (naxis == 1) { dy = 0; dx = - (0.8*fontsize + 1); pos = 3; }120 if (naxis == 3) { dy = 0; dx = + (0.8*fontsize + 1); pos = 5; }120 if (naxis == 1) { dy = 0; dx = -pad; pos = 3; } 121 if (naxis == 3) { dy = 0; dx = +pad; pos = 5; } 121 122 122 123 x = fx + (value-min)*dfx/(max - min) + dx; -
branches/eam_branches/Ohana.20100407/src/kapa2/src/Graphs.c
r27530 r27693 13 13 graph[0].axis[i].min = 0.0; 14 14 graph[0].axis[i].max = 1.0; 15 graph[0].axis[i].isaxis = FALSE;16 graph[0].axis[i].areticks = FALSE;17 graph[0].axis[i].islabel = FALSE;15 graph[0].axis[i].isaxis = TRUE; 16 graph[0].axis[i].areticks = TRUE; 17 graph[0].axis[i].islabel = (i < 2); 18 18 graph[0].axis[i].lweight = 0.0; 19 19 graph[0].axis[i].color = 0; 20 graph[0].axis[i].ticktextPad = NAN; 21 graph[0].axis[i].labelPad = NAN; 22 graph[0].axis[i].pad = NAN; 20 23 } 21 24 for (i = 0; i < 8; i++) { … … 80 83 81 84 /* reset axes and labels */ 82 for (i = 0; i < 4; i++) {83 graph[0].axis[i].isaxis = FALSE;84 graph[0].axis[i].islabel = FALSE;85 graph[0].axis[i].areticks = FALSE;86 }85 // for (i = 0; i < 4; i++) { 86 // graph[0].axis[i].isaxis = FALSE; 87 // graph[0].axis[i].islabel = FALSE; 88 // graph[0].axis[i].areticks = FALSE; 89 // } 87 90 for (i = 0; i < 8; i++) { 88 91 strcpy (graph[0].label[i].text, ""); -
branches/eam_branches/Ohana.20100407/src/kapa2/src/LoadFrame.c
r21153 r27693 5 5 int i, color; 6 6 char Axis[16], Labels[16], Ticks[16]; 7 double lweight ;7 double lweight, ticktextPad, labelPad, padXm, padXp, padYm, padYp; 8 8 Section *section; 9 9 KapaGraphWidget *graph; … … 28 28 color = MAX (0, MIN (15, color)); 29 29 30 KiiScanMessage (sock, "%lf %lf %lf %lf %lf %lf", &ticktextPad, &labelPad, &padXm, &padXp, &padYm, &padYp); 31 graph[0].axis[0].pad = padXm; 32 graph[0].axis[1].pad = padYm; 33 graph[0].axis[2].pad = padXp; 34 graph[0].axis[3].pad = padYp; 35 30 36 KiiScanMessage (sock, "%s %s %s", Axis, Labels, Ticks); 31 37 … … 33 39 graph[0].axis[i].lweight = lweight; 34 40 graph[0].axis[i].color = color; 41 42 graph[0].axis[i].ticktextPad = ticktextPad; 43 graph[0].axis[i].labelPad = labelPad; 35 44 36 45 switch (Axis[i]) { -
branches/eam_branches/Ohana.20100407/src/kapa2/src/SetGraphData.c
r21153 r27693 28 28 &graph[0].data.lweight, 29 29 &graph[0].data.size); 30 31 KiiScanMessage (sock, "%lf %lf %lf %lf %lf %lf", 32 &graph[0].data.ticktextPad, 33 &graph[0].data.labelPad, 34 &graph[0].data.padXm, 35 &graph[0].data.padXp, 36 &graph[0].data.padYm, 37 &graph[0].data.padYp); 30 38 31 39 KiiScanMessage (sock, "%lf %lf %lf %lf", … … 96 104 graph[0].data.lweight, graph[0].data.size); 97 105 106 KiiSendMessage (sock, "%g %g %g %g %g %g", 107 graph[0].data.ticktextPad, 108 graph[0].data.labelPad, 109 graph[0].data.padXm, 110 graph[0].data.padXp, 111 graph[0].data.padYm, 112 graph[0].data.padYp); 113 98 114 KiiSendMessage (sock, "%g %g %g %g", 99 115 graph[0].data.xmin, graph[0].data.xmax, -
branches/eam_branches/Ohana.20100407/src/kapa2/src/SetGraphSize.c
r27637 r27693 8 8 int fontsize, bump, Nc; 9 9 int textpad, textdY, WdY; 10 double PADx, PADy, Dx, Dy; 11 double PXm, PXp, PYm, PYp; 10 double padXm, padXp, padYm, padYp; 11 double minPADx, maxPADx, minPADy, maxPADy; 12 double minPAD, maxPAD; 12 13 double X0, Y0, dX, dY; 13 14 char string[64], *fontname; … … 22 23 fontname = GetRotFont (&fontsize); 23 24 24 PADx = MAX (graphic->dx / 20.0, fontsize);25 PADy = MAX (graphic->dy / 20.0, fontsize);26 Dx = graphic->dx - 2*PADx;27 Dy = graphic->dy - 2*PADy;25 minPADx = fontsize; 26 minPADy = fontsize; 27 maxPADx = 5*fontsize; 28 maxPADy = 5*fontsize; 28 29 29 /* each graph has a padding PXm, PXp, PYm, PYp */ 30 PXm = (graph[0].axis[1].islabel) ? 4*fontsize : 0; 31 PXp = (graph[0].axis[3].islabel) ? 4*fontsize : 0; 32 PYm = (graph[0].axis[0].islabel) ? 4*fontsize : 0; 33 PYp = (graph[0].axis[2].islabel) ? 4*fontsize : 0; 34 30 // padXm : padding below x-axis, padYp : padding to right of y-axis, etc 31 if (isnan(graph[0].axis[0].pad)) { 32 padXm = graph[0].axis[0].islabel ? maxPADx : minPADx; 33 } else { 34 padXm = graph[0].axis[0].pad * fontsize; 35 } 36 if (isnan(graph[0].axis[1].pad)) { 37 padYm = graph[0].axis[1].islabel ? maxPADx : minPADx; 38 } else { 39 padYm = graph[0].axis[1].pad * fontsize; 40 } 41 if (isnan(graph[0].axis[2].pad)) { 42 padXp = graph[0].axis[2].islabel ? maxPADx : minPADx; 43 } else { 44 padXp = graph[0].axis[2].pad * fontsize; 45 } 46 if (isnan(graph[0].axis[3].pad)) { 47 padYp = graph[0].axis[3].islabel ? maxPADx : minPADx; 48 } else { 49 padYp = graph[0].axis[3].pad * fontsize; 50 } 51 35 52 /* basic size of the graph in Xwindow coordinates */ 36 X0 = PADx + PXm + (Dx * section[0].x);37 Y0 = PADy + PYm + (Dy * section[0].y);38 dX = (Dx * section[0].dx) - PXp - PXm;39 dY = (Dy * section[0].dy) - PYp - PYm;53 X0 = graphic[0].dx * section[0].x + padYm; 54 Y0 = graphic[0].dy * section[0].y + padXm; 55 dX = graphic[0].dx * section[0].dx - padYm - padYp; 56 dY = graphic[0].dy * section[0].dy - padXm - padXp; 40 57 41 58 // if we are tied to an image, make mods as needed … … 47 64 switch (section->image->location) { 48 65 case 1: 49 Y0 = graphic[0].dy * section[0].y + 2*PAD1 + WdY + 2; // tied to image in Y66 Y0 = graphic[0].dy * section[0].y + 2*PAD1 + WdY + 2; // tied to image in Y 50 67 dY = graphic[0].dy * section[0].dy - 5*PAD1 - WdY - COLORPAD + 1; 51 68 break; 52 69 case 3: 53 dY = graphic[0].dy * section[0].dy - 5*PAD1 - WdY - COLORPAD - PADy - PYm;70 dY = graphic[0].dy * section[0].dy - 5*PAD1 - WdY - COLORPAD - padYm - padYp; 54 71 break; 55 72 case 2: … … 58 75 break; 59 76 case 4: 60 dX = graphic[0].dx * section[0].dx - 3*PAD1 - ZOOM_X - PADx - PXm;77 dX = graphic[0].dx * section[0].dx - 3*PAD1 - ZOOM_X - padXm - padXp; 61 78 break; 62 79 } … … 85 102 graph[0].axis[3].dfy = -dY; 86 103 87 PADx= 0.8*fontsize + 2;88 PADy= 3.0*fontsize + 4;104 minPAD = 0.8*fontsize + 2; 105 maxPAD = 3.0*fontsize + 4; 89 106 90 107 /* define locations of axis labels */ 91 108 graph[0].label[LABELX0].x = graph[0].axis[0].fx + 0.5*graph[0].axis[0].dfx; 92 bump = (graph[0].axis[0].islabel) ? PADy : PADx; 109 if (isnan(graph[0].axis[0].labelPad)) { 110 bump = (graph[0].axis[0].islabel) ? maxPAD : minPAD; 111 } else { 112 bump = graph[0].axis[0].labelPad * fontsize; 113 } 93 114 graph[0].label[LABELX0].y = graph[0].axis[0].fy + bump; 94 115 95 116 graph[0].label[LABELX1].x = graph[0].axis[2].fx + 0.5*graph[0].axis[2].dfx; 96 bump = (graph[0].axis[2].islabel) ? PADy : PADx; 117 if (isnan(graph[0].axis[2].labelPad)) { 118 bump = (graph[0].axis[2].islabel) ? maxPAD : minPAD; 119 } else { 120 bump = graph[0].axis[2].labelPad * fontsize; 121 } 97 122 graph[0].label[LABELX1].y = graph[0].axis[2].fy - bump; 98 123 … … 104 129 105 130 graph[0].label[LABELY0].y = graph[0].axis[1].fy + 0.5*graph[0].axis[1].dfy; 106 bump = (graph[0].axis[1].islabel) ? (0.8*Nc*fontsize + 1) : PADx; 131 if (isnan(graph[0].axis[1].labelPad)) { 132 bump = (graph[0].axis[1].islabel) ? (0.8*Nc*fontsize + 1) : minPAD; 133 } else { 134 bump = graph[0].axis[1].labelPad * fontsize; 135 } 107 136 graph[0].label[LABELY0].x = graph[0].axis[1].fx - bump; 108 137 … … 113 142 114 143 graph[0].label[LABELY1].y = graph[0].axis[3].fy + 0.5*graph[0].axis[3].dfy; 115 bump = (graph[0].axis[3].islabel) ? (0.8*Nc*fontsize + 1) : PADx; 144 if (isnan(graph[0].axis[3].labelPad)) { 145 bump = (graph[0].axis[3].islabel) ? (0.8*Nc*fontsize + 1) : minPAD; 146 } else { 147 bump = graph[0].axis[3].labelPad * fontsize; 148 } 116 149 graph[0].label[LABELY1].x = graph[0].axis[3].fx + bump; 117 150 118 151 /* these are wrong and have to be adjusted to sit in the corners */ 119 152 120 graph[0].label[LABELUL].x = graph[0].axis[2].fx - PADx; 121 graph[0].label[LABELUL].y = graph[0].axis[2].fy - PADx; 122 graph[0].label[LABELUR].x = graph[0].axis[2].fx + graph[0].axis[2].dfx + PADx; 123 graph[0].label[LABELUR].y = graph[0].axis[2].fy - PADx; 124 graph[0].label[LABELLL].x = graph[0].axis[0].fx - PADx; 125 graph[0].label[LABELLL].y = graph[0].axis[0].fy + PADx; 126 graph[0].label[LABELLR].x = graph[0].axis[0].fx + graph[0].axis[0].dfx + PADx; 127 graph[0].label[LABELLR].y = graph[0].axis[0].fy + PADx; 128 153 graph[0].label[LABELUL].x = graph[0].axis[2].fx; 154 graph[0].label[LABELUL].y = graph[0].axis[2].fy - minPAD; 155 graph[0].label[LABELUR].x = graph[0].axis[2].fx + graph[0].axis[2].dfx; 156 graph[0].label[LABELUR].y = graph[0].axis[2].fy - minPAD; 157 graph[0].label[LABELLL].x = graph[0].axis[0].fx; 158 graph[0].label[LABELLL].y = graph[0].axis[0].fy + minPAD; 159 graph[0].label[LABELLR].x = graph[0].axis[0].fx + graph[0].axis[0].dfx; 160 graph[0].label[LABELLR].y = graph[0].axis[0].fy + minPAD; 129 161 } -
branches/eam_branches/Ohana.20100407/src/libkapa/include/kapa.h
r27637 r27693 79 79 int style, ptype, ltype, etype, ebar, color; 80 80 double lweight, size; 81 double ticktextPad, labelPad; 82 double padXm, padXp, padYm, padYp; 81 83 Coords coords; 82 84 int flipeast, flipnorth; -
branches/eam_branches/Ohana.20100407/src/libkapa/src/KapaWindow.c
r27636 r27693 42 42 43 43 KiiSendMessage (fd, "%lf %d", graphdata[0].lweight, graphdata[0].color); 44 45 KiiSendMessage (fd, "%lf %lf %lf %lf %lf %lf", graphdata[0].ticktextPad, graphdata[0].labelPad, graphdata[0].padXm, graphdata[0].padXp, graphdata[0].padYm, graphdata[0].padYp); 44 46 45 47 KiiSendMessage (fd, "%s %s %s", graphdata[0].axis, graphdata[0].labels, graphdata[0].ticks); … … 140 142 data[0].lweight, data[0].size); 141 143 144 KiiSendMessage (fd, "%g %g %g %g %g %g", 145 data[0].ticktextPad, data[0].labelPad, 146 data[0].padXm, data[0].padXp, 147 data[0].padYm, data[0].padYp); 148 149 142 150 KiiSendMessage (fd, "%g %g %g %g", 143 151 data[0].xmin, data[0].xmax, … … 175 183 &data[0].etype, &data[0].ebar, &data[0].color, 176 184 &data[0].lweight, &data[0].size); 185 186 KiiScanMessage (fd, "%lf %lf %lf %lf %lf %lf", 187 &data[0].ticktextPad, &data[0].labelPad, 188 &data[0].padXm, &data[0].padXp, 189 &data[0].padYm, &data[0].padYp); 177 190 178 191 KiiScanMessage (fd, "%lf %lf %lf %lf", -
branches/eam_branches/Ohana.20100407/src/opihi/cmd.data/box.c
r19839 r27693 25 25 } 26 26 27 graphmode.lweight = 1;27 // graphmode.lweight = 1; 28 28 if ((N = get_argument (argc, argv, "-lw"))) { 29 29 remove_argument (N, &argc, argv); … … 32 32 } 33 33 34 graphmode.color = KapaColorByName ("black");34 // graphmode.color = KapaColorByName ("black"); 35 35 if ((N = get_argument (argc, argv, "-c"))) { 36 36 remove_argument (N, &argc, argv); … … 40 40 } 41 41 42 strcpy (graphmode.ticks, "2222");42 // strcpy (graphmode.ticks, "2222"); 43 43 if ((N = get_argument (argc, argv, "-ticks"))) { 44 44 remove_argument (N, &argc, argv); … … 51 51 } 52 52 53 strcpy (graphmode.labels, "2222");53 // strcpy (graphmode.labels, "2222"); 54 54 if ((N = get_argument (argc, argv, "-labels"))) { 55 55 remove_argument (N, &argc, argv); … … 62 62 } 63 63 64 strcpy (graphmode.axis, "2222");64 // strcpy (graphmode.axis, "2222"); 65 65 if ((N = get_argument (argc, argv, "-axis"))) { 66 66 remove_argument (N, &argc, argv); … … 71 71 if ((graphmode.axis[i] != '0') && (graphmode.axis[i] != '1') && (graphmode.axis[i] != '2')) { goto usage; } 72 72 } 73 } 74 75 if ((N = get_argument (argc, argv, "-tickpad"))) { 76 remove_argument (N, &argc, argv); 77 graphmode.ticktextPad = atof(argv[N]); 78 remove_argument (N, &argc, argv); 79 } 80 81 if ((N = get_argument (argc, argv, "-labelpad"))) { 82 remove_argument (N, &argc, argv); 83 graphmode.labelPad = atof(argv[N]); 84 remove_argument (N, &argc, argv); 85 } 86 87 if ((N = get_argument (argc, argv, "-xpad"))) { 88 remove_argument (N, &argc, argv); 89 graphmode.padXm = atof(argv[N]); 90 remove_argument (N, &argc, argv); 91 } 92 if ((N = get_argument (argc, argv, "+xpad"))) { 93 remove_argument (N, &argc, argv); 94 graphmode.padXp = atof(argv[N]); 95 remove_argument (N, &argc, argv); 96 } 97 if ((N = get_argument (argc, argv, "-ypad"))) { 98 remove_argument (N, &argc, argv); 99 graphmode.padYm = atof(argv[N]); 100 remove_argument (N, &argc, argv); 101 } 102 if ((N = get_argument (argc, argv, "+ypad"))) { 103 remove_argument (N, &argc, argv); 104 graphmode.padYp = atof(argv[N]); 105 remove_argument (N, &argc, argv); 73 106 } 74 107
Note:
See TracChangeset
for help on using the changeset viewer.
