Stellarium  26.3
Public Member Functions
scm::ScmSkyCulture Class Reference

Public Member Functions

void setId (const QString &id)
 Sets the id of the sky culture.
 
const QString & getId () const
 Gets the id of the sky culture.
 
void setFallbackToInternationalNames (bool fallback)
 Sets whether to show common names in addition to the culture-specific ones.
 
ScmConstellation & addConstellation (const QString &id, const std::vector< ConstellationLine > &lines, const bool isDarkConstellation)
 Adds a constellation to the sky culture.
 
void addLocation (const scm::CulturePolygon &polygon)
 Adds a location to the sky culture.
 
void removeConstellation (const QString &id)
 Removes a constellation from the sky culture by its ID.
 
void removeLocation (int id)
 Removes a location from the sky culture by its ID.
 
ScmConstellation * getConstellation (const QString &id)
 Gets a constellation from the sky culture by its ID.
 
ScmConstellation * getConstellationByEnglishName (const QString &englishName)
 Gets a constellation from the sky culture by its English (translated) name. More...
 
ScmConstellation * getConstellationByDisplayName (const QString &displayName)
 Gets a constellation from the sky culture by its display name, i.e. More...
 
std::vector< std::unique_ptr< ScmConstellation > > * getConstellations ()
 Returns a pointer to the constellations of the sky culture Constellations are held as unique pointers, so the addresses of the constellation objects remain valid even if the vector is modified.
 
QJsonObject toJson (const bool mergeLines) const
 Returns the sky culture as a JSON object. More...
 
QJsonObject getTerritoryGeoJson () const
 Returns the territory of the sky culture as a (Geo)JSON object.
 
void draw (StelCore *core) const
 Draws the sky culture.
 
void setDescription (const scm::Description &description)
 Sets the description of the sky culture. More...
 
void setCulturalNames (const QMap< QString, QList< ScmCulturalName >> &culturalNames)
 Sets the cultural names of stars, planets DSOs of the sky culture. More...
 
bool saveDescriptionAsMarkdown (QFile &file)
 Saves the current sky culture description as markdown text. More...
 
bool saveIllustrations (const QString &directory)
 Saves all illustrations to the directory. More...
 
void mergeLocations ()
 Checks whether the polygons of locations overlap and merges them if necessary.
 
const scm::Description & getDescription () const
 Returns the description of the sky culture.
 
const QMap< QString, QList< ScmCulturalName > > & getCulturalNames () const
 Returns the cultural names map of the sky culture.
 
const QList< CulturePolygon > & getLocations () const
 Returns the geographic locations of the sky culture.
 
bool getFallbackToInternationalNames () const
 Returns whether to fall back to international names when culture-specific names are absent.
 

Member Function Documentation

◆ getConstellationByDisplayName()

ScmConstellation* scm::ScmSkyCulture::getConstellationByDisplayName ( const QString &  displayName)

Gets a constellation from the sky culture by its display name, i.e.

the translated name followed by the id, e.g. "The Market (tianquiztli)".

Parameters
displayNameThe display name to match.
Returns
Pointer to the matching constellation, or nullptr if none matches.

◆ getConstellationByEnglishName()

ScmConstellation* scm::ScmSkyCulture::getConstellationByEnglishName ( const QString &  englishName)

Gets a constellation from the sky culture by its English (translated) name.

The comparison is case-insensitive and ignores non-alphanumeric symbols (e.g. apostrophes, punctuation) so that e.g. "Orion's Belt" matches "Orions Belt".

Parameters
englishNameThe English name to match.
Returns
Pointer to the matching constellation, or nullptr if none matches.

◆ saveDescriptionAsMarkdown()

bool scm::ScmSkyCulture::saveDescriptionAsMarkdown ( QFile &  file)

Saves the current sky culture description as markdown text.

Parameters
fileThe file to save the description to.
Returns
true if the description was saved successfully, false otherwise.

◆ saveIllustrations()

bool scm::ScmSkyCulture::saveIllustrations ( const QString &  directory)

Saves all illustrations to the directory.

No subdirectory is saved.

Parameters
directoryThe directory the illustrations are saved in.
Returns
true Successful saved.
false Failed to save.

◆ setCulturalNames()

void scm::ScmSkyCulture::setCulturalNames ( const QMap< QString, QList< ScmCulturalName >> &  culturalNames)

Sets the cultural names of stars, planets DSOs of the sky culture.

The map key is the object identifier (e.g. "HIP 1234", "NAME Venus", "M 31").

Parameters
culturalNamesMap of cultural names to set.

◆ setDescription()

void scm::ScmSkyCulture::setDescription ( const scm::Description &  description)

Sets the description of the sky culture.

Parameters
descriptionThe description to set.

◆ toJson()

QJsonObject scm::ScmSkyCulture::toJson ( const bool  mergeLines) const

Returns the sky culture as a JSON object.

Parameters
mergeLinesWhether to merge the lines of the constellations into polylines where possible.