Skip to content

Commit 063d855

Browse files
authored
SCM: Fix: Deleted lines during creation of a constellation end up in the output (#4595)
Fix #4593
1 parent 068623c commit 063d855

File tree

14 files changed

+177
-335
lines changed

14 files changed

+177
-335
lines changed

plugins/SkyCultureMaker/CHANGELOG.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

plugins/SkyCultureMaker/ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Sky Culture Maker Plugin - Changelog
2+
3+
1.0.1
4+
Added: Option to automatically merge lines into polylines on export (#4563)
5+
Moved: Constellation description input fields to constellation editor (#4594)
6+
Fixed: Erased lines are still exported (#4595)
7+
Fixed: Drawn constellations are not reset after "Export and Exit" (#4557)
8+
Fixed: "Export and Exit" exits even when export failed, deleting all unsaved progress (#4580)
9+
Fixed: Stop drawing line key (Double Right Click) only works when Star/DSO is selected (#4557)
10+
Fixed: Not all SC description input fields that are marked required are actually checked (#4557)
11+
Fixed: No formal checks for 'Constellations' input field in SC description (#4557)
12+
13+
1.0.0
14+
Initial release of the Sky Culture Maker Plugin

plugins/SkyCultureMaker/src/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ SET( SkyCultureMaker_SRCS
3838

3939
types/Anchor.hpp
4040
types/Classification.hpp
41-
types/CoordinateLine.hpp
41+
types/ConstellationLine.hpp
4242
types/Description.hpp
4343
types/DialogID.hpp
4444
types/Drawing.hpp
4545
types/DrawingMode.hpp
4646
types/DrawTools.hpp
4747
types/License.hpp
48-
types/Lines.hpp
4948
types/SkyPoint.hpp
50-
types/StarLine.hpp
5149
)
5250

5351
SET( SCM_UIS

plugins/SkyCultureMaker/src/ScmConstellation.cpp

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@
2525
#include <QDir>
2626
#include <QFileInfo>
2727

28-
scm::ScmConstellation::ScmConstellation(const QString &id, const std::vector<CoordinateLine> &coordinates,
29-
const std::vector<StarLine> &stars, const bool isDarkConstellation)
28+
scm::ScmConstellation::ScmConstellation(const QString &id, const std::vector<ConstellationLine> &lines, const bool isDarkConstellation)
3029
: id(id)
31-
, coordinates(coordinates)
32-
, stars(stars)
30+
, lines(lines)
3331
, isDarkConstellation(isDarkConstellation)
3432
{
3533
QSettings *conf = StelApp::getInstance().getSettings();
@@ -97,23 +95,15 @@ const scm::ScmConstellationArtwork &scm::ScmConstellation::getArtwork() const
9795
return artwork;
9896
}
9997

100-
void scm::ScmConstellation::setConstellation(const std::vector<CoordinateLine> &coordinates,
101-
const std::vector<StarLine> &stars)
98+
void scm::ScmConstellation::setLines(const std::vector<ConstellationLine> &lines)
10299
{
103-
scm::ScmConstellation::coordinates = coordinates;
104-
scm::ScmConstellation::stars = stars;
105-
100+
scm::ScmConstellation::lines = lines;
106101
updateTextPosition();
107102
}
108103

109-
const std::vector<scm::CoordinateLine> &scm::ScmConstellation::getCoordinates() const
110-
{
111-
return coordinates;
112-
}
113-
114-
const std::vector<scm::StarLine> &scm::ScmConstellation::getStars() const
104+
const std::vector<scm::ConstellationLine> &scm::ScmConstellation::getLines() const
115105
{
116-
return stars;
106+
return lines;
117107
}
118108

119109
void scm::ScmConstellation::drawConstellation(StelCore *core, const Vec3f &lineColor, const Vec3f &nameColor) const
@@ -129,9 +119,9 @@ void scm::ScmConstellation::drawConstellation(StelCore *core, const Vec3f &lineC
129119

130120
painter.setColor(lineColor, 1.0f);
131121

132-
for (CoordinateLine p : coordinates)
122+
for (const ConstellationLine &line : lines)
133123
{
134-
painter.drawGreatCircleArc(p.start, p.end);
124+
painter.drawGreatCircleArc(line.start.coordinate, line.end.coordinate);
135125
}
136126

137127
drawNames(core, painter, nameColor);
@@ -198,17 +188,17 @@ QJsonObject scm::ScmConstellation::toJson(const QString &skyCultureId, const boo
198188
if (!isDarkConstellation)
199189
{
200190
// not a dark constellation, so we can add stars
201-
for (const auto &star : stars)
191+
for (const auto &line : lines)
202192
{
203-
linesArray.append(star.toJson());
193+
linesArray.append(line.starsToJson());
204194
}
205195
}
206196
else
207197
{
208198
// dark constellation, so only add coordinates
209-
for (const auto &coord : coordinates)
199+
for (const auto &line : lines)
210200
{
211-
linesArray.append(coord.toJson());
201+
linesArray.append(line.coordinatesToJson());
212202
}
213203
}
214204

@@ -272,10 +262,10 @@ bool scm::ScmConstellation::saveArtwork(const QString &directory)
272262
void scm::ScmConstellation::updateTextPosition()
273263
{
274264
XYZname.set(0., 0., 0.);
275-
for (CoordinateLine p : coordinates)
265+
for (const ConstellationLine &line : lines)
276266
{
277-
XYZname += p.end;
278-
XYZname += p.start;
267+
XYZname += line.end.coordinate;
268+
XYZname += line.start.coordinate;
279269
}
280270
XYZname.normalize();
281271
}

plugins/SkyCultureMaker/src/ScmConstellation.hpp

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626

2727
#include "ScmConstellationArtwork.hpp"
2828
#include "VecMath.hpp"
29-
#include "types/CoordinateLine.hpp"
30-
#include "types/StarLine.hpp"
29+
#include "types/ConstellationLine.hpp"
3130
#include <StelCore.hpp>
3231
#include <optional>
3332
#include <variant>
@@ -42,8 +41,7 @@ namespace scm
4241
class ScmConstellation
4342
{
4443
public:
45-
ScmConstellation(const QString &id, const std::vector<CoordinateLine> &coordinates,
46-
const std::vector<StarLine> &stars, const bool isDarkConstellation);
44+
ScmConstellation(const QString &id, const std::vector<ConstellationLine> &lines, const bool isDarkConstellation);
4745

4846
/// The frame that is used for calculation and is drawn on.
4947
static const StelCore::FrameType drawFrame = StelCore::FrameJ2000;
@@ -130,27 +128,18 @@ class ScmConstellation
130128
const ScmConstellationArtwork &getArtwork() const;
131129

132130
/**
133-
* @brief Sets the coordinate lines and star lines of the constellation.
131+
* @brief Sets the lines of the constellation.
134132
*
135-
* @param coordinates The coordinates of the constellation.
136-
* @param stars The equivalent stars to the coordinates.
133+
* @param lines The lines of the constellation.
137134
*/
138-
void setConstellation(const std::vector<CoordinateLine> &coordinates, const std::vector<StarLine> &stars);
135+
void setLines(const std::vector<ConstellationLine> &lines);
139136

140137
/**
141-
* @brief Gets the coordinates of the constellation.
138+
* @brief Gets the lines of the constellation.
142139
*
143-
* @return The coordinates of the constellation.
140+
* @return The lines of the constellation.
144141
*/
145-
const std::vector<CoordinateLine> &getCoordinates() const;
146-
147-
/**
148-
* @brief Gets the stars of the constellation.
149-
*
150-
* @return The stars of the constellation.
151-
*/
152-
const std::vector<StarLine> &getStars() const;
153-
142+
const std::vector<ConstellationLine> &getLines() const;
154143
/**
155144
* @brief Draws the constellation based on the coordinates.
156145
*
@@ -237,11 +226,8 @@ class ScmConstellation
237226
/// References to the sources of the name spellings
238227
std::optional<QVector<int>> references;
239228

240-
/// List of coordinates forming the segments.
241-
std::vector<CoordinateLine> coordinates;
242-
243-
/// List of stars forming the segments. Might be empty.
244-
std::vector<StarLine> stars;
229+
/// The lines forming the constellation
230+
std::vector<ConstellationLine> lines;
245231

246232
/// A short description of the constellation that could be shown in e.g. an info block.
247233
QString description;

0 commit comments

Comments
 (0)