- Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathobject.cpp
More file actions
Latest commit
174 lines (141 loc) · 3.96 KB
/
Copy pathobject.cpp
File metadata and controls
174 lines (141 loc) · 3.96 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#include"object.h"
structSolarSystem::Object::ObjectData
{
// base parameters
QString stringType; // solar object type: Planet, Sattelite (Moon), Ring, Dwarf Planet, Solar System Body, Star, Asteroid, Galaxy
QString name; // base name
float orbitalSpeed; // base orbital speed, km/s
double mass; // base mass, kg
float meanRadius; // base radius, km
int surfaceTemp; // base surface temperature, K
float surfaceGRavity; // base surface gravity, m/s^2
double volume; // base volume, km^3
// programming type
SolarSystem::ObjectType solarType;
// periods
double siderealPeriod; // sidereal rotation period (around of axis)
double orbitalPeriod; // orbital rotation period (around of sun)
// solar system object description
QString description;
};
SolarSystem::Object::Object(QObject* parent):
QObject(parent), solarObjectData(new ObjectData)
{
solarObjectData->solarType = ObjectType::SolarSystemBody;
}
SolarSystem::Object::~Object()
{
delete solarObjectData;
}
SolarSystem::Object::Object(const SolarSystem::Object& obj):
Object(obj.parent())
{
solarObjectData = newSolarSystem::Object::ObjectData(*(obj.solarObjectData));
}
SolarSystem::Object& SolarSystem::Object::operator=(SolarSystem::Object obj)
{
// temp object swap
SolarSystem::swap(*this, obj);
return *this;
}
// interface
voidSolarSystem::Object::setDescription(const QString& description)
{
solarObjectData->description = description;
}
QString SolarSystem::Object::description() const
{
return solarObjectData->description;
}
voidSolarSystem::Object::setStringType(const QString& type)
{
solarObjectData->stringType = type;
}
QString SolarSystem::Object::stringType() const
{
return solarObjectData->stringType;
}
voidSolarSystem::Object::setSolarObjectName(const QString& name)
{
solarObjectData->name = name;
}
QString SolarSystem::Object::solarObjectName() const
{
return solarObjectData->name;
}
voidSolarSystem::Object::setOrbitalSpeed(float speed)
{
solarObjectData->orbitalSpeed = speed;
}
floatSolarSystem::Object::orbitalSpeed() const
{
return solarObjectData->orbitalSpeed;
}
voidSolarSystem::Object::setMass(double mass)
{
solarObjectData->mass = mass;
}
doubleSolarSystem::Object::mass() const
{
return solarObjectData->mass;
}
voidSolarSystem::Object::setMeanRadius(float radius)
{
solarObjectData->meanRadius = radius;
}
floatSolarSystem::Object::meanRadius() const
{
return solarObjectData->meanRadius;
}
voidSolarSystem::Object::setSurfaceTemperature(int temperature)
{
solarObjectData->surfaceTemp = temperature;
}
intSolarSystem::Object::surfaceTemperature() const
{
return solarObjectData->surfaceTemp;
}
voidSolarSystem::Object::setSurfaceGravity(float gravity)
{
solarObjectData->surfaceGRavity = gravity;
}
floatSolarSystem::Object::surfaceGravity() const
{
return solarObjectData->surfaceGRavity;
}
voidSolarSystem::Object::setVolume(double volume)
{
solarObjectData->volume = volume;
}
doubleSolarSystem::Object::volume() const
{
return solarObjectData->volume;
}
voidSolarSystem::Object::setSolarType(ObjectType type)
{
solarObjectData->solarType = type;
}
SolarSystem::ObjectType SolarSystem::Object::solarType() const
{
return solarObjectData->solarType;
}
voidSolarSystem::Object::setSiderealPeriod(double period)
{
solarObjectData->siderealPeriod = period;
}
doubleSolarSystem::Object::siderealPeriod() const
{
return solarObjectData->siderealPeriod;
}
voidSolarSystem::Object::setOrbitalPeriod(double period)
{
solarObjectData->orbitalPeriod = period;
}
doubleSolarSystem::Object::orbitalPeriod() const
{
return solarObjectData->orbitalPeriod;
}
voidSolarSystem::swap(SolarSystem::Object& lhs, SolarSystem::Object& rhs)
{
std::swap(lhs.solarObjectData, rhs.solarObjectData);
}