Kstars

localmeridiancomponent.cpp
1 /*
2  SPDX-FileCopyrightText: 2012 Jerome SONRIER <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "localmeridiancomponent.h"
8 
9 #include "kstarsdata.h"
10 #include "Options.h"
11 #include "linelist.h"
12 #ifdef KSTARS_LITE
13 #include "skymaplite.h"
14 #else
15 #include "skymap.h"
16 #endif
17 #include "skypainter.h"
18 
20  : CoordinateGrid(parent, i18n("Local Meridian Component"))
21 {
22  //KStarsData *data = KStarsData::Instance();
23 
24  intro();
25 
26  double eps = 0.1;
27  double maxAlt = 90.0;
28 
29  std::shared_ptr<LineList> lineList;
30 
31  for (double az = 0; az <= 180; az += 180)
32  {
33  lineList.reset(new LineList());
34 
35  for (double alt = 0; alt < maxAlt; alt += eps)
36  {
37  std::shared_ptr<SkyPoint> p(new SkyPoint());
38  p->setAz(az);
39  p->setAlt(alt);
40  lineList->append(std::move(p));
41  }
42 
43  appendLine(lineList);
44  }
45 
46 
47 
48  summary();
49 }
50 
52 {
53  return (Options::showLocalMeridian() && !(Options::hideOnSlew() &&
54  #ifndef KSTARS_LITE
55  SkyMap::IsSlewing()));
56  #else
57  SkyMapLite::IsSlewing()));
58 #endif
59 }
60 
62 {
63  KStarsData *data = KStarsData::Instance();
64  QColor color = data->colorScheme()->colorNamed("LocalMeridianColor");
65 
66  skyp->setPen(QPen(QBrush(color), 2, Qt::SolidLine));
67 }
68 
70 {
71  KStarsData *data = KStarsData::Instance();
72 
73  for (int i = 0; i < listList().count(); i++)
74  {
75  for (int j = 0; j < listList().at(i)->points()->count(); j++)
76  {
77  listList().at(i)->points()->at(j)->HorizontalToEquatorial(data->lst(), data->geo()->lat());
78  }
79  }
80 }
void update(KSNumbers *) override
Update the sky position(s) of this component.
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
CachingDms * lst()
Definition: kstarsdata.h:223
virtual void setPen(const QPen &pen)=0
Set the pen of the painter.
void preDraw(SkyPainter *skyp) override
Gives the subclasses access to the top of the draw() method.
LocalMeridianComponent(SkyComposite *parent)
Constructor Simply adds all of the coordinate grid circles (meridians and parallels) parent Pointer t...
QString i18n(const char *text, const TYPE &arg...)
void summary()
prints out some summary statistics if the skyMesh debug is greater than 1.
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
const CachingDms * lat() const
Definition: geolocation.h:70
const T & at(int i) const const
ColorScheme * colorScheme()
Definition: kstarsdata.h:171
GeoLocation * geo()
Definition: kstarsdata.h:229
Draws things on the sky, without regard to backend.
Definition: skypainter.h:37
void intro()
displays a message that we are loading m_name.
void appendLine(const std::shared_ptr< LineList > &lineList)
Typically called from within a subclasses constructors.
int count(const T &value) const const
SolidLine
QColor colorNamed(const QString &name) const
Retrieve a color by name.
Definition: colorscheme.cpp:86
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Aug 13 2022 04:01:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.