• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • skyobjects
skyobject.h
Go to the documentation of this file.
1 /***************************************************************************
2  skyobject.h - K Desktop Planetarium
3  -------------------
4  begin : Sun Feb 11 2001
5  copyright : (C) 2001 by Jason Harris
6  email : jharris@30doradus.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SKYOBJECT_H_
19 #define SKYOBJECT_H_
20 
21 #include <QString>
22 #include <QStringList>
23 #include <QSharedDataPointer>
24 
25 #include <klocale.h>
26 
27 #include "skypoint.h"
28 #include "kstars/dms.h"
29 #include "auxinfo.h"
30 
31 class QPoint;
32 class QPainter;
33 class GeoLocation;
34 class KStarsDateTime;
35 class KSPopupMenu;
36 
46 class SkyObject : public SkyPoint {
47 public:
53  typedef qint64 UID;
54 
56  static const UID UID_STAR;
57  static const UID UID_GALAXY;
58  static const UID UID_DEEPSKY;
59  static const UID UID_SOLARSYS;
60 
62  static const UID invalidUID;
63 
74  explicit SkyObject( int t=TYPE_UNKNOWN, dms r=dms(0.0), dms d=dms(0.0),
75  float m=0.0, const QString &n=QString(), const QString &n2=QString(), const QString &lname=QString() );
87  SkyObject( int t, double r, double d, float m=0.0,
88  const QString &n=QString(), const QString &n2=QString(), const QString &lname=QString() );
89 
91  virtual ~SkyObject();
92 
102  virtual SkyObject* clone() const;
103 
108  enum TYPE { STAR=0, CATALOG_STAR=1, PLANET=2, OPEN_CLUSTER=3, GLOBULAR_CLUSTER=4,
109  GASEOUS_NEBULA=5, PLANETARY_NEBULA=6, SUPERNOVA_REMNANT=7, GALAXY=8,
110  COMET=9, ASTEROID=10, CONSTELLATION=11, MOON=12, ASTERISM=13,
111  GALAXY_CLUSTER=14, DARK_NEBULA=15, QUASAR=16, MULT_STAR=17, RADIO_SOURCE=18,
112  SATELLITE=19, SUPERNOVA=20, TYPE_UNKNOWN };
113 
119  static QString typeName( const int t );
120 
124  inline virtual QString name( void ) const { return hasName() ? Name : unnamedString;}
125 
129  inline QString translatedName() const { return i18n( name().toUtf8() );}
130 
132  inline QString name2( void ) const { return ( hasName2() ? Name2 : emptyString ); }
133 
135  inline QString translatedName2() const { return ( hasName2() ? i18n( Name2.toUtf8() ): emptyString );}
136 
140  virtual QString longname( void ) const { return hasLongName() ? LongName : unnamedObjectString; }
141 
145  QString translatedLongName() const { return i18n( longname().toUtf8() );}
146 
151  void setLongName( const QString &longname=QString() );
152 
158  virtual QString labelString() const;
159 
164  inline int type( void ) const { return (int)Type; }
165 
171  inline void setType( int t ) { Type = (unsigned char)t; }
172 
177  QString typeName() const;
178 
182  inline float mag( void ) const { return sortMagnitude; }
183 
188  inline float mag( const QString &band ) const { return m_Magnitudes.value( band, NaN::f ); }
189 
194  inline virtual double pa() const { return 0.0; }
195 
197  inline bool isSolarSystem() const { return ( type() == 2 || type() == 9 || type() == 10 || type() == 12 ); }
198 
200  void showPopupMenu( KSPopupMenu *pmenu, const QPoint &pos );
201 
215  QTime riseSetTime( const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true );
216 
225  QTime riseSetTimeUT( const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true );
226 
235  dms riseSetTimeAz( const KStarsDateTime &dt, const GeoLocation *geo, bool rst);
236 
243  QTime transitTime( const KStarsDateTime &dt, const GeoLocation *geo );
244 
250  QTime transitTimeUT( const KStarsDateTime &dt, const GeoLocation *geo );
251 
257  dms transitAltitude( const KStarsDateTime &dt, const GeoLocation *geo );
258 
266  SkyPoint recomputeCoords( const KStarsDateTime &dt, const GeoLocation *geo=0 );
267 
268  inline bool hasName() const { return ! Name.isEmpty(); }
269 
270  inline bool hasName2() const { return ! Name2.isEmpty(); }
271 
272  inline bool hasLongName() const { return ! LongName.isEmpty(); }
273 
277  QString messageFromTitle( const QString &imageTitle );
278 
282  void saveUserLog( const QString &newLog );
283 
288  virtual double labelOffset() const;
289 
294  inline bool hasAuxInfo() { return ! (!info); }
295 
299  inline QStringList &ImageList() { return getAuxInfo()->ImageList; }
300 
304  inline QStringList &ImageTitle() { return getAuxInfo()->ImageTitle; }
305 
309  inline QStringList &InfoList() { return getAuxInfo()->InfoList; }
310 
314  inline QStringList &InfoTitle() { return getAuxInfo()->InfoTitle; }
315 
319  inline QString &userLog() { return getAuxInfo()->userLog; }
320 
321  inline QString &notes() { return getAuxInfo()->notes; }
322 
323  void setNotes( QString _notes) { getAuxInfo()->notes = _notes; }
324 
330  virtual UID getUID() const;
331 
332 private:
337  virtual void initPopupMenu(KSPopupMenu* pmenu);
338 
352  QTime auxRiseSetTimeUT( const KStarsDateTime &dt, const GeoLocation *geo,
353  const dms *righta, const dms *decl, bool riseT);
354 
366  dms auxRiseSetTimeLST( const dms *gLt, const dms *rga, const dms *decl, bool rst );
367 
377  double approxHourAngle( const dms *h, const dms *gLat, const dms *d );
378 
393  dms elevationCorrection(void);
394 
400  AuxInfo *getAuxInfo();
401 
402  unsigned char Type;
403  float sortMagnitude; // This magnitude is used for sorting / making decisions about the visibility of an object. Should not be NaN.
404  QHash<QString, float> m_Magnitudes; // Magnitudes vs. band
405 
406 protected:
409  inline void setMag( float m ) { sortMagnitude = m < 36.0 ? m : NaN::f; } // Updating faintest sane magnitude to 36.0 (faintest visual magnitude visible with E-ELT, acc. to Wikipedia on Apparent Magnitude.)
410 
415  void setMag( const QString &band, const double mag );
416 
419  inline void setName( const QString &name ) { Name = name; }
420 
423  inline void setName2( const QString &name2=QString() ) { Name2 = name2; }
424 
425  QString Name, Name2, LongName;
426 
427  // Pointer to an auxiliary info structure that stores Image URLs, Info URLs etc.
428  QSharedDataPointer<AuxInfo> info;
429 
430  // store often used name strings in static variables
431  static QString emptyString;
432  static QString unnamedString;
433  static QString unnamedObjectString;
434  static QString starString;
435 };
436 
437 #endif
SkyObject::riseSetTimeAz
dms riseSetTimeAz(const KStarsDateTime &dt, const GeoLocation *geo, bool rst)
Definition: skyobject.cpp:192
SkyObject::transitAltitude
dms transitAltitude(const KStarsDateTime &dt, const GeoLocation *geo)
Definition: skyobject.cpp:245
SkyObject::UID_GALAXY
static const UID UID_GALAXY
Definition: skyobject.h:57
KSPopupMenu
The KStars Popup Menu.
Definition: kspopupmenu.h:43
AuxInfo::InfoList
QStringList InfoList
Definition: auxinfo.h:39
SkyObject::LongName
QString LongName
Definition: skyobject.h:425
SkyObject::DARK_NEBULA
Definition: skyobject.h:111
SkyObject::translatedName
QString translatedName() const
Definition: skyobject.h:129
SkyObject::emptyString
static QString emptyString
Definition: skyobject.h:431
SkyObject::TYPE_UNKNOWN
Definition: skyobject.h:112
SkyObject::PLANET
Definition: skyobject.h:108
SkyObject::longname
virtual QString longname(void) const
Definition: skyobject.h:140
SkyObject::invalidUID
static const UID invalidUID
Invalid UID.
Definition: skyobject.h:62
SkyObject::setLongName
void setLongName(const QString &longname=QString())
Set the object's long name.
Definition: skyobject.cpp:92
SkyObject::riseSetTime
QTime riseSetTime(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true)
Determine the time at which the point will rise or set.
Definition: skyobject.cpp:105
SkyObject::~SkyObject
virtual ~SkyObject()
Destructor (empty)
Definition: skyobject.cpp:81
SkyObject::mag
float mag(const QString &band) const
Definition: skyobject.h:188
SkyObject::saveUserLog
void saveUserLog(const QString &newLog)
Save new user log text.
Definition: skyobject.cpp:412
SkyObject::SUPERNOVA_REMNANT
Definition: skyobject.h:109
SkyObject::pa
virtual double pa() const
Definition: skyobject.h:194
SkyObject::GALAXY
Definition: skyobject.h:109
SkyObject::UID_STAR
static const UID UID_STAR
Kind of UID.
Definition: skyobject.h:56
SkyObject::transitTime
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo)
The same iteration technique described in riseSetTime() is used here.
Definition: skyobject.cpp:241
SkyObject::ASTERISM
Definition: skyobject.h:110
SkyObject::COMET
Definition: skyobject.h:110
SkyObject::InfoList
QStringList & InfoList()
Definition: skyobject.h:309
SkyObject::UID_DEEPSKY
static const UID UID_DEEPSKY
Definition: skyobject.h:58
SkyObject::SkyObject
SkyObject(int t=TYPE_UNKNOWN, dms r=dms(0.0), dms d=dms(0.0), float m=0.0, const QString &n=QString(), const QString &n2=QString(), const QString &lname=QString())
Constructor.
Definition: skyobject.cpp:50
AuxInfo
Stores Users' Logs and QStringLists of URLs for images and webpages regarding an object in the sky...
Definition: auxinfo.h:34
dms.h
SkyObject::RADIO_SOURCE
Definition: skyobject.h:111
NaN::f
const float f
Definition: nan.h:36
SkyObject::unnamedString
static QString unnamedString
Definition: skyobject.h:432
SkyObject::labelString
virtual QString labelString() const
Definition: skyobject.cpp:470
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
SkyObject::unnamedObjectString
static QString unnamedObjectString
Definition: skyobject.h:433
SkyObject::GALAXY_CLUSTER
Definition: skyobject.h:111
AuxInfo::InfoTitle
QStringList InfoTitle
Definition: auxinfo.h:40
GeoLocation
Contains all relevant information for specifying a location on Earth: City Name, State/Province name...
Definition: geolocation.h:39
SkyObject::starString
static QString starString
Definition: skyobject.h:434
SkyObject::ImageList
QStringList & ImageList()
Definition: skyobject.h:299
SkyObject::getUID
virtual UID getUID() const
Return UID for object.
Definition: skyobject.cpp:484
SkyObject::messageFromTitle
QString messageFromTitle(const QString &imageTitle)
Given the Image title from a URL file, try to convert it to an image credit string.
Definition: skyobject.cpp:374
SkyObject::UID
qint64 UID
Type for Unique object IDenticator.
Definition: skyobject.h:53
SkyObject::showPopupMenu
void showPopupMenu(KSPopupMenu *pmenu, const QPoint &pos)
Show Type-specific popup menu.
Definition: skyobject.cpp:83
KStarsDateTime
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:45
AuxInfo::ImageList
QStringList ImageList
Definition: auxinfo.h:37
SkyObject::hasLongName
bool hasLongName() const
Definition: skyobject.h:272
SkyObject::SATELLITE
Definition: skyobject.h:112
SkyObject::MOON
Definition: skyobject.h:110
SkyObject::isSolarSystem
bool isSolarSystem() const
Definition: skyobject.h:197
SkyObject::transitTimeUT
QTime transitTimeUT(const KStarsDateTime &dt, const GeoLocation *geo)
Definition: skyobject.cpp:221
SkyObject::translatedLongName
QString translatedLongName() const
Definition: skyobject.h:145
SkyObject::setName2
void setName2(const QString &name2=QString())
Set the object's secondary name.
Definition: skyobject.h:423
SkyObject::labelOffset
virtual double labelOffset() const
Definition: skyobject.cpp:474
SkyObject::hasAuxInfo
bool hasAuxInfo()
Query whether this SkyObject has a valid AuxInfo structure associated with it.
Definition: skyobject.h:294
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
SkyObject::setType
void setType(int t)
Set the object's type identifier to the argument.
Definition: skyobject.h:171
SkyObject::typeName
QString typeName() const
Definition: skyobject.cpp:370
AuxInfo::ImageTitle
QStringList ImageTitle
Definition: auxinfo.h:38
skypoint.h
SkyObject::info
QSharedDataPointer< AuxInfo > info
Definition: skyobject.h:428
AuxInfo::notes
QString notes
Definition: auxinfo.h:42
SkyObject::name2
QString name2(void) const
Definition: skyobject.h:132
SkyObject::setMag
void setMag(float m)
Set the object's sorting magnitude.
Definition: skyobject.h:409
SkyObject::mag
float mag(void) const
Definition: skyobject.h:182
SkyObject::InfoTitle
QStringList & InfoTitle()
Definition: skyobject.h:314
SkyObject::hasName
bool hasName() const
Definition: skyobject.h:268
SkyObject::clone
virtual SkyObject * clone() const
Create copy of object.
Definition: skyobject.cpp:76
SkyObject::recomputeCoords
SkyPoint recomputeCoords(const KStarsDateTime &dt, const GeoLocation *geo=0)
The coordinates for the object on date dt are computed and returned, but the object's internal coordi...
Definition: skyobject.cpp:296
SkyObject::setNotes
void setNotes(QString _notes)
Definition: skyobject.h:323
SkyObject::type
int type(void) const
Definition: skyobject.h:164
NaN::d
const double d
Definition: nan.h:35
SkyObject::CONSTELLATION
Definition: skyobject.h:110
SkyObject::notes
QString & notes()
Definition: skyobject.h:321
SkyObject::PLANETARY_NEBULA
Definition: skyobject.h:109
SkyObject::hasName2
bool hasName2() const
Definition: skyobject.h:270
SkyObject::Name
QString Name
Definition: skyobject.h:425
SkyObject::MULT_STAR
Definition: skyobject.h:111
SkyObject::translatedName2
QString translatedName2() const
Definition: skyobject.h:135
SkyObject::ASTEROID
Definition: skyobject.h:110
SkyObject::SUPERNOVA
Definition: skyobject.h:112
SkyObject::GASEOUS_NEBULA
Definition: skyobject.h:109
SkyObject::setName
void setName(const QString &name)
Set the object's primary name.
Definition: skyobject.h:419
SkyObject::riseSetTimeUT
QTime riseSetTimeUT(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true)
Definition: skyobject.cpp:135
SkyObject::name
virtual QString name(void) const
Definition: skyobject.h:124
SkyObject::GLOBULAR_CLUSTER
Definition: skyobject.h:108
SkyObject::QUASAR
Definition: skyobject.h:111
SkyObject::TYPE
TYPE
The type classification of the SkyObject.
Definition: skyobject.h:108
SkyObject::STAR
Definition: skyobject.h:108
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:46
SkyObject::CATALOG_STAR
Definition: skyobject.h:108
SkyObject::OPEN_CLUSTER
Definition: skyobject.h:108
AuxInfo::userLog
QString userLog
Definition: auxinfo.h:41
SkyObject::Name2
QString Name2
Definition: skyobject.h:425
SkyObject::ImageTitle
QStringList & ImageTitle()
Definition: skyobject.h:304
SkyObject::UID_SOLARSYS
static const UID UID_SOLARSYS
Definition: skyobject.h:59
auxinfo.h
SkyObject::userLog
QString & userLog()
Definition: skyobject.h:319
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal