Kstars

log.h
1 /*
2  SPDX-FileCopyrightText: 2009 Prakash Mohan <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "oal/oal.h"
10 
11 #include <QString>
12 #include <QXmlStreamReader>
13 #include <QXmlStreamWriter>
14 
15 #include "dms.h"
16 #include "skyobjects/skyobject.h"
17 #include "oal/observer.h"
18 #include "oal/site.h"
19 #include "oal/session.h"
20 #include "oal/scope.h"
21 #include "oal/dslrlens.h"
22 #include "oal/eyepiece.h"
23 #include "oal/filter.h"
24 #include "oal/lens.h"
25 #include "oal/observation.h"
26 
27 /**
28  * @class Log
29  *
30  * Implementation of <a href="https://code.google.com/p/openastronomylog/">Open Astronomy Log</a> (OAL) XML specifications to record observation logs.
31  */
32 class OAL::Log
33 {
34  public:
35  ~Log();
36  QString writeLog(bool native = true);
37  void writeBegin();
38  void writeGeoDate();
39  void writeObservers();
40  void writeSites();
41  void writeSessions();
42  void writeTargets();
43  void writeScopes();
44  void writeDSLRLenses();
45  void writeEyepieces();
46  void writeLenses();
47  void writeFilters();
48  void writeImagers();
49  void writeObservations();
50  inline QList<QSharedPointer<SkyObject>> &targetList()
51  {
52  return m_targetList;
53  }
54  inline QList<OAL::Scope *> *scopeList()
55  {
56  return &m_scopeList;
57  }
58  inline QList<OAL::DSLRLens *> *dslrLensList()
59  {
60  return &m_dslrLensList;
61  }
62  inline QList<OAL::Site *> *siteList()
63  {
64  return &m_siteList;
65  }
66  inline QList<OAL::Session *> *sessionList()
67  {
68  return &m_sessionList;
69  }
70  inline QList<OAL::Eyepiece *> *eyepieceList()
71  {
72  return &m_eyepieceList;
73  }
74  inline QList<OAL::Lens *> *lensList()
75  {
76  return &m_lensList;
77  }
78  inline QList<OAL::Filter *> *filterList()
79  {
80  return &m_filterList;
81  }
82  inline QList<OAL::Observation *> *observationList()
83  {
84  return &m_observationList;
85  }
86  inline QList<OAL::Observer *> *observerList()
87  {
88  return &m_observerList;
89  }
90  void writeObserver(OAL::Observer *o);
91  void writeSite(OAL::Site *s);
92  void writeSession(OAL::Session *s);
93  void writeTarget(SkyObject *o);
94  void writeScope(OAL::Scope *s);
95  void writeDSLRLenses(OAL::DSLRLens *s);
96  void writeEyepiece(OAL::Eyepiece *ep);
97  void writeLens(OAL::Lens *l);
98  void writeFilter(OAL::Filter *f);
99  void writeObservation(OAL::Observation *o);
100  // void writeImager();
101  void writeEnd();
102  void readBegin(QString input);
103  void readLog();
104  void readUnknownElement();
105  void readTargets();
106  void readObservers();
107  void readSites();
108  void readSessions();
109  void readScopes();
110  void readDSLRLenses();
111  void readEyepieces();
112  void readLenses();
113  void readFilters();
114  void readObservation(const QString &id);
115  void readTarget();
116  void readSite(const QString &id);
117  void readSession(const QString &id, const QString &lang);
118  void readAll();
119  SkyPoint readPosition(bool &Ok);
120  void readGeoDate();
121  QString readResult();
122  OAL::Observer *findObserverByName(const QString &name);
123  OAL::Observer *findObserverById(const QString &id);
124  OAL::Site *findSiteByName(const QString &name);
125  OAL::Site *findSiteById(const QString &id);
126  OAL::Session *findSessionByName(const QString &id);
127  OAL::Scope *findScopeByName(const QString &name);
128  OAL::Scope *findScopeById(const QString &id);
129  OAL::DSLRLens *findDSLRLensByName(const QString &name);
130  OAL::DSLRLens *findDSLRLensById(const QString &id);
131  OAL::Eyepiece *findEyepieceById(const QString &id);
132  OAL::Lens *findLensById(const QString &id);
133  OAL::Filter *findFilterById(const QString &id);
134  OAL::Eyepiece *findEyepieceByName(const QString &name);
135  OAL::Lens *findLensByName(const QString &name);
136  OAL::Filter *findFilterByName(const QString &name);
137  OAL::Observation *findObservationByName(const QString &name);
138  QHash<QString, QTime> timeHash() const
139  {
140  return TimeHash;
141  }
142  KStarsDateTime dateTime() const
143  {
144  return dt;
145  }
146  GeoLocation *geoLocation()
147  {
148  return geo;
149  }
150  inline QString writtenOutput() const
151  {
152  return output;
153  }
154 
155  private:
156  QList<QSharedPointer<SkyObject>> m_targetList;
157  QList<OAL::Observer *> m_observerList;
158  QList<OAL::Eyepiece *> m_eyepieceList;
159  QList<OAL::Lens *> m_lensList;
160  QList<OAL::Filter *> m_filterList;
161  QList<OAL::Site *> m_siteList;
162  QList<OAL::Session *> m_sessionList;
163  QList<OAL::Scope *> m_scopeList;
164  QList<OAL::DSLRLens *> m_dslrLensList;
165  QList<OAL::Observation *> m_observationList;
166  QString output;
167  bool native { false };
168  dms ra, dec;
169  QXmlStreamWriter *writer { nullptr };
170  QXmlStreamReader *reader { nullptr };
171  QHash<QString, QTime> TimeHash;
172  KStarsDateTime dt;
173  GeoLocation *geo { nullptr };
174 };
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
QTextStream & dec(QTextStream &stream)
GeoCoordinates geo(const QVariant &location)
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
Definition: lens.h:17
FIXME: why not just use a QHash?
Definition: observer.h:19
Information about an object in the sky.
Definition: skyobject.h:41
Definition: site.h:19
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Sep 27 2023 04:02:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.