- Timestamp:
- May 5, 2018, 12:09:10 PM (8 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 12 edited
-
kapa2/include/constants.h (modified) (1 diff)
-
kapa2/include/structures.h (modified) (1 diff)
-
kapa2/src/DrawTextlines.c (modified) (1 diff)
-
kapa2/src/LoadTextlines.c (modified) (3 diffs)
-
kapa2/src/PSTextlines.c (modified) (1 diff)
-
kapa2/src/bDrawLabels.c (modified) (1 diff)
-
libkapa/include/kapa.h (modified) (1 diff)
-
libkapa/src/DrawRotString.c (modified) (1 diff)
-
libkapa/src/KapaWindow.c (modified) (1 diff)
-
opihi/cmd.astro/cgrid.c (modified) (6 diffs)
-
opihi/cmd.data/textline.c (modified) (3 diffs)
-
opihi/dvo/fitcolors.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/include/constants.h
r39225 r40419 27 27 # define MIN_WIDTH 50 28 28 # define MIN_HEIGHT 50 29 # define LABEL_MAXLEN 12829 # define LABEL_MAXLEN 512 30 30 31 31 typedef enum { -
trunk/Ohana/src/kapa2/include/structures.h
r39457 r40419 115 115 typedef struct { 116 116 int x, y; 117 int dx, dy; 117 int dx, dy; // unused? 118 118 double angle; 119 119 int size; 120 int justify; 121 int color; 120 122 char font[64]; 121 123 char text[LABEL_MAXLEN]; -
trunk/Ohana/src/kapa2/src/DrawTextlines.c
r13320 r40419 12 12 fontname = GetRotFont (&size); 13 13 XSetForeground (graphic->display, graphic->gc, graphic->fore); 14 DrawRotTextInit (graphic->display, graphic->window, graphic->gc, graphic->fore, graphic->back);15 14 16 15 for (i = 0; i < graph[0].Ntextline; i++) { 17 16 if (strcmp (graph[0].textline[i].text, "")) { 17 DrawRotTextInit (graphic->display, graphic->window, graphic->gc, graphic->color[graph[0].textline[i].color], graphic->back); 18 18 angle = graph[0].textline[i].angle; 19 19 x = graph[0].textline[i].x; 20 20 y = graph[0].textline[i].y; 21 21 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 22 DrawRotText (x, y, graph[0].textline[i].text, 5, angle);22 DrawRotText (x, y, graph[0].textline[i].text, graph[0].textline[i].justify, angle); 23 23 } 24 24 } -
trunk/Ohana/src/kapa2/src/LoadTextlines.c
r39626 r40419 4 4 5 5 char *string; 6 int N, size ;6 int N, size, justify, color; 7 7 double tX, tY, tT, L; 8 8 Section *section; … … 23 23 REALLOCATE (graph[0].textline, Label, graph[0].Ntextline); 24 24 25 KiiScanMessage (sock, "%lf %lf %lf ", &tX, &tY, &tT);25 KiiScanMessage (sock, "%lf %lf %lf %d %d", &tX, &tY, &tT, &justify, &color); 26 26 27 27 L = graph[0].axis[0].dfx; … … 52 52 graph[0].textline[N].size = size; 53 53 strcpy (graph[0].textline[N].font, string); 54 graph[0].textline[N].justify = justify; 55 graph[0].textline[N].color = color; 54 56 55 57 if (USE_XWINDOW) DrawTextlines (graph); -
trunk/Ohana/src/kapa2/src/PSTextlines.c
r13320 r40419 16 16 x = graph[0].textline[i].x; 17 17 y = graphic->dy - graph[0].textline[i].y; 18 if (graph[0].textline[i].color >= 0) { 19 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(graph[0].textline[i].color)); 20 } 18 21 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 19 PSRotText (f, x, y, graph[0].textline[i].text, 5, angle);22 PSRotText (f, x, y, graph[0].textline[i].text, graph[0].textline[i].justify, angle); 20 23 } 21 24 } -
trunk/Ohana/src/kapa2/src/bDrawLabels.c
r29938 r40419 40 40 for (i = 0; i < graph[0].Ntextline; i++) { 41 41 if (strcmp (graph[0].textline[i].text, "")) { 42 bDrawSetColor (buffer, graph[0].textline[i].color); 42 43 angle = graph[0].textline[i].angle; 43 44 x = graph[0].textline[i].x; 44 45 y = graph[0].textline[i].y; 45 46 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 46 bDrawRotText (buffer, x, y, graph[0].textline[i].text, 5, angle);47 bDrawRotText (buffer, x, y, graph[0].textline[i].text, graph[0].textline[i].justify, angle); 47 48 } 48 49 } -
trunk/Ohana/src/libkapa/include/kapa.h
r40165 r40419 239 239 int KapaSetFont (int fd, char *name, int size); 240 240 int KapaSendLabel (int fd, char *string, int mode); 241 int KapaSendTextline (int fd, char *string, float x, float y, float angle );241 int KapaSendTextline (int fd, char *string, float x, float y, float angle, int justify, int color); 242 242 int KapaSetLimits (int fd, Graphdata *graphmode); 243 243 int KapaGetLimits (int fd, float *dx, float *dy); -
trunk/Ohana/src/libkapa/src/DrawRotString.c
r39626 r40419 12 12 static unsigned long RotBackground; 13 13 14 // fore and back are X colors 14 15 int DrawRotTextInit (Display *display, Window window, GC gc, unsigned long fore, unsigned long back) { 15 16 -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r40165 r40419 358 358 } 359 359 360 int KapaSendTextline (int fd, char *string, float x, float y, float angle) { 361 360 int KapaSendTextline (int fd, char *string, float x, float y, float angle, int justify, int color) { 361 362 // must be in range 0 - 8 363 justify = MIN(MAX(justify, 0), 8); 364 362 365 KiiSendCommand (fd, 4, "PTXT"); 363 KiiSendMessage (fd, "%f %f %f ", x, y, angle);366 KiiSendMessage (fd, "%f %f %f %d %d", x, y, angle, justify, color); 364 367 KiiSendData (fd, string, strlen(string)); 365 368 KiiWaitAnswer (fd, "DONE"); -
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r40165 r40419 95 95 } 96 96 97 int JustifyRA = 5; 98 double JustifyDEC = 5; 99 if ((N = get_argument (argc, argv, "-justify-ra"))) { 100 remove_argument (N, &argc, argv); 101 JustifyRA = atoi (argv[N]); 102 remove_argument (N, &argc, argv); 103 } 104 if ((N = get_argument (argc, argv, "-justify-dec"))) { 105 remove_argument (N, &argc, argv); 106 JustifyDEC = atoi (argv[N]); 107 remove_argument (N, &argc, argv); 108 } 109 110 double LabelRA = NAN; 111 double LabelDEC = NAN; 112 if ((N = get_argument (argc, argv, "-label-ra"))) { 113 remove_argument (N, &argc, argv); 114 LabelRA = atof (argv[N]); 115 remove_argument (N, &argc, argv); 116 } 117 if ((N = get_argument (argc, argv, "-label-dec"))) { 118 remove_argument (N, &argc, argv); 119 LabelDEC = atof (argv[N]); 120 remove_argument (N, &argc, argv); 121 } 122 123 int LabelColor = KapaColorByName ("black"); 124 if ((N = get_argument (argc, argv, "-label-color"))) { 125 remove_argument (N, &argc, argv); 126 LabelColor = KapaColorByName (argv[N]); 127 if (LabelColor == -1) return (FALSE); 128 remove_argument (N, &argc, argv); 129 } 130 97 131 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 98 132 … … 196 230 if (Labels) { 197 231 char line[16], format[8]; 198 double xt, yt, dx, dy, frac; 199 dx = +0.01 * (graphmode.xmax - graphmode.xmin); 200 dy = -0.02 * (graphmode.ymax - graphmode.ymin); 201 232 double xt, yt, frac; 233 // dx = +0.01 * (graphmode.xmax - graphmode.xmin); 234 // dy = -0.02 * (graphmode.ymax - graphmode.ymin); 235 236 if (isnan(LabelRA)) LabelRA = graphmode.coords.crval1; 237 if (isnan(LabelDEC)) LabelDEC = graphmode.coords.crval2; 202 238 for (r = firstRA; r <= graphmode.coords.crval1 + 180.0; r += minorRA) { 203 status = RD_to_XY (&xt, &yt, r, graphmode.coords.crval2, &graphmode.coords);239 status = RD_to_XY (&xt, &yt, r, LabelDEC, &graphmode.coords); 204 240 if (!status) continue; 205 241 if (xt < graphmode.xmin) continue; … … 212 248 } 213 249 if (frac <= 0.0) frac = 0.0; 214 snprintf (format, 8, "%%.%df", (int) frac);215 250 if (RAbyHour) { 251 snprintf (format, 8, "%%.%df^h", (int) frac); 216 252 snprintf (line, 16, format, r / 15.0); 217 253 } else { 254 snprintf (format, 8, "%%.%df^o", (int) frac); 218 255 snprintf (line, 16, format, r); 219 256 } 220 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);257 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyRA, LabelColor); 221 258 } 222 259 for (r = firstRA; r >= graphmode.coords.crval1 - 180.0; r -= minorRA) { 223 status = RD_to_XY (&xt, &yt, r, graphmode.coords.crval2, &graphmode.coords);260 status = RD_to_XY (&xt, &yt, r, LabelDEC, &graphmode.coords); 224 261 if (!status) continue; 225 262 if (xt < graphmode.xmin) continue; … … 232 269 } 233 270 if (frac <= 0.0) frac = 0.0; 234 snprintf (format, 8, "%%.%df", (int) frac);235 271 if (RAbyHour) { 272 snprintf (format, 8, "%%.%df^h", (int) frac); 236 273 snprintf (line, 16, format, r / 15.0); 237 274 } else { 275 snprintf (format, 8, "%%.%df^o", (int) frac); 238 276 snprintf (line, 16, format, r); 239 277 } 240 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);278 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyRA, LabelColor); 241 279 } 242 280 for (d = firstDEC; d <= graphmode.coords.crval2 + 90.0; d += minorDEC) { 243 status = RD_to_XY (&xt, &yt, graphmode.coords.crval1, d, &graphmode.coords);281 status = RD_to_XY (&xt, &yt, LabelRA, d, &graphmode.coords); 244 282 if (!status) continue; 245 283 if (xt < graphmode.xmin) continue; … … 252 290 } 253 291 if (frac <= 0.0) frac = 0.0; 254 snprintf (format, 8, "%%.%df ", (int) frac);292 snprintf (format, 8, "%%.%df^o", (int) frac); 255 293 snprintf (line, 16, format, d); 256 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);294 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyDEC, LabelColor); 257 295 } 258 296 for (d = firstDEC; d >= graphmode.coords.crval2 - 90.0; d -= minorDEC) { 259 status = RD_to_XY (&xt, &yt, graphmode.coords.crval1, d, &graphmode.coords);297 status = RD_to_XY (&xt, &yt, LabelRA, d, &graphmode.coords); 260 298 if (!status) continue; 261 299 if (xt < graphmode.xmin) continue; … … 268 306 } 269 307 if (frac <= 0.0) frac = 0.0; 270 snprintf (format, 8, "%%.%df ", (int) frac);308 snprintf (format, 8, "%%.%df^o", (int) frac); 271 309 snprintf (line, 16, format, d); 272 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);310 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyDEC, LabelColor); 273 311 } 274 312 } -
trunk/Ohana/src/opihi/cmd.data/textline.c
r13479 r40419 6 6 char name[64]; 7 7 double x, y, angle; 8 int kapa;9 8 Graphdata graphmode; 10 9 11 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 10 // if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 11 12 // Using only these style_args options 13 char *kapaName = NULL; 14 int kapa = -1; 15 if ((N = get_argument (argc, argv, "-n"))) { 16 remove_argument (N, &argc, argv); 17 kapaName = strcreate (argv[N]); 18 remove_argument (N, &argc, argv); 19 } 20 if (!GetGraph (&graphmode, &kapa, kapaName)) return (FALSE); 21 FREE (kapaName); 22 23 int color = KapaColorByName ("black"); 24 if ((N = get_argument (argc, argv, "-c"))) { 25 remove_argument (N, &argc, argv); 26 color = KapaColorByName (argv[N]); 27 if (color == -1) return (FALSE); 28 remove_argument (N, &argc, argv); 29 } 12 30 13 31 if ((N = get_argument (argc, argv, "-fn"))) { … … 34 52 } 35 53 54 int justify = 5; // default 55 if ((N = get_argument (argc, argv, "-justify"))) { 56 remove_argument (N, &argc, argv); 57 justify = atoi (argv[N]); 58 remove_argument (N, &argc, argv); 59 } 60 36 61 if (argc != 4) { 37 gprint (GP_ERR, "USAGE: text x y (line) [-fn (font) size] [-rot angle] \n");62 gprint (GP_ERR, "USAGE: text x y (line) [-fn (font) size] [-rot angle] [-justify N]\n"); 38 63 return (FALSE); 39 64 } … … 52 77 } 53 78 54 KapaSendTextline (kapa, argv[3], x, y, angle );79 KapaSendTextline (kapa, argv[3], x, y, angle, justify, color); 55 80 return (TRUE); 56 81 } -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r40165 r40419 47 47 if ((selection = SetRegionSelection (&argc, argv)) == NULL) goto escape; 48 48 if (!SetPhotSelections (&argc, argv, 4)) goto usage; 49 50 int textcolor = KapaColorByName ("black"); 49 51 50 52 // range for valid data points (exclude extreme outliers) … … 324 326 KapaSetFont (kapa, "helvetica", 8); 325 327 sprintf (label, "%s", code[0][0].name); 326 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.8*maxDelta + 0.2*minDelta, 0.0 );328 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.8*maxDelta + 0.2*minDelta, 0.0, textcolor); 327 329 sprintf (label, "%s", code[1][0].name); 328 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.2*maxDelta + 0.8*minDelta, 0.0 );330 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.2*maxDelta + 0.8*minDelta, 0.0, textcolor); 329 331 KapaSetFont (kapa, "helvetica", 14); 330 332
Note:
See TracChangeset
for help on using the changeset viewer.
