• 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
kstarsdata.h
Go to the documentation of this file.
1 /***************************************************************************
2  kstarsdata.h - K Desktop Planetarium
3  -------------------
4  begin : Sun Jul 29 2001
5  copyright : (C) 2001 by Heiko Evermann
6  email : heiko@evermann.de
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 KSTARSDATA_H_
19 #define KSTARSDATA_H_
20 
21 #include <iostream>
22 
23 #include "ksnumbers.h"
24 #include "ksuserdb.h"
25 #include "datahandlers/catalogdb.h"
26 
27 #include <QList>
28 #include <QMap>
29 #include <QKeySequence>
30 
31 #include "geolocation.h"
32 #include "colorscheme.h"
33 #include "kstarsdatetime.h"
34 #include "simclock.h"
35 #include "oal/oal.h"
36 #include "oal/log.h"
37 
38 #define MINZOOM 250.
39 #define MAXZOOM 5000000.
40 #define DEFAULTZOOM 2000.
41 #define DZOOM 1.189207115 // 2^(1/4)
42 #define AU_KM 1.49605e8 //km in one AU
43 
44 
45 class QFile;
46 
47 class dms;
48 class SkyMap;
49 class SkyMapComposite;
50 class SkyObject;
51 class FOV;
52 
53 class TimeZoneRule;
54 struct ADVTreeData;
55 
56 
66 class KStarsData : public QObject
67 {
68  Q_OBJECT
69 
70 protected:
72  KStarsData();
73 
74 public:
75  //Friend classes can see the private data.
76  //FIXME: can we avoid having so many friend classes?
77  //
78  //FIXME: Yes we can. Moreover we should
79 
80  // FIXME: It uses temporary trail. There must be way to
81  // this better. And resumeKey in DBUS code
82  friend class KStars;
83  // FIXME: it uses temporary trail and resumeKey
84  friend class SkyMap;
85  // FIXME: uses ADVTreeData and only user
86  friend class DetailDialog;
87  // FIXME: uses geoList and changes it.
88  friend class LocationDialog;
89 
90  static KStarsData* Create( );
91 
92  static inline KStarsData* Instance() { return pinstance; }
93 
97  bool initialize();
98 
100  virtual ~KStarsData();
101 
106  void setNextDSTChange( const KStarsDateTime &dt ) { NextDSTChange = dt; }
107 
111  bool isTimeRunningForward() { return TimeRunsForward; }
112 
114  KLocale *getLocale() { return locale; }
115 
120  SkyObject* objectNamed( const QString &name );
121 
128  void setFullTimeUpdate();
129 
134  void changeDateTime( const KStarsDateTime &newDate );
135 
137  const KStarsDateTime& lt() const { return LTime; }
138 
140  const KStarsDateTime& ut() const { return Clock.utc(); }
141 
143  void syncLST();
144 
146  SkyMapComposite* skyComposite() { return m_SkyComposite; }
147 
149  ColorScheme *colorScheme() { return &CScheme; }
150 
152  KSUserDB *userdb() { return &m_ksuserdb; }
153 
155  CatalogDB *catalogdb() { return &m_catalogdb; }
156 
158  SimClock *clock() { return &Clock; }
159 
161  dms *lst() { return &LST; }
162 
164  GeoLocation *geo() { return &m_Geo; }
165 
167  QList<GeoLocation*> getGeoList() { return geoList; }
168 
169  GeoLocation *locationNamed( const QString &city, const QString &province=QString(), const QString &country= QString() );
170 
174  void setLocation( const GeoLocation &l );
175 
177  void setLocationFromOptions();
178 
180  const QMap<QString, TimeZoneRule>& getRulebook() { return Rulebook; }
181 
183  bool snapNextFocus() const { return snapToFocus; }
184 
194  void setSnapNextFocus(bool b=true) { snapToFocus = b; }
195 
203  bool executeScript( const QString &name, SkyMap *map );
204 
206  void syncFOV();
207 
211  inline const QList<FOV*> getVisibleFOVs() const { return visibleFOVs; }
212 
216  inline const QList<FOV*> getAvailableFOVs() const { return availFOVs; }
217 
219  OAL::Log *logObject() { return m_logObject; }
220 
221  /*@short Increments the updateID, forcing a recomputation of star positions as well */
222  unsigned int incUpdateID();
223 
224  unsigned int updateID() { return m_updateID; }
225  unsigned int updateNumID() { return m_updateNumID; }
226  KSNumbers* updateNum() { return &m_updateNum; }
227  void syncUpdateIDs();
228 
229 signals:
231  void progressText( const QString& );
232 
234  void update();
235 
237  void clearCache();
238 
240  void geoChanged();
241 
242 public slots:
244  void slotConsoleMessage( QString s ) { std::cout << (const char*)(s.toLocal8Bit()) << std::endl; }
245 
254  void updateTime(GeoLocation *geo, SkyMap * skymap, const bool automaticDSTchange = true);
255 
260  void setTimeDirection( float scale );
261 
262 private:
270  bool readCityData();
271 
273  bool readTimeZoneRulebook();
274 
295  bool processCity( const QString& line );
296 
297  //TODO JM: ADV tree should use XML instead
306  bool readADVTreeData();
307 
309  bool readINDIHosts();
310 
311  //TODO JM: Use XML instead; The logger should have more features
312  // that allow users to enter details about their observation logs
313  // objects observed, eye pieces, telescope, conditions, mag..etc
322  bool readUserLog();
323 
338  bool readURLData( const QString &url, int type=0, bool deepOnly=false );
339 
345  bool openUrlFile(const QString &urlfile, QFile& file);
346 
350  void resetToNewDST(GeoLocation *geo, const bool automaticDSTchange);
351 
352  QList<ADVTreeData*> ADVtreeList;
353  SkyMapComposite* m_SkyComposite;
354 
355  GeoLocation m_Geo;
356  SimClock Clock;
357  KStarsDateTime LTime;
358  KSUserDB m_ksuserdb;
359  CatalogDB m_catalogdb;
360  ColorScheme CScheme;
361  OAL::Log *m_logObject;
362 
363  bool TimeRunsForward, temporaryTrail;
364  // FIXME: Used in SkyMap only. Check!
365  bool snapToFocus;
366 
367  KLocale *locale;
368 
369  dms LST;
370 
371  QKeySequence resumeKey;
372 
373  QList<FOV*> availFOVs; // List of all available FOVs
374  QList<FOV*> visibleFOVs; // List of visible FOVs. Cached from Options::FOVNames
375 
376  KStarsDateTime LastNumUpdate, LastSkyUpdate, LastPlanetUpdate, LastMoonUpdate;
377  KStarsDateTime NextDSTChange;
378  // FIXME: Used in kstarsdcop.cpp only
379  KStarsDateTime StoredDate;
380 
381  QList<GeoLocation*> geoList;
382  QMap<QString, TimeZoneRule> Rulebook;
383 
384  quint32 m_preUpdateID, m_updateID;
385  quint32 m_preUpdateNumID, m_updateNumID;
386  KSNumbers m_preUpdateNum, m_updateNum;
387 
388  static KStarsData* pinstance;
389 };
390 
391 
392 #endif // KSTARSDATA_H_
KStarsData::KStarsData
KStarsData()
Constructor.
Definition: kstarsdata.cpp:109
KStarsData::getAvailableFOVs
const QList< FOV * > getAvailableFOVs() const
Definition: kstarsdata.h:216
LocationDialog
Dialog for changing the geographic location of the observer.
Definition: locationdialog.h:57
DetailDialog
window showing detailed information for a selected object.
Definition: detaildialog.h:88
KStarsData::objectNamed
SkyObject * objectNamed(const QString &name)
Find object by name.
Definition: kstarsdata.cpp:345
SimClock
kstars simulation clock
Definition: simclock.h:34
KStarsData::locationNamed
GeoLocation * locationNamed(const QString &city, const QString &province=QString(), const QString &country=QString())
Definition: kstarsdata.cpp:306
KStarsData::clock
SimClock * clock()
Definition: kstarsdata.h:158
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
FOV
class encapulating a Field-of-View symbol
Definition: fov.h:32
KStarsData::updateID
unsigned int updateID()
Definition: kstarsdata.h:224
KStarsData::colorScheme
ColorScheme * colorScheme()
Definition: kstarsdata.h:149
KStarsData::logObject
OAL::Log * logObject()
Return log object.
Definition: kstarsdata.h:219
KStarsData::progressText
void progressText(const QString &)
Signal that specifies the text that should be drawn in the KStarsSplash window.
KStarsData::setLocationFromOptions
void setLocationFromOptions()
Set the GeoLocation according to the values stored in the configuration file.
Definition: kstarsdata.cpp:317
KStarsData::lst
dms * lst()
Definition: kstarsdata.h:161
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:92
KStarsData::update
void update()
Should be used to refresh skymap.
KStarsData::initialize
bool initialize()
Initialize KStarsData while running splash screen.
Definition: kstarsdata.cpp:138
KStarsData::~KStarsData
virtual ~KStarsData()
Destructor.
Definition: kstarsdata.cpp:126
KStarsData::clearCache
void clearCache()
If data changed, emit clearCache signal.
KStarsData::executeScript
bool executeScript(const QString &name, SkyMap *map)
Execute a script.
Definition: kstarsdata.cpp:746
KStarsData::catalogdb
CatalogDB * catalogdb()
Definition: kstarsdata.h:155
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
KStarsData::snapNextFocus
bool snapNextFocus() const
Definition: kstarsdata.h:183
KStarsData::setFullTimeUpdate
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets...
Definition: kstarsdata.cpp:260
QObject
KStarsData::updateNumID
unsigned int updateNumID()
Definition: kstarsdata.h:225
KStarsData::setTimeDirection
void setTimeDirection(float scale)
Sets the direction of time and stores it in bool TimeRunForwards.
Definition: kstarsdata.cpp:302
KStars
This is the main window for KStars.
Definition: kstars.h:94
TimeZoneRule
This class provides the information needed to determine whether Daylight Savings Time (DST; a...
Definition: timezonerule.h:56
geolocation.h
KStarsData::updateNum
KSNumbers * updateNum()
Definition: kstarsdata.h:226
oal.h
KStarsData::Create
static KStarsData * Create()
Definition: kstarsdata.cpp:93
KStarsData::getRulebook
const QMap< QString, TimeZoneRule > & getRulebook()
Return map for daylight saving rules.
Definition: kstarsdata.h:180
KStarsData::lt
const KStarsDateTime & lt() const
Definition: kstarsdata.h:137
KStarsData::changeDateTime
void changeDateTime(const KStarsDateTime &newDate)
change the current simulation date/time to the KStarsDateTime argument.
Definition: kstarsdata.cpp:272
GeoLocation
Contains all relevant information for specifying a location on Earth: City Name, State/Province name...
Definition: geolocation.h:39
KSUserDB
Single class to delegate all User database I/O.
Definition: ksuserdb.h:46
KStarsData::syncUpdateIDs
void syncUpdateIDs()
Definition: kstarsdata.cpp:245
SimClock::utc
const KStarsDateTime & utc() const
Definition: simclock.h:47
SkyMapComposite
SkyMapComposite is the root object in the object hierarchy of the sky map.
Definition: skymapcomposite.h:65
KStarsDateTime
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:45
KStarsData::getGeoList
QList< GeoLocation * > getGeoList()
Definition: kstarsdata.h:167
ksnumbers.h
KStarsData::skyComposite
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:146
ColorScheme
This class stores all of the adjustable colors in KStars, in a QMap object keyed by the names of the ...
Definition: colorscheme.h:38
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
simclock.h
KStarsData::slotConsoleMessage
void slotConsoleMessage(QString s)
send a message to the console
Definition: kstarsdata.h:244
KStarsData::syncFOV
void syncFOV()
Synchronize list of visible FOVs and list of selected FOVs in Options.
Definition: kstarsdata.cpp:1045
KStarsData::getVisibleFOVs
const QList< FOV * > getVisibleFOVs() const
Definition: kstarsdata.h:211
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:43
CatalogDB
Definition: catalogdb.h:51
ADVTreeData
Definition: detaildialog.h:58
KStarsData::setSnapNextFocus
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition: kstarsdata.h:194
KStarsData::setNextDSTChange
void setNextDSTChange(const KStarsDateTime &dt)
Set the NextDSTChange member.
Definition: kstarsdata.h:106
SkyMap
This is the canvas on which the sky is painted.
Definition: skymap.h:72
KStarsData::getLocale
KLocale * getLocale()
Definition: kstarsdata.h:114
KStarsData::updateTime
void updateTime(GeoLocation *geo, SkyMap *skymap, const bool automaticDSTchange=true)
Update the Simulation Clock.
Definition: kstarsdata.cpp:189
KStarsData::isTimeRunningForward
bool isTimeRunningForward()
Returns true if time is running forward else false.
Definition: kstarsdata.h:111
kstarsdatetime.h
KStarsData::geoChanged
void geoChanged()
Emitted when geo location changed.
KStarsData::ut
const KStarsDateTime & ut() const
Definition: kstarsdata.h:140
OAL::Log
Definition: log.h:41
KStarsData::userdb
KSUserDB * userdb()
Definition: kstarsdata.h:152
log.h
catalogdb.h
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
ksuserdb.h
colorscheme.h
KStarsData::incUpdateID
unsigned int incUpdateID()
Definition: kstarsdata.cpp:253
QList
KStarsData::setLocation
void setLocation(const GeoLocation &l)
Set the GeoLocation according to the argument.
Definition: kstarsdata.cpp:323
KStarsData::syncLST
void syncLST()
Sync the LST with the simulation clock.
Definition: kstarsdata.cpp:268
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 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