Changeset 40419 for trunk/Ohana/src/opihi/cmd.astro/cgrid.c
- Timestamp:
- May 5, 2018, 12:09:10 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.astro/cgrid.c (modified) (6 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 }
Note:
See TracChangeset
for help on using the changeset viewer.
