Isis 3 Programmer Reference
TargetBody.cpp
1#include "TargetBody.h"
2
3#include <QDataStream>
4#include <QDebug>
5#include <QList>
6#include <QUuid>
7#include <QXmlStreamWriter>
8
9#include "Distance.h"
10#include "IString.h"
11#include "Project.h"
12#include "PvlKeyword.h"
13#include "PvlObject.h"
14#include "TargetBodyDisplayProperties.h"
15
16namespace Isis {
22TargetBody::TargetBody(Target *target, QObject *parent) : QObject(parent) {
23 m_id = NULL;
24
25 m_radii.resize(3, Distance());
27
28 m_bodyCode = new SpiceInt;
29 m_systemCode = new SpiceInt;
30
31 m_targetName = target->name();
32
33 m_systemName = target->systemName();
34
35 m_frametype = target->frameType();
36
37 // TODO - initialize TargetBody members from target
38 *m_bodyCode = target->naifBodyCode();
40 m_radii[0] = target->radii().at(0);
41 m_radii[1] = target->radii().at(1);
42 m_radii[2] = target->radii().at(2);
43
44 m_raPole = target->poleRaCoefs();
45 m_decPole = target->poleDecCoefs();
46 m_pm = target->pmCoefs();
47
48 m_raNutPrec = target->poleRaNutPrecCoefs();
49 m_decNutPrec = target->poleDecNutPrecCoefs();
50 m_pmNutPrec = target->pmNutPrecCoefs();
51
52 m_sysNutPrec0 = target->sysNutPrecConstants();
53 m_sysNutPrec1 = target->sysNutPrecCoefs();
54
56 = new TargetBodyDisplayProperties(target->name(), this);
57
58 m_id = new QUuid(QUuid::createUuid());
59 }
60
61
67/*
68 TargetBody::TargetBody(BundleTargetBodyQsp bundleTargetBody, QObject *parent) : QObject(parent)
69 {
70 m_id = NULL;
71
72 m_radii.resize(3, Distance());
73 m_sigmaRadii.resize(3, Distance(0.0, Distance::Kilometers));
74
75 m_bodyCode = new SpiceInt;
76 m_systemCode = new SpiceInt;
77
78// m_systemName = bundleTargetBody->systemName();
79
80 // TODO - initialize TargetBody members from bundleTargetBody
81// *m_bodyCode = target->naifBodyCode();
82// *m_systemCode = target->naifPlanetSystemCode();
83 m_radii = bundleTargetBody->radii();
84// m_sigmaRadii = bundleTargetBody->
85
86 m_raPole = bundleTargetBody->poleRaCoefs();
87 m_decPole = bundleTargetBody->poleDecCoefs();
88 m_pm = bundleTargetBody->pmCoefs();
89
90// m_raNutPrec = bundleTargetBody->poleRaNutPrecCoefs();
91// m_decNutPrec = bundleTargetBody->poleDecNutPrecCoefs();
92// m_pmNutPrec = bundleTargetBody->pmNutPrecCoefs();
93
94// m_sysNutPrec0 = bundleTargetBody->sysNutPrecConstants();
95// m_sysNutPrec1 = bundleTargetBody->sysNutPrecCoefs();
96
97// m_displayProperties
98// = new TargetBodyDisplayProperties(target->name(), this);
99
100 m_id = new QUuid(QUuid::createUuid());
101 }
102*/
103
104
105
106// TargetBody::TargetBody(const TargetBody &src)
107// : m_id(new QUuid(src.m_id->toString())) {
108//
109// m_bodyCode = new SpiceInt(*src.m_bodyCode);
110//
111// m_radii.resize(3, Distance());
112// m_sigmaRadii.resize(3, Distance(3.0, Distance::Kilometers));
113// TODO - radii sigma fudged for now
114//
115// for (int i = 0; i < 3; i++) {
116// m_radii[i] = src.m_radii[i];
117// m_sigmaRadii[i] = src.m_sigmaRadii[i];
118// }
119//
120// m_displayProperties
121// = new TargetBodyDisplayProperties(*src.m_displayProperties);
122//
123// int fred=1;
124// m_bodyCode = src.m_bodyCode;
125// }
126
127
132 delete m_id;
133 m_id = NULL;
134
135 delete m_bodyCode;
136 m_bodyCode = NULL;
137
138 delete m_systemCode;
139 m_systemCode = NULL;
140 }
141
142
143// TargetBody &TargetBody::operator=(const TargetBody &src) {
144
145// if (&src != this) {
146
147// delete m_id;
148// m_id = NULL;
149// m_id = new QUuid(src.m_id->toString());
150// }
151
152// return *this;
153// }
154
155
163 bool TargetBody::operator==(const TargetBody &src) const {
164
165 TargetBody *rtargetBody = (TargetBody *) &src;
166
167 if (*m_bodyCode != rtargetBody->naifBodyCode())
168 return false;
169 if (m_radii[0] != rtargetBody->radiusA())
170 return false;
171 if (m_radii[1] != rtargetBody->radiusB())
172 return false;
173 if (m_radii[2] != rtargetBody->radiusC())
174 return false;
175
176 return true;
177 }
178
179
188
189
198
199
205 return m_targetName;
206 }
207
208
214 return m_frametype;
215 }
216
217
222 std::vector<Angle> TargetBody::poleRaCoefs() {
223 return m_raPole;
224 }
225
226
231 std::vector<Angle> TargetBody::poleDecCoefs() {
232 return m_decPole;
233 }
234
235
240 std::vector<Angle> TargetBody::pmCoefs() {
241 return m_pm;
242 }
243
244
249 std::vector<double> TargetBody::poleRaNutPrecCoefs() {
250 return m_raNutPrec;
251 }
252
253
258 std::vector<double> TargetBody::poleDecNutPrecCoefs() {
259 return m_decNutPrec;
260 }
261
262
267 std::vector<double> TargetBody::pmNutPrecCoefs() {
268 return m_pmNutPrec;
269 }
270
271
276 std::vector<Angle> TargetBody::sysNutPrecConstants() {
277 return m_sysNutPrec0;
278 }
279
284 std::vector<Angle> TargetBody::sysNutPrecCoefs() {
285 return m_sysNutPrec1;
286 }
287
288
295 SpiceInt TargetBody::naifBodyCode() const {
296 return *m_bodyCode;
297 }
298
299
307 return *m_systemCode;
308 }
309
310
318 return m_systemName;
319 }
320
321
328 return m_radii[0];
329 }
330
331
338 return m_sigmaRadii[0];
339 }
340
341
348 return m_radii[1];
349 }
350
351
358 return m_sigmaRadii[1];
359 }
360
361
368 return m_radii[2];
369 }
370
371
378 return m_sigmaRadii[2];
379 }
380
381
389
391
392 return meanRadius;
393 }
394
395
408
409
415 QString TargetBody::id() const {
416 return m_id->toString().remove(QRegExp("[{}]"));
417 }
418
419
420}
Distance measurement, usually in meters.
Definition Distance.h:34
@ Kilometers
The distance is being specified in kilometers.
Definition Distance.h:45
This is the GUI communication mechanism for target body objects.
Container class for TargetBody.
Definition TargetBody.h:63
std::vector< Angle > pmCoefs()
Returns coefficients of a quadratic polynomial fitting pole pm.
std::vector< Distance > m_sigmaRadii
target radii sigmas
Definition TargetBody.h:158
TargetBodyDisplayProperties * displayProperties()
Gets TargetBodyDisplayProperties.
Distance radiusB() const
Returns "b" radius.
std::vector< Distance > m_radii
target radii
Definition TargetBody.h:153
TargetBody(Target *target, QObject *parent=0)
The first constructor for this class.
std::vector< Angle > m_raPole
Coefficients of a quadratic polynomial fitting pole ra.
Definition TargetBody.h:168
SpiceInt naifBodyCode() const
This returns the NAIF body code of the target.
Distance sigmaRadiusC() const
Returns the "c" radius sigma.
TargetBodyDisplayProperties * m_displayProperties
The GUI information for how this Target will be displayed.
Definition TargetBody.h:163
std::vector< double > m_decNutPrec
Coefficients of pole decliniation nut/prec terms.
Definition TargetBody.h:176
std::vector< Angle > poleDecCoefs()
Returns coefficients of a quadratic polynomial fitting pole dec.
int m_frametype
Fill this in when Debbie or Ken tell me what it is returning.
Definition TargetBody.h:165
std::vector< double > poleDecNutPrecCoefs()
TargetBody::poleDecNutPrecCoefs.
std::vector< Angle > sysNutPrecCoefs()
Returns Linear terms of planetary system nut/prec periods.
std::vector< double > pmNutPrecCoefs()
Returns coefficients of the prime meridian nut/prec terms.
int frameType()
Returns the frame type.
QString id() const
Get a unique, identifying string associated with this TargetBody object.
Distance meanRadius() const
Returns the mean radius.
bool operator==(const TargetBody &src) const
Compares two Target Body objects to see if they are equal.
std::vector< Angle > m_decPole
Coefficients of a quadratic polynomial fitting pole dec.
Definition TargetBody.h:169
Distance sigmaRadiusB() const
Returns "b" radius sigma.
std::vector< Angle > m_sysNutPrec1
Linear terms of planetary system nut/prec periods.
Definition TargetBody.h:181
SpiceInt * m_bodyCode
TODO - RETHINK MEMBER VARIABLES AND METHODS The NaifBodyCode value, if it exists in the cube labels.
Definition TargetBody.h:138
std::vector< Angle > poleRaCoefs()
TargetBody::poleRaCoefs.
~TargetBody()
The second constructor for this class.
Distance sigmaMeanRadius() const
Returns the mean radius sigma.
QString naifPlanetSystemName() const
This returns the body name of the target's planet system.
std::vector< Angle > sysNutPrecConstants()
Returns constants of planetary system nut/prec periods.
Distance radiusC() const
Returns the "c" radius.
QUuid * m_id
A unique ID for this TargetBody object (useful for others to reference this object when saving to dis...
Definition TargetBody.h:126
Distance radiusA() const
Returns "a" radius.
std::vector< double > poleRaNutPrecCoefs()
Returns coefficients of pole right ascension nut/prec terms.
QString m_targetName
The TargetName as it appears in the original cube.
Definition TargetBody.h:131
std::vector< Angle > m_sysNutPrec0
Constants of planetary system nut/prec periods.
Definition TargetBody.h:180
QString m_systemName
The NaifBodyCode system name.
Definition TargetBody.h:148
SpiceInt * m_systemCode
The NaifBodyCode system code.
Definition TargetBody.h:143
Distance sigmaRadiusA() const
Returns "a" radius sigma.
std::vector< Angle > m_pm
Coefficients of a quadratic polynomial fitting pole pm.
Definition TargetBody.h:170
SpiceInt naifPlanetSystemCode() const
This returns the NAIF body code of the target's planet system.
std::vector< double > m_raNutPrec
Coefficients of pole right ascension nut/prec terms.
Definition TargetBody.h:175
std::vector< double > m_pmNutPrec
Coefficients of prime meridian nut/prec terms.
Definition TargetBody.h:177
QString targetName()
Returns the value stored at TargetName in the original pvl label.
This class is used to create and store valid Isis targets.
Definition Target.h:63
SpiceInt naifBodyCode() const
This returns the NAIF body code of the target.
Definition Target.cpp:522
std::vector< Distance > radii() const
Returns the radii of the body in km.
Definition Target.cpp:557
SpiceInt naifPlanetSystemCode() const
This returns the NAIF planet system body code of the target.
Definition Target.cpp:535
QString name() const
Return target name.
Definition Target.cpp:541
QString systemName() const
Return planet system name.
Definition Target.cpp:547
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16