8
#include "PlanetProperties.h"
11
#include "libannotate/LineSegment.h"
12
#include "libmultiple/libmultiple.h"
13
#include "libplanet/Planet.h"
16
addArc(const double startTime, const double stopTime,
17
const int numTimes, const unsigned char color[3],
18
const int thickness, const View *view,
19
const int width, const int height,
20
const double Prx, const double Pry, const double Prz,
21
Planet *p, multimap<double, Annotation *> &annotationMap)
23
Options *options = Options::getInstance();
25
const body b = p->Index();
26
const double delTime = (stopTime - startTime) / numTimes;
28
for (int i = 0; i <= numTimes; i++)
30
bool skipThisArc = false;
31
double oldX, oldY, oldZ;
32
double newX, newY, newZ;
34
for (int j = 0; j < 2; j ++)
36
const double jd = startTime + (i + j) * delTime;
40
planet.calcHeliocentricEquatorial(false);
41
planet.getPosition(X, Y, Z);
43
view->XYZToPixel(X + Prx, Y + Pry, Z + Prz,
45
X += options->CenterX();
46
Y += options->CenterY();
47
if (X < -width || X > 2*width
48
|| Y < -height || Y > 2*height
69
if (skipThisArc) continue;
71
LineSegment *ls = new LineSegment(color, thickness,
75
double midZ = 0.5 * (oldZ + newZ);
76
annotationMap.insert(pair<const double, Annotation*>(midZ, ls));
81
addOrbits(const double jd0, const View *view,
82
const int width, const int height,
83
Planet *p, PlanetProperties *currentProperties,
84
multimap<double, Annotation *> &annotationMap)
86
const double period = p->Period();
87
if (period == 0) return;
89
const double startOrbit = currentProperties->StartOrbit();
90
const double stopOrbit = currentProperties->StopOrbit();
91
const double delOrbit = currentProperties->DelOrbit();
92
const unsigned char *color = currentProperties->OrbitColor();
93
const int thickness = currentProperties->ArcThickness();
95
double Prx=0, Pry=0, Prz=0;
96
if (p->Primary() != SUN)
98
Planet primary(jd0, p->Primary());
99
primary.calcHeliocentricEquatorial();
100
primary.getPosition(Prx, Pry, Prz);
103
const double startTime = jd0 + startOrbit * period;
104
const double stopTime = jd0 + stopOrbit * period;
106
const int numTimes = (int) (180/delOrbit + 0.5);
108
addArc(startTime, jd0, numTimes, color, thickness, view, width, height,
109
Prx, Pry, Prz, p, annotationMap);
110
addArc(jd0, stopTime, numTimes, color, thickness, view, width, height,
111
Prx, Pry, Prz, p, annotationMap);