• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 13260145531

11 Feb 2025 09:41AM UTC coverage: 12.127% (+0.03%) from 12.101%
13260145531

Pull #3751

github

10110111
Restore deleted additional SC files
Pull Request #3751: Switch skycultures to the new format

14613 of 120497 relevant lines covered (12.13%)

18620.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/core/modules/StarWrapper.cpp
1
/*
2
 * The big star catalogue extension to Stellarium:
3
 * Author and Copyright: Johannes Gajdosik, 2006, 2007
4
 * The implementation of most functions in this file
5
 * (getInfoString,getShortInfoString,...) is taken from
6
 * Stellarium, Copyright (C) 2002 Fabien Chereau,
7
 * and therefore the copyright of these belongs to Fabien Chereau.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
22
 */
23

24
#include "StarWrapper.hpp"
25
#include "ZoneArray.hpp"
26

27
#include "StelUtils.hpp"
28
#include "StelTranslator.hpp"
29
#include "StarMgr.hpp"
30

31
#include <QTextStream>
32
#include <limits>
33

34
template<typename T> inline bool isNan(T value)
×
35
{
36
        return value != value; // lgtm [cpp/comparison-of-identical-expressions]
×
37
}
38

39
template<typename T> inline bool isInf(T value)
×
40
{
41
        return std::numeric_limits<T>::has_infinity && value == std::numeric_limits<T>::infinity();
×
42
}
43

44
QString StarWrapperBase::getInfoString(const StelCore *core, const InfoStringGroup& flags) const
×
45
{
46
        QString str;
×
47
        QTextStream oss(&str);
×
48

49
        if (flags&ObjectType)
×
50
                oss << QString("%1: <b>%2</b>").arg(q_("Type"), getObjectTypeI18n()) << "<br />";
×
51

52
        oss << getMagnitudeInfoString(core, flags, 2);
×
53

54
        if (flags&Extra)
×
55
                oss << QString("%1: <b>%2</b>").arg(q_("Color Index (B-V)"), QString::number(getBV(), 'f', 2)) << "<br />";
×
56
        
57
        oss << getCommonInfoString(core, flags);
×
58
        oss << getSolarLunarInfoString(core, flags);
×
59

60
        StelObject::postProcessInfoString(str, flags);
×
61

62
        return str;
×
63
}
×
64

65
QString StarWrapper1::getEnglishName(void) const
×
66
{
67
        if (s->getHip())
×
68
                return QString("HIP %1").arg(s->getHip());
×
69
        else
70
                return QString("Gaia DR3 %1").arg(s->getGaia());
×
71
}
72

73
QString StarWrapper1::getID(void) const
×
74
{
75
        QString hip;
×
76
        if (s->getHip())
×
77
        {
78
                if (s->hasComponentID())
×
79
                        hip = QString("HIP %1 %2").arg(s->getHip()).arg(StarMgr::convertToComponentIds(s->getComponentIds()));
×
80
                else
81
                        hip = QString("HIP %1").arg(s->getHip());
×
82
        }
83
        else
84
        {
85
                hip = QString("Gaia DR3 %1").arg(s->getGaia());
×
86
        }
87

88
        return hip;
×
89
}
×
90

91
QString StarWrapper1::getObjectType() const
×
92
{
93
        StarId star_id;
94
        if (s->getHip())
×
95
        {
96
                star_id = s->getHip();
×
97
        }
98
        else
99
        {
100
                star_id = s->getGaia();
×
101
        }
102

103
        const QString varType = StarMgr::getGcvsVariabilityType(star_id);
×
104
        const int wdsObs = StarMgr::getWdsLastObservation(star_id);
×
105
        QString varstartype = "";
×
106
        QString startype = (s->getComponentIds() || wdsObs>0) ? N_("double star") : N_("star");
×
107
        if(!varType.isEmpty())
×
108
        {
109
                // see also http://www.sai.msu.su/gcvs/gcvs/vartype.htm
110
                if (QString("BE FU GCAS I IA IB IN INA INB INT IT IN(YY) IS ISA ISB RCB RS SDOR UV UVN WR").contains(varType))
×
111
                        varstartype = N_("eruptive variable star");
×
112
                else if (QString("ACYG BCEP BCEPS BLBOO CEP CEP(B) CW CWA CWB DCEP DCEPS DSCT DSCTC GDOR L LB LC LPB M PVTEL RPHS RR RR(B) RRAB RRC RV RVA RVB SR SRA SRB SRC SRD SXPHE ZZ ZZA ZZB ZZO").contains(varType))
×
113
                        varstartype = N_("pulsating variable star");
×
114
                else if (QString("ACV, ACVO, BY, ELL, FKCOM, PSR, SXARI").contains(varType))
×
115
                        varstartype = N_("rotating variable star");
×
116
                else if (QString("N NA NB NC NL NR SN SNI SNII UG UGSS UGSU UGZ ZAND").contains(varType))
×
117
                        varstartype = N_("cataclysmic variable star");
×
118
                else if (QString("E EA EB EP EW GS PN RS WD WR AR D DM DS DW K KE KW SD E: E:/WR E/D E+LPB: EA/D EA/D+BY EA/RS EA/SD EA/SD: EA/GS EA/GS+SRC EA/DM EA/WR EA+LPB EA+LPB: EA+DSCT EA+BCEP: EA+ZAND EA+ACYG EA+SRD EB/GS EB/DM EB/KE EB/KE: EW/KE EA/AR/RS EA/GS/D EA/D/WR").contains(varType))
×
119
                        varstartype = N_("eclipsing binary system");
×
120
                else
121
                // XXX intense variable X-ray sources "AM, X, XB, XF, XI, XJ, XND, XNG, XP, XPR, XPRM, XM)"
122
                // XXX other symbols "BLLAC, CST, GAL, L:, QSO, S,"
123
                        varstartype = N_("variable star");
×
124
        }
125

126
        if (!varType.isEmpty())
×
127
        {
128
                QString vtt = varstartype;
×
129
                if (s->getComponentIds() || wdsObs>0)
×
130
                        vtt = QString("%1, %2").arg(startype, varstartype);
×
131
                return vtt;
×
132
        }
×
133
        else
134
                return startype;
×
135
}
×
136

137
QString StarWrapper1::getObjectTypeI18n() const
×
138
{
139
        QString stypefinal, stype = getObjectType();
×
140
        StarId star_id;
141
        if (s->getHip())
×
142
        {
143
                star_id = s->getHip();
×
144
        }
145
        else
146
        {
147
                star_id = s->getGaia();
×
148
        }
149
        const QString varType = StarMgr::getGcvsVariabilityType(star_id);
×
150
        if (!varType.isEmpty())
×
151
        {
152
                if (stype.contains(","))
×
153
                {
154
                        QStringList stypesI18n, stypes = stype.split(",");
×
155
                        for (const auto &st: stypes) { stypesI18n << q_(st.trimmed()); }
×
156
                        stypefinal = stypesI18n.join(", ");
×
157
                }
×
158
                else
159
                        stypefinal = q_(stype);
×
160
        }
161
        else
162
                stypefinal = q_(stype);
×
163

164
        return stypefinal;
×
165
}
×
166

167
QString StarWrapper1::getInfoString(const StelCore *core, const InfoStringGroup& flags) const
×
168
{
169
        QString str;
×
170
        QTextStream oss(&str);
×
171
        double az_app, alt_app;
172
        StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core));
×
173
        Q_UNUSED(az_app)
174

175
        StarId star_id;
176
        if (s->getHip())
×
177
                star_id = s->getHip();
×
178
        else
179
                star_id = s->getGaia();
×
180

181
        const QString varType = StarMgr::getGcvsVariabilityType(star_id);
×
182
        const QString objType = StarMgr::convertToOjectTypes(s->getObjType());
×
183
        const int wdsObs = StarMgr::getWdsLastObservation(star_id);
×
184
        const float wdsPA = StarMgr::getWdsLastPositionAngle(star_id);
×
185
        const float wdsSep = StarMgr::getWdsLastSeparation(star_id);
×
186
        const float maxVMag = StarMgr::getGcvsMaxMagnitude(star_id);
×
187
        const float magFlag = StarMgr::getGcvsMagnitudeFlag(star_id);
×
188
        const float minVMag = StarMgr::getGcvsMinMagnitude(star_id);
×
189
        const float min2VMag = StarMgr::getGcvsMinMagnitude(star_id, false);
×
190
        const QString photoVSys = StarMgr::getGcvsPhotometricSystem(star_id);
×
191
        const double vEpoch = StarMgr::getGcvsEpoch(star_id);
×
192
        const double vPeriod = StarMgr::getGcvsPeriod(star_id);
×
193
        const int vMm = StarMgr::getGcvsMM(star_id);
×
194

195
        if ((flags&Name) || (flags&CatalogNumber))
×
196
                oss << "<h2>";
×
197

198
        const QString commonNameI18 = StarMgr::getCommonName(star_id);
×
199
        const QString additionalNameI18 = StarMgr::getAdditionalNames(star_id);
×
200
        const QString sciName = StarMgr::getSciName(star_id);
×
201
        const QString sciExtraName = StarMgr::getSciExtraName(star_id);
×
202
        const QString varSciName = StarMgr::getGcvsName(star_id);
×
203
        const QString wdsSciName = StarMgr::getWdsName(star_id);
×
204
        QStringList designations;
×
205
        if (!sciName.isEmpty())
×
206
                designations.append(sciName);
×
207
        if (!sciExtraName.isEmpty())
×
208
                designations.append(sciExtraName);
×
209
        if (!varSciName.isEmpty() && !sciName.contains(varSciName, Qt::CaseInsensitive))
×
210
                designations.append(varSciName);
×
211

212
        QString hip, hipq;
×
213
        if (s->getHip())
×
214
        {
215
                if (s->hasComponentID())
×
216
                {
217
                        hip = QString("HIP %1 %2").arg(s->getHip()).arg(StarMgr::convertToComponentIds(s->getComponentIds()));
×
218
                        hipq = QString("%1%2").arg(s->getHip()).arg(StarMgr::convertToComponentIds(s->getComponentIds()));
×
219
                }
220
                else
221
                {
222
                        hip = QString("HIP %1").arg(s->getHip());
×
223
                        hipq = QString("%1").arg(s->getHip());
×
224
                }
225
                designations.append(hip);
×
226
        }
227
        else
228
        {
229
                hipq = QString("%1").arg(s->getGaia());  // need to look up with Gaia number
×
230
        }
231

232
        const QString crossIndexData = StarMgr::getCrossIdentificationDesignations(hipq);
×
233
        if (!crossIndexData.isEmpty())
×
234
                designations.append(crossIndexData);
×
235

236
        if (s->getGaia())
×
237
                designations.append(QString("Gaia DR3 %1").arg(s->getGaia()));
×
238

239
        if (!wdsSciName.isEmpty() && !sciName.contains(wdsSciName, Qt::CaseInsensitive))
×
240
                designations.append(wdsSciName);
×
241

242
        QString designationsList = designations.join(" - ");
×
243
        designations.clear();
×
244
        designations = designationsList.split(" - ");
×
245
        designations.removeDuplicates();
×
246
        int asize = designations.size();
×
247
        if (asize>6) // Special case for many designations (max - 7 items per line); NOTE: Should we add size to the config data for skyculture?
×
248
        {
249
                designationsList = "";
×
250
                for(int i=0; i<asize; i++)
×
251
                {
252
                        designationsList.append(designations.at(i));
×
253
                        if (i<asize-1)
×
254
                                designationsList.append(" - ");
×
255

256
                        if (i>0 && (i % 6)==0 && i<(asize-1))
×
257
                                designationsList.append("<br />");
×
258
                }
259
        }
260
        else
261
                designationsList = designations.join(" - ");
×
262

263
        if (flags&Name)
×
264
        {
265
                QString commonNames;
×
266
                if (!commonNameI18.isEmpty())
×
267
                        commonNames = commonNameI18;
×
268

269
                if (!additionalNameI18.isEmpty() && StarMgr::getFlagAdditionalNames())
×
270
                {
271
                        QStringList additionalNames = additionalNameI18.split(" - ");
×
272
                        additionalNames.removeDuplicates();
×
273

274
                        commonNames.append(QString(" (%1)").arg(additionalNames.join(" - ")));
×
275
                }
×
276

277
                if (!commonNames.isEmpty())
×
278
                        oss << StelUtils::wrapText(commonNames, 80);
×
279

280
                if (!commonNameI18.isEmpty() && !designationsList.isEmpty() && flags&CatalogNumber)
×
281
                        oss << "<br />";
×
282
        }
×
283

284
        if (flags&CatalogNumber)
×
285
                oss << designationsList;
×
286

287
        if ((flags&Name) || (flags&CatalogNumber))
×
288
                oss << "</h2>";
×
289

290
        if (flags&Name)
×
291
        {
292
                QStringList extraNames=getExtraInfoStrings(Name);
×
293
                if (!extraNames.isEmpty())
×
294
                        oss << q_("Additional names: ") << extraNames.join(", ") << "<br/>";
×
295
        }
×
296
        if (flags&CatalogNumber)
×
297
        {
298
                QStringList extraCat=getExtraInfoStrings(CatalogNumber);
×
299
                if (!extraCat.isEmpty())
×
300
                        oss << q_("Additional catalog numbers: ") << extraCat.join(", ") << "<br/>";
×
301
        }
×
302

303
        QString stype = getObjectType();
×
304
        QString objectTypeI18nStr = getObjectTypeI18n();
×
305
        bool ebsFlag = stype.contains("eclipsing binary system");
×
306
        if (flags&ObjectType)
×
307
        {
308
                QStringList stypes;
×
309
                if (!objType.isEmpty())
×
310
                        stypes.append(objType);
×
311
                if (!varType.isEmpty())
×
312
                        stypes.append(varType);
×
313
                if (stypes.size()>0)
×
314
                        oss << QString("%1: <b>%2</b> (%3)").arg(q_("Type"), objectTypeI18nStr, stypes.join(", ")) << "<br />";
×
315
                else
316
                        oss << QString("%1: <b>%2</b>").arg(q_("Type"), objectTypeI18nStr) << "<br />";
×
317

318
                oss << getExtraInfoStrings(flags&ObjectType).join("");
×
319
        }
×
320

321
        double RA, DEC, pmra, pmdec;
322
        double PlxErr = s->getPlxErr();
×
323
        double Plx = s->getPlx();
×
324
        double RadialVel = s->getRV();
×
325
        float dyrs = static_cast<float>(core->getJDE()-STAR_CATALOG_JDEPOCH)/365.25;
×
326
        s->getFull6DSolution(RA, DEC, Plx, pmra, pmdec, RadialVel, dyrs);
×
327

328
        float magOffset = 0.f;
×
329
        if (Plx)
×
330
        {
331
                magOffset = 5.f * log10((s->getPlx())/Plx);
×
332
        } 
333
        oss << getMagnitudeInfoString(core, flags, 2, magOffset);
×
334

335
        if ((flags&AbsoluteMagnitude) && Plx && !isNan(Plx) && !isInf(Plx))
×
336
                // should use Plx from getPlx because Plx can change with time, but not absolute magnitude
337
                oss << QString("%1: %2").arg(q_("Absolute Magnitude")).arg(getVMagnitude(core)+5.*(1.+std::log10(0.001*s->getPlx())), 0, 'f', 2) << "<br />";
×
338
        if (flags&AbsoluteMagnitude)
×
339
                oss << getExtraInfoStrings(AbsoluteMagnitude).join("");
×
340

341
        if (flags&Extra)
×
342
        {
343
                oss << QString("%1: <b>%2</b>").arg(q_("Color Index (B-V)"), QString::number(s->getBV(), 'f', 2)) << "<br />";
×
344

345
                if (!varType.isEmpty())
×
346
                {
347
                        float minimumM1 = minVMag;
×
348
                        float minimumM2 = min2VMag;
×
349
                        if (magFlag==1.f) // Amplitude
×
350
                        {
351
                                minimumM1 += maxVMag;
×
352
                                minimumM2 += maxVMag;
×
353
                        }
354

355
                        if (maxVMag!=99.f) // seems it is not eruptive variable star
×
356
                        {
357
                                QString minStr = QString::number(minimumM1, 'f', 2);
×
358
                                if (min2VMag<99.f)
×
359
                                        minStr = QString("%1/%2").arg(QString::number(minimumM1, 'f', 2), QString::number(minimumM2, 'f', 2));
×
360

361
                                oss << QString("%1: <b>%2</b>%3<b>%4</b> (%5: %6)").arg(q_("Magnitude range"), QString::number(maxVMag, 'f', 2), QChar(0x00F7), minStr, q_("Photometric system"), photoVSys) << "<br />";
×
362
                        }
×
363
                }
364
        }
365

366
        oss << getCommonInfoString(core, flags);
×
367

368
        // kinda impossible for both parallax and parallax_err to be exactly 0, so they must just be missing
369
        if (flags&Distance)
×
370
        {
371
                // do parallax SNR cut because we are calculating distance, inverse parallax is bad for >20% uncertainty
372
                if ((Plx!=0) && (PlxErr!=0) && (Plx/PlxErr>5))
×
373
                {
374
                        //TRANSLATORS: Unit of measure for distance - Light Years
375
                        QString ly = qc_("ly", "distance");
×
376
                        double distance = PARSEC_LY * 1000. / Plx;
×
377
                        oss << QString("%1: %2%3%4 %5").arg(q_("Distance"), QString::number(distance, 'f', 2), QChar(0x00B1), QString::number(distance * PlxErr / Plx, 'f', 2), ly) << "<br />";
×
378
                }
×
379
                oss << getExtraInfoStrings(Distance).join("");
×
380
        }
381

382
        // kinda impossible for both pm to be exactly 0, so they must just be missing
383
        if ((flags&ProperMotion) && (pmra || pmdec))
×
384
        {
385
                float pa = std::atan2(pmra, pmdec)*M_180_PIf;
×
386
                if (pa<0)
×
387
                        pa += 360.f;
×
388
                oss << QString("%1: %2 %3 %4 %5°").arg(q_("Proper motion"),
×
389
                                                        QString::number(std::sqrt(pmra * pmra + pmdec * pmdec), 'f', 2),
×
390
                                                        qc_("mas/yr", "milliarc second per year"),
×
391
                                                        qc_("towards", "into the direction of"),
×
392
                                                        QString::number(pa, 'f', 1)) << "<br />";
×
393
                oss << QString("%1: %2 %3 (%4)").arg(q_("Proper motions by axes"),
×
394
                                                        QString::number(pmra, 'f', 2),
×
395
                                                        QString::number(pmdec, 'f', 2),
×
396
                                                        qc_("mas/yr", "milliarc second per year")) << "<br />";
×
397
        }
398

399
        if (flags&Velocity)
×
400
        {
401
                if (RadialVel)
×
402
                {
403
                        // TRANSLATORS: Unit of measure for speed - kilometers per second
404
                        QString kms = qc_("km/s", "speed");
×
405
                        oss << QString("%1: %2 %3").arg(q_("Radial velocity"), QString::number(RadialVel, 'f', 1), kms) << "<br />";
×
406
                }
×
407
        }
408

409
        if (flags&Extra)
×
410
        {
411
                if (Plx!=0)
×
412
                {
413
                        QString plx = q_("Parallax");
×
414
                        if (PlxErr>0.f)
×
415
                                oss <<  QString("%1: %2%3%4 ").arg(plx, QString::number(Plx, 'f', 3), QChar(0x00B1), QString::number(PlxErr, 'f', 3));
×
416
                        else
417
                                oss << QString("%1: %2 ").arg(plx, QString::number(Plx, 'f', 3));
×
418
                        oss  << qc_("mas", "parallax") << "<br />";
×
419
                }
×
420

421
                if (s->getSpInt())
×
422
                        oss << QString("%1: %2").arg(q_("Spectral Type"), StarMgr::convertToSpectralType(s->getSpInt())) << "<br />";
×
423

424
                if (vPeriod>0)
×
425
                        oss << QString("%1: %2 %3").arg(q_("Period")).arg(vPeriod).arg(qc_("days", "duration")) << "<br />";
×
426

427
                if (vEpoch>0 && vPeriod>0)
×
428
                {
429
                        // Calculate next minimum or maximum light
430
                        double vsEpoch = 2400000+vEpoch;
×
431
                        double npDate = vsEpoch + vPeriod * ::floor(1.0 + (core->getJDE() - vsEpoch)/vPeriod);
×
432
                        QString nextDate = StelUtils::julianDayToISO8601String(npDate).replace("T", " ");
×
433
                        QString dateStr = q_("Next maximum light");
×
434
                        if (ebsFlag)
×
435
                                dateStr = q_("Next minimum light");
×
436

437
                        oss << QString("%1: %2 UTC").arg(dateStr, nextDate) << "<br />";
×
438
                }
×
439

440
                if (vMm>0)
×
441
                {
442
                        QString mmStr = q_("Rising time");
×
443
                        if (ebsFlag)
×
444
                                mmStr = q_("Duration of eclipse");
×
445

446
                        float daysFraction = vPeriod * vMm / 100.f;
×
447
                        auto dms = StelUtils::daysFloatToDHMS(daysFraction);
×
448
                        oss << QString("%1: %2% (%3)").arg(mmStr).arg(vMm).arg(dms) << "<br />";
×
449
                }
×
450

451
                if (wdsObs>0)
×
452
                {
453
                        oss << QString("%1 (%3): %2°").arg(q_("Position angle"),
×
454
                                                        QString::number(wdsPA, 'f', 2),
×
455
                                                        QString::number(wdsObs)) << "<br />";
×
456
                        if (wdsSep>0.f && wdsSep<999.f) // A spectroscopic binary or not?
×
457
                        {
458
                                if (wdsSep>60.f) // A wide binary star?
×
459
                                        oss << QString("%1 (%4): %2\" (%3)").arg(
×
460
                                                                            q_("Separation"),
×
461
                                                                            QString::number(wdsSep, 'f', 3),
×
462
                                                                            StelUtils::decDegToDmsStr(wdsSep/3600.f),
×
463
                                                                            QString::number(wdsObs)) << "<br />";
×
464
                                else
465
                                        oss << QString("%1 (%3): %2\"").arg(q_("Separation"), QString::number(wdsSep, 'f', 3), QString::number(wdsObs)) << "<br />";
×
466
                        }
467
                }
468
        }
469

470
        oss << getSolarLunarInfoString(core, flags);
×
471

472
        StelObject::postProcessInfoString(str, flags);
×
473

474
        return str;
×
475
}
×
476

477
QVariantMap StarWrapper1::getInfoMap(const StelCore *core) const
×
478
{
479
        QVariantMap map = StelObject::getInfoMap(core);
×
480
        StarId star_id;
481
        if (s->getHip())
×
482
        {
483
                star_id = s->getHip();
×
484
        }
485
        else
486
        {
487
                star_id = s->getGaia();
×
488
        }
489
        const QString varType = StarMgr::getGcvsVariabilityType(star_id);
×
490
        const int wdsObs = StarMgr::getWdsLastObservation(star_id);
×
491
        const float wdsPA = StarMgr::getWdsLastPositionAngle(star_id);
×
492
        const float wdsSep = StarMgr::getWdsLastSeparation(star_id);
×
493
        const double vPeriod = StarMgr::getGcvsPeriod(star_id);
×
494

495
        QString varstartype = "no";
×
496
        QString startype = "star";
×
497
        if(!varType.isEmpty())
×
498
        {
499
                if (QString("FU GCAS I IA IB IN INA INB INT IT IN(YY) IS ISA ISB RCB RS SDOR UV UVN WR").contains(varType))
×
500
                        varstartype = "eruptive";
×
501
                else if (QString("ACYG BCEP BCEPS CEP CEP(B) CW CWA CWB DCEP DCEPS DSCT DSCTC GDOR L LB LC M PVTEL RPHS RR RR(B) RRAB RRC RV RVA RVB SR SRA SRB SRC SRD SXPHE ZZ ZZA ZZB").contains(varType))
×
502
                        varstartype = "pulsating";
×
503
                else if (QString("ACV, ACVO, BY, ELL, FKCOM, PSR, SXARI").contains(varType))
×
504
                        varstartype = "rotating";
×
505
                else if (QString("N NA NB NC NL NR SN SNI SNII UG UGSS UGSU UGZ ZAND").contains(varType))
×
506
                        varstartype = "cataclysmic";
×
507
                else if (QString("E EA EB EW GS PN RS WD WR AR D DM DS DW K KE KW SD E: E:/WR E/D E+LPB: EA/D EA/D+BY EA/RS EA/SD EA/SD: EA/GS EA/GS+SRC EA/DM EA/WR EA+LPB EA+LPB: EA+DSCT EA+BCEP: EA+ZAND EA+ACYG EA+SRD EB/GS EB/DM EB/KE EB/KE: EW/KE EA/AR/RS EA/GS/D EA/D/WR").contains(varType))
×
508
                {
509
                        varstartype = "eclipsing-binary";
×
510
                }
511
                else
512
                        varstartype = "variable";
×
513
        }
514
        map.insert("variable-star", varstartype);
×
515

516
        if (s->getComponentIds() || wdsObs>0)
×
517
                startype = "double-star";
×
518

519
        map.insert("star-type", startype);
×
520

521
        map.insert("bV", s->getBV());
×
522

523
        if (s->getPlx())
×
524
        {
525
                map.insert("parallax", 0.001*s->getPlx());
×
526
                map.insert("absolute-mag", getVMagnitude(core)+5.f*(std::log10(0.001*s->getPlx())));
×
527
                map.insert("distance-ly", (AU/(SPEED_OF_LIGHT*86400*365.25)) / (s->getPlx()*((0.001/3600)*(M_PI/180))));
×
528
        }
529

530
        if (s->getSpInt())
×
531
                map.insert("spectral-class", StarMgr::convertToSpectralType(s->getSpInt()));
×
532

533
        if (vPeriod>0)
×
534
                map.insert("period", vPeriod);
×
535

536
        if (wdsObs>0)
×
537
        {
538
                map.insert("wds-year", wdsObs);
×
539
                map.insert("wds-position-angle", wdsPA);
×
540
                map.insert("wds-separation", wdsSep);
×
541
        }
542

543
        return map;
×
544
}
×
545

546
QString StarWrapper2::getInfoString(const StelCore *core, const InfoStringGroup& flags) const
×
547
{
548
        QString str;
×
549
        QTextStream oss(&str);
×
550

551
        if (s->getGaia()) {
×
552
                if ((flags&Name) || (flags&CatalogNumber))
×
553
                        oss << "<h2>";
×
554
                QString gaia_id;
×
555
                gaia_id = QString("Gaia DR3 %1").arg(s->getGaia());
×
556
                oss << gaia_id;
×
557
                if ((flags&Name) || (flags&CatalogNumber))
×
558
                        oss << "</h2>";
×
559
        }
×
560

561
        if (flags&ObjectType)
×
562
                oss << QString("%1: <b>%2</b>").arg(q_("Type"), getObjectTypeI18n()) << "<br />";
×
563

564
        oss << getMagnitudeInfoString(core, flags, 2);
×
565

566
        double RA, DEC, pmra, pmdec;
567
        double Plx = s->getPlx();
×
568
        double PlxErr = s->getPlxErr();
×
569
        double RadialVel = s->getRV();
×
570
        float dyrs = static_cast<float>(core->getJDE()-STAR_CATALOG_JDEPOCH)/365.25;
×
571
        s->getFull6DSolution(RA, DEC, Plx, pmra, pmdec, RadialVel, dyrs);
×
572
        bool computeAstrometryFlag = (flags&ProperMotion) && (pmra || pmdec);
×
573

574
        if ((flags&AbsoluteMagnitude) && s->getPlx())
×
575
                // should use Plx from getPlx because Plx can change with time, but not absolute magnitude
576
                oss << QString("%1: %2").arg(q_("Absolute Magnitude")).arg(getVMagnitude(core)+5.*(1.+std::log10(0.001*s->getPlx())), 0, 'f', 2) << "<br />";
×
577

578
        if (flags&Extra)
×
579
                oss << QString("%1: <b>%2</b>").arg(q_("Color Index (B-V)"), QString::number(getBV(), 'f', 2)) << "<br />";
×
580
        
581
        oss << getCommonInfoString(core, flags);
×
582

583
        // kinda impossible for both pm to be exactly 0, so they must just be missing
584
        if (computeAstrometryFlag)
×
585
        {
586
                float pa = std::atan2(pmra, pmdec)*M_180_PIf;
×
587
                if (pa<0)
×
588
                        pa += 360.f;
×
589
                oss << QString("%1: %2 %3 %4 %5°").arg(q_("Proper motion"),
×
590
                                                        QString::number(std::sqrt(pmra * pmra + pmdec * pmdec), 'f', 2),
×
591
                                                        qc_("mas/yr", "milliarc second per year"),
×
592
                                                        qc_("towards", "into the direction of"),
×
593
                                                        QString::number(pa, 'f', 1)) << "<br />";
×
594
                oss << QString("%1: %2 %3 (%4)").arg(q_("Proper motions by axes"),
×
595
                                                        QString::number(pmra, 'f', 2),
×
596
                                                        QString::number(pmdec, 'f', 2),
×
597
                                                        qc_("mas/yr", "milliarc second per year")) << "<br />";
×
598
        }
599

600
        // kinda impossible for both parallax and parallax_err to be exactly 0, so they must just be missing
601
        if (flags&Distance)
×
602
        {
603
                // do parallax SNR cut because we are calculating distance, inverse parallax is bad for >20% uncertainty
604
                if ((Plx!=0) && (PlxErr!=0) & (Plx/PlxErr > 5.))
×
605
                {
606
                        //TRANSLATORS: Unit of measure for distance - Light Years
607
                        QString ly = qc_("ly", "distance");
×
608
                        double distance = PARSEC_LY * 1000. / Plx;
×
609
                        oss << QString("%1: %2%3%4 %5").arg(q_("Distance"), QString::number(distance, 'f', 2), QChar(0x00B1), QString::number(distance * PlxErr / Plx, 'f', 2), ly) << "<br />";
×
610
                }
×
611
                if ((Plx!=0) && (PlxErr!=0))  // as long as having parallax, display it (but not neccessarily displaying inverse parallax)
×
612
                {
613
                        QString plx = q_("Parallax");
×
614
                        if (PlxErr>0.f)
×
615
                                oss <<  QString("%1: %2%3%4 ").arg(plx, QString::number(Plx, 'f', 3), QChar(0x00B1), QString::number(PlxErr, 'f', 3));
×
616
                        else
617
                                oss << QString("%1: %2 ").arg(plx, QString::number(Plx, 'f', 3));
×
618
                        oss  << qc_("mas", "parallax") << "<br />";
×
619
                }
×
620
                oss << getExtraInfoStrings(Distance).join("");
×
621
        }
622

623
        oss << getSolarLunarInfoString(core, flags);
×
624

625
        StelObject::postProcessInfoString(str, flags);
×
626

627
        return str;
×
628
}
×
629

630
QString StarWrapper3::getInfoString(const StelCore *core, const InfoStringGroup& flags) const
×
631
{
632
        QString str;
×
633
        QTextStream oss(&str);
×
634

635
        if (s->getGaia()) {
×
636
                if ((flags&Name) || (flags&CatalogNumber))
×
637
                        oss << "<h2>";
×
638
                QString gaia_id;
×
639
                gaia_id = QString("Gaia DR3 %1").arg(s->getGaia());
×
640
                oss << gaia_id;
×
641
                if ((flags&Name) || (flags&CatalogNumber))
×
642
                        oss << "</h2>";
×
643
        }
×
644

645
        if (flags&ObjectType)
×
646
                oss << QString("%1: <b>%2</b>").arg(q_("Type"), getObjectTypeI18n()) << "<br />";
×
647

648
        oss << getMagnitudeInfoString(core, flags, 2);
×
649

650
        if (flags&Extra)
×
651
                oss << QString("%1: <b>%2</b>").arg(q_("Color Index (B-V)"), QString::number(getBV(), 'f', 2)) << "<br />";
×
652
        
653
        oss << getCommonInfoString(core, flags);
×
654
        oss << getSolarLunarInfoString(core, flags);
×
655

656
        StelObject::postProcessInfoString(str, flags);
×
657

658
        return str;
×
659
}
×
660

661

662
StelObjectP Star1::createStelObject(const SpecialZoneArray<Star1> *a, const SpecialZoneData<Star1> *z) const
×
663
{
664
        return StelObjectP(new StarWrapper1(a,z,this), true);
×
665
}
666

667
StelObjectP Star2::createStelObject(const SpecialZoneArray<Star2> *a, const SpecialZoneData<Star2> *z) const
×
668
{
669
        return StelObjectP(new StarWrapper2(a,z,this), true);
×
670
}
671

672
StelObjectP Star3::createStelObject(const SpecialZoneArray<Star3> *a, const SpecialZoneData<Star3> *z) const
×
673
{
674
        return StelObjectP(new StarWrapper3(a,z,this), true);
×
675
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc