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

kstars

  • extragear
  • edu
  • 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 : [email protected]
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 #pragma once
19 
20 #include "catalogdb.h"
21 #include "colorscheme.h"
22 #include "geolocation.h"
23 #include "ksnumbers.h"
24 #include "kstarsdatetime.h"
25 #include "ksuserdb.h"
26 #include "simclock.h"
27 #ifndef KSTARS_LITE
28 #include "oal/oal.h"
29 #include "oal/log.h"
30 #endif
31 
32 #include <QList>
33 #include <QMap>
34 #include <QKeySequence>
35 
36 #include <iostream>
37 #include <memory>
38 
39 #define MINZOOM 250.
40 #define MAXZOOM 5000000.
41 #define DEFAULTZOOM 2000.
42 #define DZOOM 1.189207115 // 2^(1/4)
43 #define AU_KM 1.49605e8 //km in one AU
44 
45 class QFile;
46 
47 class Execute;
48 class FOV;
49 class ImageExporter;
50 class SkyMap;
51 class SkyMapComposite;
52 class SkyObject;
53 class ObservingList;
54 class TimeZoneRule;
55 
56 #ifdef KSTARS_LITE
57 //Will go away when details window will be implemented in KStars Lite
58 struct ADVTreeData
59 {
60  QString Name;
61  QString Link;
62  int Type;
63 };
64 #else
65 struct ADVTreeData;
66 #endif
67 
78 class KStarsData : public QObject
79 {
80  Q_OBJECT
81 
82  protected:
84  KStarsData();
85 
86  public:
87  // FIXME: It uses temporary trail. There must be way to
88  // this better. And resumeKey in DBUS code
89  friend class KStars;
90  // FIXME: it uses temporary trail and resumeKey
91  friend class SkyMap;
92  // FIXME: uses geoList and changes it.
93  friend class LocationDialog;
94  friend class LocationDialogLite;
95 
96  static KStarsData *Create();
97 
98  static inline KStarsData *Instance()
99  {
100  return pinstance;
101  }
102 
107  bool initialize();
108 
110  ~KStarsData() override;
111 
117  void setNextDSTChange(const KStarsDateTime &dt)
118  {
119  NextDSTChange = dt;
120  }
121 
126  bool isTimeRunningForward() const
127  {
128  return TimeRunsForward;
129  }
130 
132  //KLocale *getLocale() { return locale; }
133 
139  SkyObject *objectNamed(const QString &name);
140 
148  void setFullTimeUpdate();
149 
155  void changeDateTime(const KStarsDateTime &newDate);
156 
158  const KStarsDateTime &lt() const
159  {
160  return LTime;
161  }
162 
164  const KStarsDateTime &ut() const
165  {
166  return Clock.utc();
167  }
168 
170  void syncLST();
171 
173  SkyMapComposite *skyComposite()
174  {
175  return m_SkyComposite.get();
176  }
177 
179  ColorScheme *colorScheme()
180  {
181  return &CScheme;
182  }
183 
185  Q_INVOKABLE QString colorSchemeName()
186  {
187  return CScheme.fileName();
188  }
189 
191  KSUserDB *userdb()
192  {
193  return &m_ksuserdb;
194  }
195 
197  CatalogDB *catalogdb()
198  {
199  return &m_catalogdb;
200  }
201 
203  Q_INVOKABLE SimClock *clock()
204  {
205  return &Clock;
206  }
207 
209  CachingDms *lst()
210  {
211  return &LST;
212  }
213 
215  GeoLocation *geo()
216  {
217  return &m_Geo;
218  }
219 
221  QList<GeoLocation *> &getGeoList()
222  {
223  return geoList;
224  }
225 
226  GeoLocation *locationNamed(const QString &city, const QString &province = QString(),
227  const QString &country = QString());
228 
235  GeoLocation *nearestLocation(double longitude, double latitude);
236 
241  void setLocation(const GeoLocation &l);
242 
244  void setLocationFromOptions();
245 
247  const QMap<QString, TimeZoneRule> &getRulebook() const
248  {
249  return Rulebook;
250  }
251 
253  bool snapNextFocus() const
254  {
255  return snapToFocus;
256  }
257 
268  void setSnapNextFocus(bool b = true)
269  {
270  snapToFocus = b;
271  }
272 
281  bool executeScript(const QString &name, SkyMap *map);
282 
284 #ifndef KSTARS_LITE
285  void syncFOV();
286 #endif
287 
291  inline const QList<FOV *> getVisibleFOVs() const
292  {
293  return visibleFOVs;
294  }
295 
299  inline const QList<FOV *> getAvailableFOVs() const
300  {
301  return availFOVs;
302  }
303 #ifndef KSTARS_LITE
304 
305  OAL::Log *logObject()
306  {
307  return m_LogObject.get();
308  }
309 
311  QList<ADVTreeData *> avdTree()
312  {
313  return ADVtreeList;
314  }
315 
316  inline ObservingList *observingList() const
317  {
318  return m_ObservingList;
319  }
320 
321  ImageExporter *imageExporter();
322 
323  Execute *executeSession();
324 #endif
325  /*@short Increments the updateID, forcing a recomputation of star positions as well */
326  unsigned int incUpdateID();
327 
328  unsigned int updateID() const
329  {
330  return m_updateID;
331  }
332  unsigned int updateNumID() const
333  {
334  return m_updateNumID;
335  }
336  KSNumbers *updateNum()
337  {
338  return &m_updateNum;
339  }
340  void syncUpdateIDs();
341 
342  signals:
344  void progressText(const QString &text);
345 
347  void skyUpdate(bool);
348 
350  void clearCache();
351 
353  void geoChanged();
354 
355  public slots:
357  void slotConsoleMessage(QString s)
358  {
359  std::cout << (const char *)(s.toLocal8Bit()) << std::endl;
360  }
361 
371  void updateTime(GeoLocation *geo, const bool automaticDSTchange = true);
372 
378  void setTimeDirection(float scale);
379 
380  private:
389  bool readCityData();
390 
392  bool readTimeZoneRulebook();
393 
394  //TODO JM: ADV tree should use XML instead
404  bool readADVTreeData();
405 
407  bool readINDIHosts();
408 
409  //TODO JM: Use XML instead; The logger should have more features
410  // that allow users to enter details about their observation logs
411  // objects observed, eye pieces, telescope, conditions, mag..etc
421  bool readUserLog();
422 
438  bool readURLData(const QString &url, int type = 0, bool deepOnly = false);
439 
446  bool openUrlFile(const QString &urlfile, QFile &file);
447 
452  void resetToNewDST(GeoLocation *geo, const bool automaticDSTchange);
453 
454  QList<ADVTreeData *> ADVtreeList;
455  std::unique_ptr<SkyMapComposite> m_SkyComposite;
456 
457  GeoLocation m_Geo;
458  SimClock Clock;
459  KStarsDateTime LTime;
460  KSUserDB m_ksuserdb;
461  CatalogDB m_catalogdb;
462  ColorScheme CScheme;
463 #ifndef KSTARS_LITE
464  ObservingList* m_ObservingList { nullptr };
465  std::unique_ptr<OAL::Log> m_LogObject;
466  std::unique_ptr<Execute> m_Execute;
467  std::unique_ptr<ImageExporter> m_ImageExporter;
468 #endif
469 
470  //EquipmentWriter *m_equipmentWriter;
471 
472  bool TimeRunsForward { false };
473  bool temporaryTrail { false };
474  // FIXME: Used in SkyMap only. Check!
475  bool snapToFocus { false };
476 
477  //KLocale *locale;
478 
479  CachingDms LST;
480 
481  QKeySequence resumeKey;
482 
483  QList<FOV *> availFOVs; // List of all available FOVs
484  QList<FOV *> visibleFOVs; // List of visible FOVs. Cached from Options::FOVNames
485 
486  KStarsDateTime LastNumUpdate, LastSkyUpdate, LastPlanetUpdate, LastMoonUpdate;
487  KStarsDateTime NextDSTChange;
488  // FIXME: Used in kstarsdcop.cpp only
489  KStarsDateTime StoredDate;
490 
491  QList<GeoLocation *> geoList;
492  QMap<QString, TimeZoneRule> Rulebook;
493 
494  quint32 m_preUpdateID, m_updateID;
495  quint32 m_preUpdateNumID, m_updateNumID;
496  KSNumbers m_preUpdateNum, m_updateNum;
497 
498  static KStarsData *pinstance;
499 };
KStarsData::KStarsData
KStarsData()
Constructor.
Definition: kstarsdata.cpp:106
KStarsData::objectNamed
SkyObject * objectNamed(const QString &name)
Find object by name.
Definition: kstarsdata.cpp:429
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:364
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:78
FOV
A simple class encapsulating a Field-of-View symbol.
Definition: fov.h:38
KStarsData::getRulebook
const QMap< QString, TimeZoneRule > & getRulebook() const
Return map for daylight saving rules.
Definition: kstarsdata.h:247
KStarsData::colorScheme
ColorScheme * colorScheme()
Definition: kstarsdata.h:179
KStarsData::logObject
OAL::Log * logObject()
Return log object.
Definition: kstarsdata.h:305
KStarsData::executeSession
Execute * executeSession()
Definition: kstarsdata.cpp:1506
KStarsData::setLocationFromOptions
void setLocationFromOptions()
Set the GeoLocation according to the values stored in the configuration file.
Definition: kstarsdata.cpp:396
QMap< QString, TimeZoneRule >
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:98
KStarsData::initialize
bool initialize()
Initialize KStarsData while running splash screen.
Definition: kstarsdata.cpp:134
KStarsData::lst
CachingDms * lst()
Definition: kstarsdata.h:209
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:892
ImageExporter
Backends for exporting a sky image, either raster or vector, with a legend.
Definition: imageexporter.h:34
KStarsData::catalogdb
CatalogDB * catalogdb()
Definition: kstarsdata.h:197
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:215
KStarsData::snapNextFocus
bool snapNextFocus() const
Definition: kstarsdata.h:253
KStarsData::setFullTimeUpdate
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets...
Definition: kstarsdata.cpp:313
Execute::Execute
Execute()
Default constructor.
Definition: execute.cpp:33
KStarsData::setTimeDirection
void setTimeDirection(float scale)
Sets the direction of time and stores it in bool TimeRunForwards.
Definition: kstarsdata.cpp:359
KStars
This is the main window for KStars.
Definition: kstars.h:101
ADVTreeData::Type
int Type
Definition: detaildialog.h:53
QFile
TimeZoneRule
This class provides the information needed to determine whether Daylight Savings Time (DST; a...
Definition: timezonerule.h:58
geolocation.h
KStarsData::progressText
void progressText(const QString &text)
Signal that specifies the text that should be drawn in the KStarsSplash window.
KStarsData::skyUpdate
void skyUpdate(bool)
Should be used to refresh skymap.
QObject::name
const char * name() const
KStarsData::updateID
unsigned int updateID() const
Definition: kstarsdata.h:328
KStarsData::updateNum
KSNumbers * updateNum()
Definition: kstarsdata.h:336
oal.h
KStarsData::Create
static KStarsData * Create()
Definition: kstarsdata.cpp:90
QObject
KStarsData::isTimeRunningForward
bool isTimeRunningForward() const
Returns true if time is running forward else false.
Definition: kstarsdata.h:126
KStarsData::lt
const KStarsDateTime & lt() const
Definition: kstarsdata.h:158
KStarsData::changeDateTime
void changeDateTime(const KStarsDateTime &newDate)
Change the current simulation date/time to the KStarsDateTime argument.
Definition: kstarsdata.cpp:327
GeoLocation
Contains all relevant information for specifying a location on Earth: City Name, State/Province name...
Definition: geolocation.h:39
KStarsData::updateTime
void updateTime(GeoLocation *geo, const bool automaticDSTchange=true)
Update the Simulation Clock.
Definition: kstarsdata.cpp:234
KStarsData::updateNumID
unsigned int updateNumID() const
Definition: kstarsdata.h:332
KSUserDB
Single class to delegate all User database I/O.
Definition: ksuserdb.h:48
KStarsData::syncUpdateIDs
void syncUpdateIDs()
Definition: kstarsdata.cpp:296
KStarsData::getAvailableFOVs
const QList< FOV * > getAvailableFOVs() const
Definition: kstarsdata.h:299
SimClock::utc
const KStarsDateTime & utc() const
Definition: simclock.h:47
QString
QList< GeoLocation * >
SkyMapComposite
SkyMapComposite is the root object in the object hierarchy of the sky map.
Definition: skymapcomposite.h:73
KStarsDateTime
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:46
KStarsData::observingList
ObservingList * observingList() const
Definition: kstarsdata.h:316
ksnumbers.h
KStarsData::avdTree
QList< ADVTreeData * > avdTree()
Return ADV Tree.
Definition: kstarsdata.h:311
KStarsData::skyComposite
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:173
ColorScheme
This class stores all of the adjustable colors in KStars, in a QMap object keyed by the names of the ...
Definition: colorscheme.h:37
QString::toLocal8Bit
QByteArray toLocal8Bit() const
simclock.h
KStarsData::slotConsoleMessage
void slotConsoleMessage(QString s)
send a message to the console
Definition: kstarsdata.h:357
ColorScheme::fileName
QString fileName() const
Definition: colorscheme.h:102
KStarsData::syncFOV
void syncFOV()
Synchronize list of visible FOVs and list of selected FOVs in Options.
Definition: kstarsdata.cpp:1486
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:54
CatalogDB
Definition: catalogdb.h:43
ObservingList::ObservingList
ObservingList()
Definition: observinglist.cpp:74
ADVTreeData
Definition: detaildialog.h:49
QKeySequence
KStarsData::nearestLocation
GeoLocation * nearestLocation(double longitude, double latitude)
nearestLocation Return nearest location to the given logntidue and latitude coordiantes ...
Definition: kstarsdata.cpp:377
KStarsData::setSnapNextFocus
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition: kstarsdata.h:268
KStarsData::clock
Q_INVOKABLE SimClock * clock()
Definition: kstarsdata.h:203
KStarsData::setNextDSTChange
void setNextDSTChange(const KStarsDateTime &dt)
Set the NextDSTChange member.
Definition: kstarsdata.h:117
SkyMap
This is the canvas on which the sky is painted.
Definition: skymap.h:63
KStarsData::~KStarsData
~KStarsData() override
Destructor.
Definition: kstarsdata.cpp:119
ADVTreeData::Link
QString Link
Definition: detaildialog.h:52
KStarsData::imageExporter
ImageExporter * imageExporter()
Definition: kstarsdata.cpp:1515
kstarsdatetime.h
KStarsData::geoChanged
void geoChanged()
Emitted when geo location changed.
KStarsData::getGeoList
QList< GeoLocation * > & getGeoList()
Definition: kstarsdata.h:221
ADVTreeData::Name
QString Name
Definition: detaildialog.h:51
KStarsData::ut
const KStarsDateTime & ut() const
Definition: kstarsdata.h:164
OAL::Log
Definition: log.h:43
KStarsData::userdb
KSUserDB * userdb()
Definition: kstarsdata.h:191
LocationDialogLite
A backend of location dialog declared in QML.
Definition: locationdialoglite.h:39
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:43
ksuserdb.h
colorscheme.h
KStarsData::incUpdateID
unsigned int incUpdateID()
Definition: kstarsdata.cpp:305
CachingDms
a dms subclass that caches its sine and cosine values every time the angle is changed.
Definition: cachingdms.h:29
KStarsData::getVisibleFOVs
const QList< FOV * > getVisibleFOVs() const
Definition: kstarsdata.h:291
KStarsData::LocationDialog
friend class LocationDialog
Definition: kstarsdata.h:93
KStarsData::colorSchemeName
Q_INVOKABLE QString colorSchemeName()
Definition: kstarsdata.h:185
KStarsData::setLocation
void setLocation(const GeoLocation &l)
Set the GeoLocation according to the argument.
Definition: kstarsdata.cpp:403
KStarsData::syncLST
void syncLST()
Sync the LST with the simulation clock.
Definition: kstarsdata.cpp:322
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Fri Dec 6 2019 04:13:33 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
  • Modules
  • Related Pages

edu API Reference

Skip menu "edu API Reference"
  •     core
  • kstars

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