Repository navigation
Write the names of the constellations and the planets - #19
Merged
Merged
Conversation
ConstellationNames writes the name of each constellation in the middle of its stars. Planets writes the name of each planet under it with labels: true. The names come from a new names.csv, because Astronoby cuts the names with several words and can't read Boötes with an ASCII locale. They can be replaced with names:, for example to translate them.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the constellation-name and optional planet-label changes.
No open issues 🎉
What changed in this PR
Adds constellation names and optional planet labels to Skymap’s layered SVG rendering, with customizable constellation names for translation.
Changes:
- Adds a UTF-8 catalog of all 88 constellation names and a layer that labels constellations when more than half their supplied stars are above the horizon.
- Introduces shared caption rendering with distinct colors for constellation and planet names.
- Adds tests, documents the new options, and updates the example map.
| File | Description |
|---|---|
spec/skymap/renderer/svg_spec.rb |
Tests caption positioning, sizing, and colors. |
spec/skymap/layers/planets_spec.rb |
Tests default behavior and optional planet labels. |
spec/skymap/layers/constellation_names_spec.rb |
Tests visibility, placement, scaling, and custom names. |
spec/skymap/catalog/constellation_names_spec.rb |
Tests name lookup, accents, and catalog completeness. |
sky_map.svg |
Adds constellation and planet names to the example map. |
README.md |
Documents naming layers, options, and catalog data. |
lib/skymap/renderer/svg.rb |
Renders captions using shared text drawing and kind-specific colors. |
lib/skymap/renderer/caption.rb |
Defines the caption rendering data type. |
lib/skymap/layers/planets.rb |
Adds optional names beneath visible planets. |
lib/skymap/layers/constellation_names.rb |
Places constellation names among their visible stars. |
lib/skymap/catalog/constellation_names.rb |
Loads UTF-8 names and supports abbreviation lookup. |
lib/skymap.rb |
Loads the new catalog, layer, and caption type. |
data/constellations/iau/names.csv |
Supplies names for all 88 IAU constellations. |
CHANGELOG.md |
Records constellation naming and optional planet labels. |
Review effort: Balanced
Planet names go on the side of the center of the map, so they stay inside the sky. A constellation is named in the middle of its biggest part above the horizon, which keeps Serpens on its own stars. Planet names can be changed with names:. The size of the names and the lookup of stars by HR number are shared by the layers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds names to the map:
ConstellationNameswrites each name in the middle of the biggest part of the constellation that is above the horizon, so a figure in several parts such as Serpens is named on one of its parts. A constellation is left out when half of its stars or more are below the horizon, or when it has no lines (Mensa and Microscopium)Planetswrites the name of each planet next to it withlabels: true, on the side of the center of the map so it stays inside the sky. It is off by default, andnames:changes the namesdata/constellations/iau/names.csv. Astronoby has names too, but it keeps only the first word of the names with several words ("Ursa Minor" becomes "Ursa") and fails to read "Boötes" when the locale is ASCIInames:takes anything that gives a name from an abbreviation, such as a hash, so the names can be translated. A constellation without a name is left outRenderer::Caption, which has a color for each kindThe map of the README shows the names. The Moon is drawn after them there and covers Aquarius, which is only a matter of layer order.