forked from CelestiaProject/Celestia
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmarker.cpp
More file actions
123 lines (88 loc) · 2.15 KB
/
marker.cpp
File metadata and controls
123 lines (88 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// marker.cpp
//
// Copyright (C) 2019, Celestia Development Team
// Copyright (C) 2003, Chris Laurel <claurel@shatters.net>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include "marker.h"
#include "render.h"
using namespace std;
using namespace celestia;
UniversalCoord Marker::position(double jd) const
{
return m_object.getPosition(jd);
}
Selection Marker::object() const
{
return m_object;
}
int Marker::priority() const
{
return m_priority;
}
void Marker::setPriority(int priority)
{
m_priority = priority;
}
void Marker::setRepresentation(const MarkerRepresentation& rep)
{
m_representation = rep;
}
bool Marker::occludable() const
{
return m_occludable;
}
void Marker::setOccludable(bool occludable)
{
m_occludable = occludable;
}
MarkerSizing Marker::sizing() const
{
return m_sizing;
}
void Marker::setSizing(MarkerSizing sizing)
{
m_sizing = sizing;
}
void Marker::render(Renderer& r, float size, const Matrices &m) const
{
m_representation.render(r, m_sizing == DistanceBasedSize ? size : m_representation.size(), m);
}
MarkerRepresentation::MarkerRepresentation(const MarkerRepresentation& rep) :
m_symbol(rep.m_symbol),
m_size(rep.m_size),
m_color(rep.m_color),
m_label(rep.m_label)
{
}
MarkerRepresentation&
MarkerRepresentation::operator=(const MarkerRepresentation& rep)
{
m_symbol = rep.m_symbol;
m_size = rep.m_size;
m_color = rep.m_color;
m_label = rep.m_label;
return *this;
}
void MarkerRepresentation::setColor(Color color)
{
m_color = color;
}
void MarkerRepresentation::setSize(float size)
{
m_size = size;
}
void MarkerRepresentation::setLabel(std::string label)
{
m_label = std::move(label);
}
/*! Render the marker symbol at the specified size. The size is
* the diameter of the marker in pixels.
*/
void MarkerRepresentation::render(Renderer &r, float size, const Matrices &m) const
{
r.renderMarker(m_symbol, size, m_color, m);
}