MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / FormatGridCell

Function FormatGridCell

xcharts1.cpp:446–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444// Compose a string to display within a graphic aspect grid cell.
445
446KI FormatGridCell(char *sz, int x, int y, int type, flag fWide)
447{
448 char szT[cchSzDef];
449 int n, d, m, s;
450 real v;
451 KI ki = -1;
452
453 if (x < 0) {
454 v = rgpcp[-x-1]->obj[y];
455 n = SFromZ(v); v = v - ZFromS(n);
456 } else {
457 n = grid->n[x][y]; v = grid->v[x][y];
458 }
459 *szT = chNull;
460 s = NAbs((int)(v*3600.0)); m = s/60; d = m/60; m %= 60; s %= 60;
461
462 // For aspect cells, print orb in degrees and minutes.
463 if (type == 1) {
464 if (n > 0) {
465 if (us.fDistance && !us.fParallel) {
466 sprintf(sz, "%c%f", rgchAppSep[us.nAppSep*2 + (v >= 0.0)],
467 RAbs(v));
468 sprintf(&sz[fWide ? 8 : 5], "%s", "%");
469 } else if (us.nDegForm != df360) {
470 if (fWide)
471 sprintf(szT, "%02d", s);
472 sprintf(sz, "%c%d%c%02d'%s", rgchAppSep[us.nAppSep*2 + (v >= 0.0)],
473 d, chDegL, m, szT);
474 sz[fWide ? (d >= 100 ? 8 : 9) : (d >= 100 ? 5 : 6)] = chNull;
475 } else {
476 sprintf(sz, "%c%f", rgchAppSep[us.nAppSep*2 + (v >= 0.0)], RAbs(v));
477 sz[fWide ? 8 : 5] = chNull;
478 }
479 } else
480 *sz = chNull;
481 }
482
483 // For midpoint cells, print degrees and minutes.
484 else if (type == 2 || (type == 0 && us.nDegForm == dfHM)) {
485 if (us.nDegForm == dfHM) {
486 sprintf(sz, "%s", SzZodiac((real)((n-1)*30) + v));
487 sz[3] = sz[4]; sz[4] = sz[5]; sz[5] = 'm';
488 if (fWide)
489 sprintf(sz+6, "%s", sz+8);
490 sz[fWide ? 8 : 6] = chNull;
491 } else if (us.nDegForm != df360) {
492 if (fWide)
493 sprintf(szT, "%02d", s);
494 sprintf(sz, "%2d%c%02d'%s", d, chDegL, m, szT);
495 } else
496 sprintf(sz, fWide ? "%8.5f" : "%5.2f", RAbs(v));
497 }
498
499 // For main diagonal cells, print sign and degree of the planet.
500 else {
501 ki = kSignB(n);
502 if (us.nDegForm != df360) {
503 if (fWide)

Callers 2

XChartGridFunction · 0.85
XChartGridRelationFunction · 0.85

Calls 1

SzZodiacFunction · 0.85

Tested by

no test coverage detected