Skip to content

Commit e870408

Browse files
committed
Get rid of getSatIdFromLine2
1 parent ce31930 commit e870408

2 files changed

Lines changed: 9 additions & 21 deletions

File tree

plugins/Satellites/src/Satellites.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,12 +2995,20 @@ void Satellites::parseTleFile(QFile& openFile, TleDataHash& tleList, bool addFla
29952995
lastData.second = line;
29962996
// The Satellite Catalogue Number is the second number
29972997
// on the second line.
2998-
QString id = getSatIdFromLine2(line);
2998+
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
2999+
QString id = line.split(' ', Qt::SkipEmptyParts).at(1).trimmed();
3000+
#else
3001+
QString id = line.split(' ', QString::SkipEmptyParts).at(1).trimmed();
3002+
#endif
29993003
if (id.isEmpty())
30003004
{
30013005
qDebug() << "[Satellites] failed to extract SatId from \"" << line << "\"";
30023006
continue;
30033007
}
3008+
// Strip any leading zeros as they should be unique ints as strings.
3009+
static const QRegularExpression re("^[0]*\\B");
3010+
id.remove(re);
3011+
30043012
lastData.id = id;
30053013

30063014
// This is the second line and there will be no more,
@@ -3156,22 +3164,6 @@ void Satellites::parseCsvFile(QFile& openFile, const QStringList& headerEntries,
31563164
}
31573165
}
31583166

3159-
QString Satellites::getSatIdFromLine2(const QString& line)
3160-
{
3161-
#if (QT_VERSION>=QT_VERSION_CHECK(5, 14, 0))
3162-
QString id = line.split(' ', Qt::SkipEmptyParts).at(1).trimmed();
3163-
#else
3164-
QString id = line.split(' ', QString::SkipEmptyParts).at(1).trimmed();
3165-
#endif
3166-
if (!id.isEmpty())
3167-
{
3168-
// Strip any leading zeros as they should be unique ints as strings.
3169-
static const QRegularExpression re("^[0]*\\B");
3170-
id.remove(re);
3171-
}
3172-
return id;
3173-
}
3174-
31753167
void Satellites::loadExtraData()
31763168
{
31773169
// regular expression to find the comments and empty lines

plugins/Satellites/src/Satellites.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,6 @@ class Satellites : public StelObjectModule
392392

393393
static void parseDataFile(QFile& openFile, TleDataHash& tleList, bool addFlagValue = false, const QString& tleURL = "");
394394

395-
//! Insert a three line TLE into the hash array.
396-
//! @param[in] line The second line from the TLE
397-
static QString getSatIdFromLine2(const QString& line);
398-
399395
//! Reads qs.mag and rcs files and its parsing for getting id, standard magnitude and RCS values
400396
//! for satellites.
401397
//! @note We are having permissions for use this file from Mike McCants.

0 commit comments

Comments
 (0)