-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAsterismOldLoader.hpp
65 lines (59 loc) · 1.65 KB
/
AsterismOldLoader.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <cmath>
#include <vector>
#include <QString>
class AsterismOldLoader
{
public:
class Asterism
{
public:
struct Star
{
int HIP = -1;
double RA = NAN, DE = NAN;
bool operator==(const Star& rhs) const
{
if (HIP > 0) return HIP == rhs.HIP;
return RA == rhs.RA && DE == rhs.DE;
}
};
QString getTranslatorsComments() const { return translatorsComments; }
QString getEnglishName() const { return englishName; }
private:
//! International name (translated using gettext)
QString nameI18;
//! Name in english (second column in asterism_names.eng.fab)
QString englishName;
//! Extracted comments
QString translatorsComments;
//! Abbreviation
//! A skyculture designer must invent it. (usually 2-5 letters)
//! This MUST be filled and be unique within a sky culture.
QString abbreviation;
//! Context for name
QString context;
//! Number of segments in the lines
unsigned int numberOfSegments;
//! Type of asterism
int typeOfAsterism;
bool flagAsterism;
std::vector<Star> asterism;
std::vector<int> references;
friend class AsterismOldLoader;
public:
bool read(const QString& record);
};
void load(const QString& skyCultureDir, const QString& cultureId);
const Asterism* find(QString const& englishName) const;
bool dumpJSON(std::ostream& s) const;
auto begin() const { return asterisms.cbegin(); }
auto end() const { return asterisms.cend(); }
private:
QString cultureId;
bool hasAsterism = false;
std::vector<Asterism*> asterisms;
Asterism* findFromAbbreviation(const QString& abbrev) const;
void loadLines(const QString& fileName);
void loadNames(const QString& namesFile);
};