feat: limita constelações aos signos do zodíaco
This commit is contained in:
parent
bfb8f31952
commit
03692a0398
3 changed files with 29 additions and 8 deletions
File diff suppressed because one or more lines are too long
|
|
@ -1400,7 +1400,7 @@ function renderMilkyWay(lstDeg, glareOn) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Figuras convencionais das 88 constelações, ancoradas em RA/Dec J2000.
|
||||
/* Figuras convencionais dos 12 signos zodiacais, ancoradas em RA/Dec J2000.
|
||||
São desenhadas antes das estrelas para os pontos reais ficarem por cima. */
|
||||
function drawConstellations(c, lst, W, H, horizonPx) {
|
||||
if (!showConstellations || typeof CONSTELLATIONS === 'undefined') return;
|
||||
|
|
@ -1439,7 +1439,7 @@ function drawConstellations(c, lst, W, H, horizonPx) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Nomes só nas figuras principais/intermediárias para não lotar a tela. */
|
||||
/* Todos os signos recebem nome; colisões na tela ainda são evitadas. */
|
||||
c.shadowBlur = 5;
|
||||
c.font = `${Math.max(10, Math.round(H * 0.0105))}px ui-monospace, monospace`;
|
||||
c.textAlign = 'center';
|
||||
|
|
@ -1447,7 +1447,7 @@ function drawConstellations(c, lst, W, H, horizonPx) {
|
|||
c.fillStyle = 'rgba(170,225,255,0.66)';
|
||||
const occupied = [];
|
||||
for (const constellation of CONSTELLATIONS) {
|
||||
if (constellation.rank > 2 || !constellation.label) continue;
|
||||
if (!constellation.label) continue;
|
||||
const aa = altAz(constellation.label[0], constellation.label[1], lst);
|
||||
const sc = skyToScreen(aa.alt, aa.az, W, horizonPx);
|
||||
if (!sc || sc.y < 24 || sc.y > horizonPx - 18) continue;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Gera constellations.js com figuras convencionais em coordenadas J2000.
|
||||
"""Gera constellations.js com os signos zodiacais em coordenadas J2000.
|
||||
|
||||
Fonte: d3-celestial, de Olaf Frohn, licença BSD-3-Clause.
|
||||
Os dados são compactados para uso offline pelo wallpaper.
|
||||
|
|
@ -13,6 +13,21 @@ from pathlib import Path
|
|||
BASE = "https://raw.githubusercontent.com/ofrohn/d3-celestial/master/data/"
|
||||
OUT = Path(__file__).resolve().parent.parent / "plugin/contents/ui/constellations.js"
|
||||
|
||||
ZODIAC = {
|
||||
"Ari": "Áries",
|
||||
"Tau": "Touro",
|
||||
"Gem": "Gêmeos",
|
||||
"Cnc": "Câncer",
|
||||
"Leo": "Leão",
|
||||
"Vir": "Virgem",
|
||||
"Lib": "Libra",
|
||||
"Sco": "Escorpião",
|
||||
"Sgr": "Sagitário",
|
||||
"Cap": "Capricórnio",
|
||||
"Aqr": "Aquário",
|
||||
"Psc": "Peixes",
|
||||
}
|
||||
|
||||
LICENSE = """Copyright (c) 2015, Olaf Frohn
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -56,11 +71,13 @@ def main() -> None:
|
|||
merged: dict[str, dict] = {}
|
||||
for feature in line_data:
|
||||
ident = feature["id"]
|
||||
if ident not in ZODIAC:
|
||||
continue
|
||||
item = merged.setdefault(
|
||||
ident,
|
||||
{
|
||||
"id": ident,
|
||||
"name": metadata.get(ident, {}).get("name", ident),
|
||||
"name": ZODIAC[ident],
|
||||
"rank": int(feature["properties"].get("rank", 3)),
|
||||
"label": metadata.get(ident, {}).get("label"),
|
||||
"lines": [],
|
||||
|
|
@ -72,7 +89,11 @@ def main() -> None:
|
|||
for line in feature["geometry"]["coordinates"]]
|
||||
)
|
||||
|
||||
payload = json.dumps(list(merged.values()), ensure_ascii=False, separators=(",", ":"))
|
||||
payload = json.dumps(
|
||||
[merged[ident] for ident in ZODIAC],
|
||||
ensure_ascii=False,
|
||||
separators=(",", ":"),
|
||||
)
|
||||
OUT.write_text(
|
||||
"/* Gerado por tools/build_constellations.py.\n"
|
||||
" d3-celestial constellation lines, coordenadas equatoriais J2000.\n\n"
|
||||
|
|
@ -80,7 +101,7 @@ def main() -> None:
|
|||
+ " */\nconst CONSTELLATIONS=" + payload + ";\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
print(f"{len(merged)} constelações -> {OUT} ({OUT.stat().st_size / 1024:.0f} KB)")
|
||||
print(f"{len(merged)} signos -> {OUT} ({OUT.stat().st_size / 1024:.0f} KB)")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue