StelLocation.cpp   StelLocation.cpp 
skipping to change at line 41 skipping to change at line 41
.arg(population/1000) .arg(population/1000)
.arg(latitude<0 ? QString("%1S").arg(-latitude, 0, ' f', 3) : QString("%1N").arg(latitude, 0, 'f', 3)) .arg(latitude<0 ? QString("%1S").arg(-latitude, 0, ' f', 3) : QString("%1N").arg(latitude, 0, 'f', 3))
.arg(longitude<0 ? QString("%1W").arg(-longitude, 0, 'f', 3) : QString("%1E").arg(longitude, 0, 'f', 3)) .arg(longitude<0 ? QString("%1W").arg(-longitude, 0, 'f', 3) : QString("%1E").arg(longitude, 0, 'f', 3))
.arg(altitude) .arg(altitude)
.arg(bortleScaleIndex) .arg(bortleScaleIndex)
.arg("") // Reserve for time zone .arg("") // Reserve for time zone
.arg(planetName) .arg(planetName)
.arg(landscapeKey); .arg(landscapeKey);
} }
QDataStream& operator<<(QDataStream& out, const StelLocation& loc)
{
out << loc.name << loc.state << loc.country << loc.role << loc.popul
ation << loc.latitude << loc.longitude << loc.altitude << loc.bortleScaleIn
dex << loc.planetName << loc.landscapeKey << loc.isUserLocation;
return out;
}
QDataStream& operator>>(QDataStream& in, StelLocation& loc)
{
in >> loc.name >> loc.state >> loc.country >> loc.role >> loc.popula
tion >> loc.latitude >> loc.longitude >> loc.altitude >> loc.bortleScaleInd
ex >> loc.planetName >> loc.landscapeKey >> loc.isUserLocation;
return in;
}
// Parse a location from a line serialization // Parse a location from a line serialization
StelLocation StelLocation::createFromLine(const QString& rawline) StelLocation StelLocation::createFromLine(const QString& rawline)
{ {
StelLocation loc; StelLocation loc;
const QStringList& splitline = rawline.split("\t"); const QStringList& splitline = rawline.split("\t");
loc.name = splitline[0]; loc.name = splitline.at(0);
loc.state = splitline[1]; loc.state = splitline.at(1);
loc.country = StelLocaleMgr::countryCodeToString(splitline[2]); loc.country = StelLocaleMgr::countryCodeToString(splitline.at(2));
if (loc.country.isEmpty()) if (loc.country.isEmpty())
loc.country = splitline[2]; loc.country = splitline.at(2);
loc.role = splitline[3].at(0); loc.role = splitline.at(3).at(0);
loc.population = (int) ( 1000 * splitline[4].toFloat() ); loc.population = (int) (splitline.at(4).toFloat()*1000);
const QString& latstring = splitline[5]; const QString& latstring = splitline.at(5);
loc.latitude = latstring.left(latstring.size() - 1).toDouble(); loc.latitude = latstring.left(latstring.size() - 1).toFloat();
if (latstring.contains("S")) if (latstring.endsWith('S'))
loc.latitude=-loc.latitude; loc.latitude=-loc.latitude;
const QString& lngstring = splitline[6]; const QString& lngstring = splitline.at(6);
loc.longitude = lngstring.left(lngstring.size() - 1).toDouble(); loc.longitude = lngstring.left(lngstring.size() - 1).toFloat();
if (lngstring.contains("W")) if (lngstring.endsWith('W'))
loc.longitude=-loc.longitude; loc.longitude=-loc.longitude;
loc.altitude = (int)(splitline[7]).toFloat(); loc.altitude = (int)splitline.at(7).toFloat();
if (splitline.size()>8) if (splitline.size()>8)
{ {
bool ok; bool ok;
loc.bortleScaleIndex = (splitline[8]).toInt(&ok); loc.bortleScaleIndex = splitline.at(8).toInt(&ok);
if (ok==false) if (ok==false)
loc.bortleScaleIndex = 2; loc.bortleScaleIndex = 2.f;
} }
else else
loc.bortleScaleIndex = 2; loc.bortleScaleIndex = 2.f;
// Reserve for TimeZone // Reserve for TimeZone
// if (splitline.size()>9) {} // if (splitline.size()>9) {}
if (splitline.size()>10) if (splitline.size()>10)
{ {
// Parse planet name // Parse planet name
loc.planetName = splitline[10]; loc.planetName = splitline.at(10);
} }
else else
{ {
// Earth by default // Earth by default
loc.planetName = "Earth"; loc.planetName = "Earth";
} }
if (splitline.size()>11) if (splitline.size()>11)
{ {
// Parse optional associated landscape key // Parse optional associated landscape key
loc.landscapeKey = splitline[11]; loc.landscapeKey = splitline.at(11);
} }
return loc; return loc;
} }
 End of changes. 12 change blocks. 
18 lines changed or deleted 34 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/