Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/SkyCultureMaker/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SET( SkyCultureMaker_SRCS
types/DrawTools.hpp
types/Lines.hpp
types/StarLine.hpp
types/StarPoint.hpp
types/SkyPoint.hpp
types/Anchor.hpp
)

Expand Down
25 changes: 11 additions & 14 deletions plugins/SkyCultureMaker/src/ScmConstellation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#include <QDir>
#include <QFileInfo>

scm::ScmConstellation::ScmConstellation(const std::vector<scm::CoordinateLine> &coordinates,
const std::vector<scm::StarLine> &stars)
: coordinates(coordinates)
scm::ScmConstellation::ScmConstellation(const QString &id, const std::vector<CoordinateLine> &coordinates,
const std::vector<StarLine> &stars, const bool isDarkConstellation)
: id(id)
, coordinates(coordinates)
, stars(stars)
, isDarkConstellation(isDarkConstellation)
{
QSettings *conf = StelApp::getInstance().getSettings();
constellationNameFont.setPixelSize(conf->value("viewing/constellation_font_size", 15).toInt());
Expand All @@ -40,11 +42,6 @@ scm::ScmConstellation::ScmConstellation(const std::vector<scm::CoordinateLine> &
updateTextPosition();
}

void scm::ScmConstellation::setId(const QString &id)
{
ScmConstellation::id = id;
}

QString scm::ScmConstellation::getId() const
{
return id;
Expand Down Expand Up @@ -109,12 +106,12 @@ void scm::ScmConstellation::setConstellation(const std::vector<CoordinateLine> &
updateTextPosition();
}

const std::vector<scm::CoordinateLine>& scm::ScmConstellation::getCoordinates() const
const std::vector<scm::CoordinateLine> &scm::ScmConstellation::getCoordinates() const
{
return coordinates;
}

const std::vector<scm::StarLine>& scm::ScmConstellation::getStars() const
const std::vector<scm::StarLine> &scm::ScmConstellation::getStars() const
{
return stars;
}
Expand Down Expand Up @@ -198,17 +195,17 @@ QJsonObject scm::ScmConstellation::toJson(const QString &skyCultureId) const
// Assemble lines object
QJsonArray linesArray;

if (stars.size() != 0)
if (!isDarkConstellation)
{
// Stars are NOT empty
// not a dark constellation, so we can add stars
for (const auto &star : stars)
{
linesArray.append(star.toJson());
}
}
else
{
// Stars are empty, use the coordinates
// dark constellation, so only add coordinates
for (const auto &coord : coordinates)
{
linesArray.append(coord.toJson());
Expand All @@ -220,7 +217,7 @@ QJsonObject scm::ScmConstellation::toJson(const QString &skyCultureId) const
if (artwork.getHasArt() && !artworkPath.isEmpty())
{
QFileInfo fileInfo(artworkPath);
// the '/' separator is default in all skycultures
// the '/' separator is default in all sky cultures
json["image"] = artwork.toJson("illustrations/" + fileInfo.fileName());
}

Expand Down
20 changes: 12 additions & 8 deletions plugins/SkyCultureMaker/src/ScmConstellation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,12 @@ namespace scm
class ScmConstellation
{
public:
ScmConstellation(const std::vector<CoordinateLine> &coordinates, const std::vector<StarLine> &stars);
ScmConstellation(const QString &id, const std::vector<CoordinateLine> &coordinates,
const std::vector<StarLine> &stars, const bool isDarkConstellation);

/// The frame that is used for calculation and is drawn on.
static const StelCore::FrameType drawFrame = StelCore::FrameJ2000;

/**
* @brief Sets the id of the constellation
*
* @param id id
*/
void setId(const QString &id);

/**
* @brief Gets the id of the constellation
*
Expand Down Expand Up @@ -212,6 +206,13 @@ class ScmConstellation
*/
void show();

/**
* @brief Returns whether the constellation is a dark constellation.
*
* @return true If the constellation is a dark constellation, false otherwise.
*/
bool getIsDarkConstellation() const { return isDarkConstellation; }

private:
/// Identifier of the constellation
QString id;
Expand Down Expand Up @@ -258,6 +259,9 @@ class ScmConstellation
/// Whether the constellation should be drawn or not.
bool isHidden = false;

/// Indicates if the constellation is a dark constellation.
bool isDarkConstellation = false;

/**
* @brief Updates the XYZname that is used for the text position.
*/
Expand Down
Loading
Loading