Kstars

mountpositionwidget.cpp
1/* Widget to display the mount position.
2 SPDX-FileCopyrightText: Wolfgang Reissenberger <sterne-jaeger@openfuture.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "mountpositionwidget.h"
8
9#include "kstarsdata.h"
10
11namespace Ekos
12{
13MountPositionWidget::MountPositionWidget(QWidget *parent)
14 : QWidget{parent}
15{
16 setupUi(this);
17
18 raValueObject->setTextInteractionFlags(Qt::TextSelectableByMouse);
19 deValueObject->setTextInteractionFlags(Qt::TextSelectableByMouse);
20 azValueObject->setTextInteractionFlags(Qt::TextSelectableByMouse);
21 altValueObject->setTextInteractionFlags(Qt::TextSelectableByMouse);
22 haValueObject->setTextInteractionFlags(Qt::TextSelectableByMouse);
23 zaValueObject->setTextInteractionFlags(Qt::TextSelectableByMouse);
24
25 connect(j2000CheckObject, &QRadioButton::toggled, this, &MountPositionWidget::J2000Enabled);
26}
27
28void MountPositionWidget::updateTelescopeCoords(const SkyPoint &position, const dms &ha)
29{
30
31 // Mount Control Panel coords depend on the switch
32 if (isJ2000Enabled())
33 {
34 raValueObject->setProperty("text", position.ra0().toHMSString());
35 deValueObject->setProperty("text", position.dec0().toDMSString());
36 }
37 else
38 {
39 raValueObject->setProperty("text", position.ra().toHMSString());
40 deValueObject->setProperty("text", position.dec().toDMSString());
41 }
42 azValueObject->setProperty("text", position.az().toDMSString());
43 altValueObject->setProperty("text", position.alt().toDMSString());
44
45 dms lst = KStarsData::Instance()->geo()->GSTtoLST(KStarsData::Instance()->clock()->utc().gst());
46 dms haSigned(ha);
47 QChar sgn('+');
48
49 if (haSigned.Hours() > 12.0)
50 {
51 haSigned.setH(24.0 - haSigned.Hours());
52 sgn = '-';
53 }
54
55 haValueObject->setProperty("text", QString("%1%2").arg(sgn).arg(haSigned.toHMSString()));
56 zaValueObject->setProperty("text", dms(90 - position.altRefracted().Degrees()).toDMSString());
57
58}
59
60bool MountPositionWidget::isJ2000Enabled()
61{
62 return j2000CheckObject->isChecked();
63}
64
65void MountPositionWidget::setJ2000Enabled(bool enabled)
66{
67 j2000CheckObject->setChecked(enabled);
68}
69} // namespace
GeoLocation * geo()
Definition kstarsdata.h:230
The sky coordinates of a point in the sky.
Definition skypoint.h:45
const CachingDms & dec() const
Definition skypoint.h:269
const CachingDms & ra0() const
Definition skypoint.h:251
const CachingDms & ra() const
Definition skypoint.h:263
dms altRefracted() const
const dms & az() const
Definition skypoint.h:275
const dms & alt() const
Definition skypoint.h:281
const CachingDms & dec0() const
Definition skypoint.h:257
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
const QString toDMSString(const bool forceSign=false, const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:287
const QString toHMSString(const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:378
const double & Degrees() const
Definition dms.h:141
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
void toggled(bool checked)
TextSelectableByMouse
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Aug 30 2024 11:50:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.