Changeset 40419 for trunk/Ohana/src/opihi
- Timestamp:
- May 5, 2018, 12:09:10 PM (8 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 3 edited
-
cmd.astro/cgrid.c (modified) (6 diffs)
-
cmd.data/textline.c (modified) (3 diffs)
-
dvo/fitcolors.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
