/usr/include/marble/GeoDataCoordinates.h is in libmarble-dev 4:4.8.2-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | //
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2006-2007 Torsten Rahn <tackat@kde.org>
// Copyright 2007-2008 Inge Wallin <ingwa@kde.org>
// Copyright 2008 Patrick Spendrin <ps_ml@gmx.de>
//
#ifndef MARBLE_GEODATACOORDINATES_H
#define MARBLE_GEODATACOORDINATES_H
#include <QtCore/QCoreApplication>
#include <QtCore/QMetaType>
#include <QtCore/QVector>
#include <QtCore/QString>
#include <cmath>
/* M_PI is a #define that may or may not be handled in <cmath> */
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288419717
#endif
#include "geodata_export.h"
#include "global.h"
namespace Marble
{
const qreal TWOPI = 2 * M_PI;
class GeoDataCoordinatesPrivate;
class Quaternion;
/**
* @short A 3d point representation
*
* GeoDataCoordinates is the simple representation of a single three
* dimensional point. It can be used all through out marble as the data type
* for three dimensional objects. it comprises of a Quaternion for speed issues.
* This class was introduced to reflect the difference between a simple 3d point
* and the GeoDataGeometry object containing such a point. The latter is a
* GeoDataPoint and is simply derived from GeoDataCoordinates.
* @see GeoDataPoint
*/
class GEODATA_EXPORT GeoDataCoordinates
{
Q_DECLARE_TR_FUNCTIONS(GeoDataCoordinates)
public:
/**
* @brief enum used constructor to specify the units used
*
* Internally we always use radian for mathematical convenience.
* However the Marble's interfaces to the outside should default
* to degrees.
*/
enum Unit{
Radian,
Degree
};
/**
* @brief enum used to specify the notation / numerical system
*
* For degrees there exist two notations:
* "Decimal" (base-10) and the "Sexagesimal DMS" (base-60) which is
* traditionally used in cartography. Decimal notation
* uses floating point numbers to specify parts of a degree. The
* Sexagesimal DMS notation uses integer based
* Degrees-(Arc)Minutes-(Arc)Seconds to describe parts of a degree.
*/
enum Notation{
Decimal,
DMS
};
// Type definitions
typedef QVector<GeoDataCoordinates> Vector;
typedef QVector<GeoDataCoordinates*> PtrVector;
GeoDataCoordinates( const GeoDataCoordinates& other );
GeoDataCoordinates();
/**
* @brief create a geocoordinate from longitude and latitude
* @param _lon longitude
* @param _lat latitude
* @param alt altitude in meters (default: 0)
* @param _unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
* @param _detail detail (default: 0)
*/
GeoDataCoordinates( qreal lon, qreal lat, qreal alt = 0,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian,
int detail = 0 );
virtual ~GeoDataCoordinates();
/**
* @brief (re)set the coordinates in a GeoDataCoordinates object
* @param _lon longitude
* @param _lat latitude
* @param alt altitude in meters (default: 0)
* @param _unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
*/
void set( qreal lon, qreal lat, qreal alt = 0,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
/**
* @brief use this function to get the longitude and latitude with one
* call - use the unit parameter to switch between Radian and DMS
* @param lon longitude
* @param lat latitude
* @param unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
*/
void geoCoordinates( qreal& lon, qreal& lat,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
const;
/**
* @brief use this function to get the longitude, latitude and altitude
* with one call - use the unit parameter to switch between Radian and DMS
* @param lon longitude
* @param lat latitude
* @param alt altitude in meters
* @param unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
*/
void geoCoordinates( qreal& lon, qreal& lat, qreal& alt,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
const;
/**
* @brief set the longitude in a GeoDataCoordinates object
* @param _lon longitude
* @param _unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
*/
void setLongitude( qreal lon,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
/**
* @brief retrieves the longitude of the GeoDataCoordinates object
* use the unit parameter to switch between Radian and DMS
* @param unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
* @return longitude
*/
qreal longitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
const;
/**
* @brief retrieves the latitude of the GeoDataCoordinates object
* use the unit parameter to switch between Radian and DMS
* @param unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
* @return latitude
*/
qreal latitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
const;
/**
* @brief set the longitude in a GeoDataCoordinates object
* @param _lat longitude
* @param _unit units that lon and lat get measured in
* (default for Radian: north pole at pi/2, southpole at -pi/2)
*/
void setLatitude( qreal lat,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
/**
* @brief return the altitude of the Point in meters
*/
qreal altitude() const;
/**
* @brief set the altitude of the Point in meters
* @param altitude altitude
*/
void setAltitude( const qreal altitude );
/**
* @brief return the detail flag
*/
int detail() const;
/**
* @brief set the detail flag
* @param det detail
*/
void setDetail( const int det );
/**
* @brief return a Quaternion with the used coordinates
*/
const Quaternion &quaternion() const;
/**
* @brief return whether our coordinates represent a pole
* This method can be used to check whether the coordinate equals one of
* the poles.
*/
bool isPole( Pole = AnyPole ) const;
/**
* @brief return Notation of string representation
*/
static GeoDataCoordinates::Notation defaultNotation();
/**
* @brief set the Notation of the string representation
* @param notation Notation
*/
static void setDefaultNotation( GeoDataCoordinates::Notation notation );
/**
* @brief normalize the longitude to always be -M_PI <= lon <= +M_PI (Radian).
* @param lon longitude
*/
static qreal normalizeLon( qreal lon,
GeoDataCoordinates::Unit = GeoDataCoordinates::Radian );
/**
* @brief normalize latitude to always be in -M_PI / 2. <= lat <= +M_PI / 2 (Radian).
* @param lat latitude
*/
static qreal normalizeLat( qreal lat,
GeoDataCoordinates::Unit = GeoDataCoordinates::Radian );
/**
* @brief normalize both longitude and latitude at the same time
* This method normalizes both latitude and longitude, so that the
* latitude and the longitude stay within the "usual" range.
* NOTE: If the latitude exceeds M_PI/2 (+90.0 deg) or -M_PI/2 (-90.0 deg)
* then this will be interpreted as a pole traversion where the point will
* end up on the opposite side of the globe. Therefore the longitude will
* change by M_PI (180 deg).
* If you don't want this behaviour use both normalizeLat() and
* normalizeLon() instead.
* @param lon the longitude value
* @param lat the latitude value
*/
static void normalizeLonLat( qreal &lon, qreal &lat,
GeoDataCoordinates::Unit = GeoDataCoordinates::Radian );
/**
* @brief try to parse the string into a coordinate pair
* @param successful becomes true if the conversion succeeds
* @return the geodatacoordinates
*/
static GeoDataCoordinates fromString( const QString &string, bool& successful );
/**
* @brief return a string representation of the coordinate
* this is a convenience function which uses the default notation
*/
QString toString() const;
/**
* @brief return a string with the notation given by notation
*
* @param notation set a notation different from the default one
* @param precision set the number of digits below degrees.
* The precision depends on the current notation:
* For Decimal representation the precision is the number of
* digits after the decimal point.
* In DMS a precision of 1 or 2 shows the arc minutes; a precision
* of 3 or 4 will show arc seconds. A precision beyond that will
* increase the number of digits after the arc second decimal point.
*/
QString toString( GeoDataCoordinates::Notation notation, int precision = -1 ) const;
static QString lonToString( qreal lon, GeoDataCoordinates::Notation notation,
GeoDataCoordinates::Unit unit = Radian,
int precision = -1,
char format = 'f' );
/**
* @brief return a string representation of longitude of the coordinate
* convenience function that uses the default notation
*/
QString lonToString() const;
static QString latToString( qreal lat, GeoDataCoordinates::Notation notation,
GeoDataCoordinates::Unit unit = Radian,
int precision = -1,
char format = 'f' );
/**
* @brief return a string representation of latitude of the coordinate
* convenience function that uses the default notation
*/
QString latToString() const;
virtual bool operator==( const GeoDataCoordinates& ) const;
virtual bool operator !=( const GeoDataCoordinates& ) const;
GeoDataCoordinates& operator=( const GeoDataCoordinates &other );
/** Serialize the contents of the feature to @p stream. */
virtual void pack( QDataStream& stream ) const;
/** Unserialize the contents of the feature from @p stream. */
virtual void unpack( QDataStream& stream );
virtual void detach();
protected:
GeoDataCoordinatesPrivate* d;
private:
static GeoDataCoordinates::Notation s_notation;
};
}
Q_DECLARE_METATYPE( Marble::GeoDataCoordinates )
#endif
|