kstars
geolocation.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOLOCATION_H
00021 #define GEOLOCATION_H
00022
00023 #include <klocale.h>
00024
00025 #include "dms.h"
00026 #include "timezonerule.h"
00027 #include "kstarsdatetime.h"
00028
00039 class GeoLocation {
00040 public:
00044 GeoLocation();
00045
00049 GeoLocation( const GeoLocation &g );
00050
00054 GeoLocation( GeoLocation *g );
00055
00067 GeoLocation( dms lng, dms lat, QString name="Nowhere", QString province="Nowhere", QString country="Nowhere", double TZ=0, TimeZoneRule *TZrule=NULL, int iEllips=4, double hght=-10 );
00068
00080 GeoLocation( double lng, double lat, QString name="Nowhere", QString province="Nowhere", QString country="Nowhere", double TZ=0, TimeZoneRule *TZrule=NULL, int iEllips=4, double hght=-10 );
00081
00093 GeoLocation( double x, double y, double z, QString name="Nowhere", QString province="Nowhere", QString country="Nowhere", double TZ=0, TimeZoneRule *TZrule=NULL, int iEllips=4 );
00094
00095
00098 ~GeoLocation() {}
00099
00102 const dms* lng() const { return &Longitude; }
00105 const dms* lat() const { return &Latitude; }
00108 double height() const { return Height; }
00111 double xPos() const { return PosCartX; }
00114 double yPos() const { return PosCartY; }
00117 double zPos() const { return PosCartZ; }
00120 int ellipsoid() const { return indexEllipsoid; }
00121
00124 QString name() const { return Name; }
00127 QString translatedName() const { return i18n("City name (optional, probably does not need a translation)", Name.utf8().data()); }
00130 QString province() const { return Province; }
00133 QString translatedProvince() const { return i18n("Region/state name (optional, rarely needs a translation)", Province.utf8().data()); }
00136 QString country() const { return Country; }
00139 QString translatedCountry() const { return i18n("Country name (optional, but should be translated)", Country.utf8().data()); }
00140
00143 QString fullName() const;
00144
00147 double TZ0() const { return TimeZone; }
00148
00151 double TZ() const { return TimeZone + TZrule->deltaTZ(); }
00152
00155 TimeZoneRule* tzrule() const { return TZrule; }
00156
00160 void setLong( dms l ) {
00161 Longitude = l;
00162 geodToCart();
00163 }
00168 void setLong( double l ) {
00169 Longitude.setD( l );
00170 geodToCart();
00171 }
00172
00176 void setLat( dms l ) {
00177 Latitude = l;
00178 geodToCart();
00179 }
00180
00185 void setLat( double l ) {
00186 Latitude.setD( l );
00187 geodToCart();
00188 }
00189
00193 void setHeight( double hg ) {
00194 Height = hg;
00195 geodToCart();
00196 }
00197
00201 void setXPos( double x ) {
00202 PosCartX = x;
00203 cartToGeod();
00204 }
00208 void setYPos( double y ) {
00209 PosCartY = y;
00210 cartToGeod();
00211 }
00215 void setZPos( double z ) {
00216 PosCartZ = z;
00217 cartToGeod();
00218 }
00219
00224 void changeEllipsoid( int i );
00225
00229 void setName( const QString &n ) { Name = n; }
00230
00234 void setProvince( const QString &n ) { Province = n; }
00235
00239 void setCountry( const QString &n ) { Country = n; }
00240
00244 void setTZ( double tz ) { TimeZone = tz; }
00245
00249 void setTZrule( TimeZoneRule *tzr ) { TZrule = tzr; }
00250
00255 void reset( GeoLocation *g );
00256
00269 void cartToGeod(void);
00270
00283 void geodToCart (void);
00284
00293 void setEllipsoid( int i );
00294
00295 dms GSTtoLST( const dms &gst ) const { return dms( gst.Degrees() + Longitude.Degrees() ); }
00296 dms LSTtoGST( const dms &lst ) const { return dms( lst.Degrees() - Longitude.Degrees() ); }
00297
00298 KStarsDateTime UTtoLT( const KStarsDateTime &ut ) const { return ut.addSecs( int( 3600.*TZ() ) ); }
00299 KStarsDateTime LTtoUT( const KStarsDateTime < ) const { return lt.addSecs( int( -3600.*TZ() ) ); }
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311 void TopocentricVelocity(double vtopo[], dms gt);
00312
00313 private:
00314 dms Longitude, Latitude;
00315 QString Name, Province, Country;
00316 TimeZoneRule *TZrule;
00317 double TimeZone, Height;
00318 double axis, flattening;
00319 long double PosCartX, PosCartY, PosCartZ;
00320 int indexEllipsoid;
00321 };
00322
00323 #endif