Kstars

targetlistcomponent.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Akarsh Simha <[email protected]>
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 
29 TargetListComponent::~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 }
void draw(SkyPainter *skyp) override
Draw this component by iterating over the list.
int count(const T &value) const const
virtual void setPen(const QPen &pen)=0
Set the pen of the painter.
bool(* drawSymbols)(void)
Pointer to static method that tells us whether to draw this list or not.
bool(* drawLabels)(void)
Pointer to static method that tells us whether to draw labels for this list or not.
Draws things on the sky, without regard to backend.
Definition: skypainter.h:39
TargetListComponent(SkyComposite *parent)
Default constructor.
QPen pen
Pen to use to draw.
virtual void drawObservingList(const QList< SkyObject * > &obs)=0
Draw the symbols for the observing list.
std::unique_ptr< SkyObjectList > list
Pointer to list of objects to draw.
QList< QSharedPointer< SkyObject > > list2
Pointer to list of objects to draw.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 04:06:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.