Kstars

targetlistcomponent.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Akarsh Simha <akarsh.simha@kdemail.net>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "targetlistcomponent.h"
8
9#ifndef KSTARS_LITE
10#include "skymap.h"
11#endif
12#include "skypainter.h"
13#include "auxiliary/ksutils.h"
14
16{
17 drawSymbols = nullptr;
18 drawLabels = nullptr;
19}
20
22 bool (*optionDrawSymbols)(void), bool (*optionDrawLabels)(void))
23 : SkyComponent(parent), list(objectList), pen(_pen)
24{
25 drawSymbols = optionDrawSymbols;
26 drawLabels = optionDrawLabels;
27}
28
29TargetListComponent::~TargetListComponent()
30{
31 if (list.get())
32 {
33 qDeleteAll(*list);
34 }
35}
36
38{
39 if (drawSymbols && !(*drawSymbols)())
40 return;
41
42 skyp->setPen(pen);
43 if (list && list->count() > 0)
44 {
45 skyp->drawObservingList(*list);
46 }
47 if (list2.count() > 0)
48 {
49 SkyObjectList newList = KSUtils::makeVanillaPointerList(list2);
50
51 skyp->drawObservingList(newList);
52 }
53}
SkyComponent represents an object on the sky map.
SkyComposite is a kind of container class for SkyComponent objects.
Draws things on the sky, without regard to backend.
Definition skypainter.h:40
virtual void drawObservingList(const QList< SkyObject * > &obs)=0
Draw the symbols for the observing list.
virtual void setPen(const QPen &pen)=0
Set the pen of the painter.
bool(* drawLabels)(void)
Pointer to static method that tells us whether to draw labels for this list or not.
bool(* drawSymbols)(void)
Pointer to static method that tells us whether to draw this list or not.
void draw(SkyPainter *skyp) override
Draw this component by iterating over the list.
TargetListComponent(SkyComposite *parent)
Default constructor.
QPen pen
Pen to use to draw.
QList< QSharedPointer< SkyObject > > list2
Pointer to list of objects to draw.
std::unique_ptr< SkyObjectList > list
Pointer to list of objects to draw.
qsizetype count() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.