Isis 3 Programmer Reference
TargetInfoWidget.cpp
1 #include "TargetInfoWidget.h"
2 #include "ui_TargetInfoWidget.h"
3 #include <QFont>
4 #include <QFontInfo>
5 #include <QPixmap>
6 
7 #include "Directory.h"
8 #include "SpiceRotation.h"
9 #include "TargetBody.h"
11 
12 namespace Isis {
13 
22  QWidget *parent) : m_ui(new Ui::TargetInfoWidget) {
23  m_ui->setupUi(this);
24 
25  m_target = target;
26 
27  QString name = m_target->displayProperties()->displayName();
28 
29 
30  // Ken TODO - set up map between target display names and icon/image names
31  QPixmap image;
32  if (name.compare("MOON") == 0) {
33  image.load(FileName("$base/images/nasa_moon_large.png").expanded());
34  setWindowIcon(QIcon(FileName("$base/icons/weather-clear-night.png")
35  .expanded()));
36  }
37  else if (name.compare("Enceladus") == 0) {
38  image.load(FileName("$base/images/nasa_enceladus_saturn.png").expanded());
39  setWindowIcon(QIcon(FileName("$base/icons/nasa_enceladus.png").expanded()));
40  }
41  else if (name.compare("Europa") == 0) {
42  image.load(FileName("$base/images/nasa_europa_large.png").expanded());
43  setWindowIcon(QIcon(FileName("$base/icons/nasa_europa.png").expanded()));
44  }
45  else if (name.compare("Mars") == 0) {
46  image.load(FileName("$base/images/nasa_mars_large.png").expanded());
47  setWindowIcon(QIcon(FileName("$base/icons/nasa_mars.png").expanded()));
48  }
49  else if (name.compare("Titan") == 0) {
50  image.load(FileName("$base/images/nasa_titan_large.png").expanded());
51  setWindowIcon(QIcon(FileName("$base/icons/nasa_titan.png").expanded()));
52  }
53 
54  m_ui->bodySystemlabel->setText(tr("System: %1").arg(m_target->naifPlanetSystemName()));
55 
56  setMinimumWidth(m_ui->tabWidget->minimumWidth()+20);
57 
58  m_ui->targetImage->setPixmap(image);
59 
60  setFrameStyle(QFrame::Panel | QFrame::Sunken);
61  setLineWidth(2);
62 
63  m_ui->tabWidget->setCurrentIndex(0);
64 
65  if (target->frameType() == Isis::SpiceRotation::BPC) {
66  m_ui->poleRightAscensionLabel->hide();
67  m_ui->poleDeclinationLabel->hide();
68  m_ui->polePMOffsetLabel->hide();
69  }
70  else {
71  m_ui->poleRightAscensionLabel->setText(formatPoleRaString());
72  m_ui->poleDeclinationLabel->setText(formatPoleDecString());
73  m_ui->polePMOffsetLabel->setText(formatPmString());
74  }
75 
76  m_ui->aRadiiLabel->setText(tr("%1").arg(m_target->radiusA().kilometers()));
77  m_ui->bRadiiLabel->setText(tr("%1").arg(m_target->radiusB().kilometers()));
78  m_ui->cRadiiLabel->setText(tr("%1").arg(m_target->radiusC().kilometers()));
79  m_ui->meanRadiiLabel->setText(tr("%1").arg(m_target->meanRadius().kilometers()));
80  }
81 
82 
87  delete m_ui;
88  }
89 
90 
97 
98  QString poleRaString = "";
99 
102 
103  std::vector<Angle> poleRaCoefs = m_target->poleRaCoefs();
104  std::vector<double> poleRaNutPrecCoefs = m_target->poleRaNutPrecCoefs();
105 
106  const QChar degChar(0260);
107  QString coefLetter = m_target->naifPlanetSystemName().at(0);
108 
109  if (poleRaCoefs[1].degrees() < 0.0 ) {
110  poleRaString.append(tr("%1%3 - %2T").arg(poleRaCoefs[0].degrees()).arg(-poleRaCoefs[1]
111  .degrees()).arg(degChar));
112  }
113  else {
114  poleRaString.append(tr("%1%3 + %2T").arg(poleRaCoefs[0].degrees()).arg(poleRaCoefs[1]
115  .degrees()).arg(degChar));
116  }
117 
118  QString tmp;
119  int nCoefs = poleRaNutPrecCoefs.size();;
120  for (int i = 0; i < nCoefs; i++) {
121  if (poleRaNutPrecCoefs[i] < 0.0 ) {
122  tmp.append(tr(" - %1%2%3").arg(-poleRaNutPrecCoefs[i]).arg("sin %1").arg(coefLetter)
123  .arg(i+1));
124  }
125  else if (poleRaNutPrecCoefs[i] > 0.0 ) {
126  tmp.append(tr(" + %1%2%3").arg(poleRaNutPrecCoefs[i]).arg("sin %1").arg(coefLetter)
127  .arg(i+1));
128  }
129  }
130 
131  poleRaString.append(tmp);
132 
133  return poleRaString;
134 
135  }
136 
137  else {
138  errorMsg();
139  return poleRaString;
140  }
141 
142 
143  }
144 
145 
152 
153  QString poleDecString = "";
154 
157 
158  std::vector<Angle> poleDecCoefs = m_target->poleDecCoefs();
159  std::vector<double> poleDecNutPrecCoefs = m_target->poleDecNutPrecCoefs();
160 
161  const QChar degChar(0260);
162 
163  QString coefLetter = m_target->naifPlanetSystemName().at(0);
164 
165  if (poleDecCoefs[1].degrees() < 0.0 ) {
166  poleDecString.append(tr("%1%3 - %2T").arg(poleDecCoefs[0].degrees()).arg(-poleDecCoefs[1]
167  .degrees()).arg(degChar));
168  }
169  else {
170  poleDecString.append(tr("%1%3 + %2T").arg(poleDecCoefs[0].degrees()).arg(poleDecCoefs[1]
171  .degrees()).arg(degChar));
172  }
173 
174  QString tmp;
175  int nCoefs = poleDecNutPrecCoefs.size();
176 
177  for (int i = 0; i < nCoefs; i++) {
178  if (poleDecNutPrecCoefs[i] < 0.0 ) {
179  tmp.append(tr(" - %1%2%3").arg(-poleDecNutPrecCoefs[i]).arg("cos %1").arg(coefLetter)
180  .arg(i+1));
181  }
182  else if (poleDecNutPrecCoefs[i] > 0.0 ) {
183  tmp.append(tr(" + %1%2%3").arg(poleDecNutPrecCoefs[i]).arg("cos %1").arg(coefLetter)
184  .arg(i+1));
185  }
186  }
187 
188  poleDecString.append(tmp);
189  return poleDecString;
190 
191  }//end if
192 
193  else {
194  errorMsg();
195  return poleDecString;
196  }
197 
198  }
199 
200 
207 
208  QString pmString = "";
209 
212  {
213 
214  std::vector<Angle> pmCoefs = m_target->pmCoefs();
215  std::vector<double> pmNutPrecCoefs = m_target->pmNutPrecCoefs();
216 
217  const QChar degChar(0260);
218 
219  QString coefLetter = m_target->naifPlanetSystemName().at(0);
220 
221  if (pmCoefs[1].degrees() < 0.0 ) {
222  pmString.append(tr("%1%3 - %2d").arg(pmCoefs[0].degrees()).arg(-pmCoefs[1].degrees())
223  .arg(degChar));
224  }
225  else if (pmCoefs[1].degrees() > 0.0 ) {
226  pmString.append(tr("%1%3 + %2d").arg(pmCoefs[0].degrees()).arg(pmCoefs[1].degrees())
227  .arg(degChar));
228  }
229 
230  if (pmCoefs[2].degrees() < 0.0 ) {
231  pmString.append(tr(" - %2d^2").arg(-pmCoefs[2].degrees()));
232  }
233  else if (pmCoefs[2].degrees() > 0.0 ) {
234  pmString.append(tr(" + %2d^2").arg(pmCoefs[2].degrees()));
235  }
236 
237  QString tmp;
238  int nCoefs = pmNutPrecCoefs.size();
239 
240  for (int i = 0; i < nCoefs; i++) {
241  if (pmNutPrecCoefs[i] < 0.0 ) {
242  tmp.append(tr(" - %1%2%3").arg(-pmNutPrecCoefs[i]).arg("sin %1").arg(coefLetter).arg(i+1));
243  }
244  else if (pmNutPrecCoefs[i] > 0.0 ) {
245  tmp.append(tr(" + %1%2%3").arg(pmNutPrecCoefs[i]).arg("sin %1").arg(coefLetter).arg(i+1));
246  }
247  } //end-for
248 
249  pmString.append(tmp);
250  return pmString;
251 
252  }//end outer-if
253  else {
254  errorMsg();
255  return pmString;
256  } //end outer else
257 
258  }
259 
260 
261 
268 
269  QFont font;
270  font.setPointSize(9);
271  font.setBold(true);
272  font.setWeight(75);
273  m_ui->label->setFont(font);
274  m_ui->label_6->setFont(font);
275 
276  QString msg1="";
277  QString msg2="";
278 
279  m_ui->label->setFont(font);
280  m_ui->label_6->setFont(font);
281  m_ui->label_2->clear();
282 
283  if (m_target->displayProperties()->displayName() == "MOON") {
284  msg1 = "Target body parameters cannot be solved for the Moon.";
285  }
286  else {
287  msg2 = "Target body information\n"
288  "is not on the cube labels.\n"
289  "This has no impact on most\n"
290  "operations. However, to view\n"
291  "or bundle adjust the target body\n"
292  "parameters you will need to rerun\n"
293  "spiceinit.";
294 
295  m_ui->label->setText(
296  QApplication::translate("TargetInfoWidget",
297  msg2.toLatin1().data(), 0));
298  m_ui->label_6->setText(
299  QApplication::translate("TargetInfoWidget",
300  msg2.toLatin1().data(), 0));
301  } //end inner-else
302 
303  }
304 }
Isis specific code for binary pck.
TargetBody * m_target
The target whose information is being displayed.
void errorMsg()
Displays an error message on the Prime Meridian/Pole Position tabs of the TargetInfoWidget in the eve...
Container class for TargetBody.
Definition: TargetBody.h:80
File name manipulation and expansion.
Definition: FileName.h:116
TargetInfoWidget(TargetBody *target, Directory *directory, QWidget *parent=0)
Constructor.
int frameType()
Returns the frame type.
Definition: TargetBody.cpp:223
std::vector< Angle > poleDecCoefs()
Returns coefficients of a quadratic polynomial fitting pole dec.
Definition: TargetBody.cpp:241
QString naifPlanetSystemName() const
This returns the body name of the target&#39;s planet system.
Definition: TargetBody.cpp:327
QString displayName() const
Returns the display name.
TargetBodyDisplayProperties * displayProperties()
Gets TargetBodyDisplayProperties.
Definition: TargetBody.cpp:195
std::vector< double > poleDecNutPrecCoefs()
TargetBody::poleDecNutPrecCoefs.
Definition: TargetBody.cpp:268
double kilometers() const
Get the distance in kilometers.
Definition: Distance.cpp:118
std::vector< double > poleRaNutPrecCoefs()
Returns coefficients of pole right ascension nut/prec terms.
Definition: TargetBody.cpp:259
Isis specific code for unknown frame type.
~TargetInfoWidget()
Destructor.
QString formatPmString()
Make the polePMOffsetLabel text using information from the target.
Distance meanRadius() const
Returns the mean radius.
Definition: TargetBody.cpp:397
QString formatPoleRaString()
Make the poleRightAscensionLabel text using information from the target.
std::vector< double > pmNutPrecCoefs()
Returns coefficients of the prime meridian nut/prec terms.
Definition: TargetBody.cpp:277
Widget for displaying information about a target.
QString formatPoleDecString()
Make the poleDeclinationLabel text using information from the target.
Ui::TargetInfoWidget * m_ui
The widget&#39;s ui.
std::vector< Angle > poleRaCoefs()
TargetBody::poleRaCoefs.
Definition: TargetBody.cpp:232
Distance radiusA() const
Returns "a" radius.
Definition: TargetBody.cpp:337
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Distance radiusB() const
Returns "b" radius.
Definition: TargetBody.cpp:357
std::vector< Angle > pmCoefs()
Returns coefficients of a quadratic polynomial fitting pole pm.
Definition: TargetBody.cpp:250
Distance radiusC() const
Returns the "c" radius.
Definition: TargetBody.cpp:377