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

Function XChartRising

xcharts2.cpp:1553–1767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1551// horizontal, with colors showing which planet(s) are above the horizon.
1552
1553flag XChartRising()
1554{
1555 byte ignoreSav[objMax];
1556 char sz[cchSzDef];
1557 int obj[3], x1, y1, x2, y2, xs, ys, imax = 0, i, j, x, y, ymax, n,
1558 z = us.fSeconds ? 1 : 7, dy, dx, xp, yp;
1559 real rgalt[241][3][2], mc, rT, azi, alt, altL, altR, altT, altB;
1560 KI ki[8];
1561
1562 // Determine which objects and colors to use in chart.
1563 for (i = 0; i <= cObj; i++)
1564 if (!ignore[i]) {
1565 obj[imax] = i;
1566 imax++;
1567 if (imax >= 3)
1568 break;
1569 }
1570 if (imax <= 0)
1571 obj[imax++] = oSun;
1572 ki[0] = kBlackB; ki[1] = kRedB; ki[2] = kGreenB; ki[3] = kYellowB;
1573 ki[4] = kBlueB; ki[5] = kMagentaB; ki[6] = kCyanB; ki[7] = kWhiteB;
1574 if (gs.fInverse)
1575 SwapN(ki[0], ki[7]);
1576
1577 // Set temporary restriction list for those objects used in this chart.
1578 ClearB((pbyte)rgalt, sizeof(rgalt));
1579 CopyRgb(ignore, ignoreSav, sizeof(ignore));
1580 for (i = 0; i <= cObj; i++)
1581 ignore[i] = fTrue;
1582 for (i = 0; i < imax; i++)
1583 ignore[obj[i]] = fFalse;
1584 AdjustRestrictions();
1585
1586 // Determine pixel dimensions of chart.
1587 ymax = DayInYear(YY);
1588 x1 = 4 * xFontT; y1 = 6 * gi.nScaleTextT2;
1589 x2 = gs.xWin - x1;
1590 y2 = gs.yWin - y1 - gs.fLabel*gi.nScale*(gs.fColor ? 20 : 40);
1591 xs = x2 - x1 - 2; ys = y2 - y1 - 2;
1592 xs = (xs / 24) * 24; xs = Max(xs, 24);
1593 dy = ys / ymax; dy = Max(dy, 1); ys = ymax * dy;
1594 x2 = x1 + xs + 1; y2 = y1 + ys + 1;
1595 dx = us.nDivision; dx = Min(dx, xs); dx = Min(dx, 240); dx = Max(dx, 4);
1596#ifdef WINANY
1597 if (!gi.fFile && !FAllocateBmp(&gi.bmpRising, xs, ys))
1598 return fFalse;
1599#endif
1600
1601 // Draw object combinations and their colors.
1602 y = y2 + yFontT + gi.nScale*10;
1603 x = ((x1 + x2) >> 1) - gi.nScale*5*(imax < 2 ? 0 : (imax == 2 ? 5 : 17));
1604 for (i = 1; i <= 7; i += (FBetween(i, 2, 3) ? 2 : (i == 4 ? -1 : 1))) {
1605 if (i >= (1 << imax))
1606 continue;
1607 for (n = 0; n < imax; n++) {
1608 if (i & (1 << n)) {
1609 j = kObjB[obj[n]]; kObjB[obj[n]] = ki[i];
1610 DrawObject(obj[n], x, y);

Callers 1

DrawChartXFunction · 0.85

Calls 15

ClearBFunction · 0.85
CopyRgbFunction · 0.85
FAllocateBmpFunction · 0.85
DrawObjectFunction · 0.85
DrawPointDitherFunction · 0.85
CastChartFunction · 0.85
EclToHorizFunction · 0.85
AddTimeFunction · 0.85
BmpSetXYFunction · 0.85
DrawColorFunction · 0.85
DrawPointFunction · 0.85
SetXYFunction · 0.85

Tested by

no test coverage detected