Kstars

linelistlabel.h
1/*
2 SPDX-FileCopyrightText: 2007 James B. Bowlin <bowlin@mindspring.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#pragma once
7
8#include <QPointF>
9#include <QString>
10
11class LineList;
12class Projector;
13class SkyLabeler;
14
15/**
16 * @class LabelListIndex
17 * An abstract parent class to be inherited by Ecliptic and Equator.
18 *
19 * @author James B. Bowlin
20 * @version 0.1
21 */
22class LineListLabel
23{
24 public:
25 explicit LineListLabel(const QString &text);
26
27 enum
28 {
29 TopCandidate,
30 BotCandidate,
31 LeftCandidate,
32 RightCandidate
33 };
34
35 /** @short prepare the context for selecting label position candidates. */
36 void reset();
37
38 /**
39 * @short draw the label if any. Is currently called at the bottom of draw() but that call could
40 * be removed and it could be called externally AFTER draw() has been called so draw() can set
41 * up the label position candidates.
42 */
43 void draw();
44
45 void updateLabelCandidates(qreal x, qreal y, LineList *lineList, int i);
46
47 private:
48 /**
49 * @short This routine does two things at once. It returns the QPointF
50 * corresponding to pointList[i] and also computes the angle using
51 * pointList[i] and pointList[i-1] therefore you MUST ensure that:
52 *
53 * 1 <= i < pointList.size().
54 */
55 QPointF angleAt(const Projector *proj, LineList *list, int i, double *angle);
56
57 const QString m_text;
58 SkyLabeler *m_skyLabeler { nullptr };
59
60 // these two arrays track/contain 4 candidate points
61 int m_labIndex[4] { 0, 0, 0, 0 };
62 LineList *m_labList[4] { nullptr, nullptr, nullptr, nullptr };
63
64 float m_marginLeft { 0 };
65 float m_marginRight { 0 };
66 float m_marginTop { 0 };
67 float m_marginBot { 0 };
68 float m_farLeft { 0 };
69 float m_farRight { 0 };
70 float m_farTop { 0 };
71 float m_farBot { 0 };
72};
A simple data container used by LineListIndex.
Definition linelist.h:25
The Projector class is the primary class that serves as an interface to handle projections.
Definition projector.h:58
The purpose of this class is to prevent labels from overlapping.
Definition skylabeler.h:99
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.