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/eyepiece.h"
22 #include "oal/filter.h"
23 #include "oal/lens.h"
24 #include "oal/observation.h"
25 
26 /**
27  * @class Log
28  *
29  * Implementation of <a href="https://code.google.com/p/openastronomylog/">Open Astronomy Log</a> (OAL) XML specifications to record observation logs.
30  */
31 class OAL::Log
32 {
33  public:
34  ~Log();
35  QString writeLog(bool native = true);
36  void writeBegin();
37  void writeGeoDate();
38  void writeObservers();
39  void writeSites();
40  void writeSessions();
41  void writeTargets();
42  void writeScopes();
43  void writeEyepieces();
44  void writeLenses();
45  void writeFilters();
46  void writeImagers();
47  void writeObservations();
48  inline QList<QSharedPointer<SkyObject>> &targetList() { return m_targetList; }
49  inline QList<OAL::Scope *> *scopeList() { return &m_scopeList; }
50  inline QList<OAL::Site *> *siteList() { return &m_siteList; }
51  inline QList<OAL::Session *> *sessionList() { return &m_sessionList; }
52  inline QList<OAL::Eyepiece *> *eyepieceList() { return &m_eyepieceList; }
53  inline QList<OAL::Lens *> *lensList() { return &m_lensList; }
54  inline QList<OAL::Filter *> *filterList() { return &m_filterList; }
55  inline QList<OAL::Observation *> *observationList() { return &m_observationList; }
56  inline QList<OAL::Observer *> *observerList() { return &m_observerList; }
57  void writeObserver(OAL::Observer *o);
58  void writeSite(OAL::Site *s);
59  void writeSession(OAL::Session *s);
60  void writeTarget(SkyObject *o);
61  void writeScope(OAL::Scope *s);
62  void writeEyepiece(OAL::Eyepiece *ep);
63  void writeLens(OAL::Lens *l);
64  void writeFilter(OAL::Filter *f);
65  void writeObservation(OAL::Observation *o);
66  // void writeImager();
67  void writeEnd();
68  void readBegin(QString input);
69  void readLog();
70  void readUnknownElement();
71  void readTargets();
72  void readObservers();
73  void readSites();
74  void readSessions();
75  void readScopes();
76  void readEyepieces();
77  void readLenses();
78  void readFilters();
79  void readObservation(const QString &id);
80  void readTarget();
81  void readSite(const QString &id);
82  void readSession(const QString &id, const QString &lang);
83  void readAll();
84  SkyPoint readPosition(bool &Ok);
85  void readGeoDate();
86  QString readResult();
87  OAL::Observer *findObserverByName(const QString &name);
88  OAL::Observer *findObserverById(const QString &id);
89  OAL::Site *findSiteByName(const QString &name);
90  OAL::Site *findSiteById(const QString &id);
91  OAL::Session *findSessionByName(const QString &id);
92  OAL::Scope *findScopeByName(const QString &name);
93  OAL::Scope *findScopeById(const QString &id);
94  OAL::Eyepiece *findEyepieceById(const QString &id);
95  OAL::Lens *findLensById(const QString &id);
96  OAL::Filter *findFilterById(const QString &id);
97  OAL::Eyepiece *findEyepieceByName(const QString &name);
98  OAL::Lens *findLensByName(const QString &name);
99  OAL::Filter *findFilterByName(const QString &name);
100  OAL::Observation *findObservationByName(const QString &name);
101  QHash<QString, QTime> timeHash() const { return TimeHash; }
102  KStarsDateTime dateTime() const { return dt; }
103  GeoLocation *geoLocation() { return geo; }
104  inline QString writtenOutput() const { return output; }
105 
106  private:
107  QList<QSharedPointer<SkyObject>> m_targetList;
108  QList<OAL::Observer *> m_observerList;
109  QList<OAL::Eyepiece *> m_eyepieceList;
110  QList<OAL::Lens *> m_lensList;
111  QList<OAL::Filter *> m_filterList;
112  // QList<OAL::Equipment *> m_equipmentList;
113  // QList<OAL::Imager *> m_imagerList;
114  QList<OAL::Site *> m_siteList;
115  QList<OAL::Session *> m_sessionList;
116  QList<OAL::Scope *> m_scopeList;
117  QList<OAL::Observation *> m_observationList;
118  QString output;
119  bool native { false };
120  dms ra, dec;
121  QXmlStreamWriter *writer { nullptr };
122  QXmlStreamReader *reader { nullptr };
123  QHash<QString, QTime> TimeHash;
124  KStarsDateTime dt;
125  GeoLocation *geo { nullptr };
126 };
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-2022 The KDE developers.
Generated on Fri Aug 19 2022 03:57:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.