StelLocation.cpp   StelLocation.cpp 
skipping to change at line 21 skipping to change at line 21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelUtils.hpp"
#include <QStringList> #include <QStringList>
const int StelLocation::DEFAULT_BORTLE_SCALE_INDEX = 2;
// Output the location as a string ready to be stored in the user_location file // Output the location as a string ready to be stored in the user_location file
QString StelLocation::serializeToLine() const QString StelLocation::serializeToLine() const
{ {
return QString("%1\t%2\t%3\t%4\t%5\t%6\t%7\t%8\t%9\t%10\t%11\t%12") return QString("%1\t%2\t%3\t%4\t%5\t%6\t%7\t%8\t%9\t%10\t%11\t%12")
.arg(name) .arg(name)
.arg(state) .arg(state)
.arg(country) .arg(country)
.arg(role) .arg(role)
.arg(population/1000) .arg(population/1000)
.arg(latitude<0 ? QString("%1S").arg(-latitude, 0, ' f', 6) : QString("%1N").arg(latitude, 0, 'f', 6)) .arg(latitude<0 ? QString("%1S").arg(-latitude, 0, ' f', 6) : QString("%1N").arg(latitude, 0, 'f', 6))
.arg(longitude<0 ? QString("%1W").arg(-longitude, 0, 'f', 6) : QString("%1E").arg(longitude, 0, 'f', 6)) .arg(longitude<0 ? QString("%1W").arg(-longitude, 0, 'f', 6) : QString("%1E").arg(longitude, 0, 'f', 6))
.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);
} }
QString StelLocation::getID() const
{
if (name.isEmpty())
{
return QString("%1,%2").arg(latitude).arg(longitude);
}
QString ret = name;
if (!country.isEmpty())
ret += ", " + country;
return ret;
}
QDataStream& operator<<(QDataStream& out, const StelLocation& loc) 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; 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; return out;
} }
QDataStream& operator>>(QDataStream& in, StelLocation& loc) 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; 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; return in;
skipping to change at line 86 skipping to change at line 101
if (lngstring.endsWith('W')) if (lngstring.endsWith('W'))
loc.longitude=-loc.longitude; loc.longitude=-loc.longitude;
loc.altitude = (int)splitline.at(7).toFloat(); loc.altitude = (int)splitline.at(7).toFloat();
if (splitline.size()>8) if (splitline.size()>8)
{ {
bool ok; bool ok;
loc.bortleScaleIndex = splitline.at(8).toInt(&ok); loc.bortleScaleIndex = splitline.at(8).toInt(&ok);
if (ok==false) if (ok==false)
loc.bortleScaleIndex = 2.f; loc.bortleScaleIndex = DEFAULT_BORTLE_SCALE_INDEX;
} }
else else
loc.bortleScaleIndex = 2.f; loc.bortleScaleIndex = DEFAULT_BORTLE_SCALE_INDEX;
// 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.at(10); loc.planetName = splitline.at(10);
} }
else else
 End of changes. 5 change blocks. 
2 lines changed or deleted 17 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/