Kstars

fovitem.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#include "fovitem.h"
7#include "labelsitem.h"
8#include "skynodes/fovsymbolnode.h"
9#include "Options.h"
10
11FOVItem::FOVItem(RootNode *rootNode) : SkyItem(LabelsItem::label_t::NO_LABEL, rootNode)
12{
13 addSymbol(i18nc("use field-of-view for binoculars", "7x35 Binoculars"), 558, 558, 0, 0, 0, CIRCLE, "#AAAAAA");
14 addSymbol(i18nc("use a Telrad field-of-view indicator", "Telrad"), 30, 30, 0, 0, 0, BULLSEYE, "#AA0000");
15 addSymbol(i18nc("use 1-degree field-of-view indicator", "One Degree"), 60, 60, 0, 0, 0, CIRCLE, "#AAAAAA");
16 addSymbol(i18nc("use HST field-of-view indicator", "HST WFPC2"), 2.4, 2.4, 0, 0, 0, SQUARE, "#AAAAAA");
17 addSymbol(i18nc("use Radiotelescope HPBW", "30m at 1.3cm"), 1.79, 1.79, 0, 0, 0, SQUARE, "#AAAAAA");
18}
19
20void FOVItem::addSymbol(const QString &name, float a, float b, float xoffset, float yoffset, float rot,
21 FOVItem::Shape shape, const QString &color)
22{
23 SkyMapLite::Instance()->addFOVSymbol(name, false);
24 appendChildNode(new FOVSymbolNode(name, a, b, xoffset, yoffset, rot, shape, color));
25}
26
28{
29 float zoomFactor = Options::zoomFactor();
30 SkyMapLite *map = SkyMapLite::Instance();
31
32 QSGNode *n = firstChild();
33 int index = 0;
34 while (n != 0)
35 {
36 FOVSymbolNode *fov = static_cast<FOVSymbolNode *>(n);
37 if (map->isFOVVisible(index))
38 {
39 fov->update(zoomFactor);
40 }
41 else
42 {
43 fov->hide();
44 }
45 n = n->nextSibling();
46 index++;
47 }
48}
Shape
FOV symbol types.
Definition fovitem.h:22
FOVItem(RootNode *rootNode)
Constructor.
Definition fovitem.cpp:11
void addSymbol(const QString &name, float a, float b, float xoffset, float yoffset, float rot, FOVItem::Shape shape, const QString &color)
Add information about new symbol to SkyMapLite and create FOVSymbolNode SkyMapLite acts here as a bri...
Definition fovitem.cpp:20
virtual void update() override
Update FOVSymbol if user switched it on.
Definition fovitem.cpp:27
A SkyNode derived class used for displaying FOV symbol.
void update(float zoomFactor)
Update this FOV symbol according to the zoomFactor.
This class is in charge of labels in SkyMapLite.
Definition labelsitem.h:53
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
This is an interface for implementing SkyItems that represent SkyComponent derived objects on the Sky...
Definition skyitem.h:30
This is the main item that displays all SkyItems.
Definition skymaplite.h:59
Q_INVOKABLE void addFOVSymbol(const QString &FOVName, bool initialState=false)
adds FOV symbol to m_FOVSymbols
virtual void hide()
hides all child nodes (sets opacity of m_opacity to 0)
Definition skynode.cpp:21
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void appendChildNode(QSGNode *node)
QSGNode * firstChild() const const
QSGNode * nextSibling() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:15:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.