Stellarium 0.13.1
StelLocation.hpp
1 /*
2  * Copyright (C) 2008 Fabien Chereau
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef _STELLOCATION_HPP_
20 #define _STELLOCATION_HPP_
21 
22 #include "config.h"
23 
24 #include <QString>
25 
29 {
30 public:
31  StelLocation() : longitude(0.f), latitude(0.f), altitude(0), bortleScaleIndex(2.f), population(0.f), role('X'), isUserLocation(true) {;}
32 
34  QString getID() const;
35 
36  bool isValid() const {return role!='!';}
37 
39  QString serializeToLine() const;
40 
42  QString name;
44  QString country;
46  QString state;
48  QString planetName;
50  float longitude;
52  float latitude;
54  int altitude;
58  QString landscapeKey;
72  QChar role;
73 
75  static StelLocation createFromLine(const QString& line);
76 
78  static float distanceDegrees(const float long1, const float lat1, const float long2, const float lat2);
79 
82 
83  static const int DEFAULT_BORTLE_SCALE_INDEX;
84 };
85 
87 QDataStream& operator<<(QDataStream& out, const StelLocation& loc);
89 QDataStream& operator>>(QDataStream& in, StelLocation& loc);
90 
91 #endif // _STELLOCATION_HPP_
Store the informations for a location on a planet.
QString landscapeKey
A hint for associating a landscape to the location.
bool isUserLocation
Used privately by the StelLocationMgr.
float longitude
Longitude in degree.
QString country
English country name or empty string.
QString state
State/region name (useful if 2 locations of the same country have the same name)
QString planetName
English planet name.
int altitude
Altitude in meter.
QDataStream & operator<<(QDataStream &out, const SphericalRegionP &region)
Serialize the passed SphericalRegionP into a binary blob.
QString serializeToLine() const
Output the location as a string ready to be stored in the user_location file.
QChar role
Location role code.
static StelLocation createFromLine(const QString &line)
Parse a location from a line serialization.
static float distanceDegrees(const float long1, const float lat1, const float long2, const float lat2)
Compute great-circle distance between two locations.
float bortleScaleIndex
Light pollution index following Bortle scale.
QString getID() const
Return a short string which can be used in a list view.
int population
Population in number of inhabitants.
QDataStream & operator>>(QDataStream &in, SphericalRegionP &region)
Load the SphericalRegionP from a binary blob.
float latitude
Latitude in degree.
QString name
Location/city name.