Isis 3.0 Programmer Reference
Back | Home
BundleObservationSolveSettings.cpp
2 
3 #include <QDataStream>
4 #include <QDebug>
5 #include <QFile>
6 #include <QList>
7 #include <QSet>
8 #include <QString>
9 #include <QUuid>
10 #include <QXmlInputSource>
11 #include <QXmlStreamWriter>
12 
13 // in the hdf5 library
14 #include <hdf5.h>
15 #include <hdf5_hl.h>
16 #include <H5Cpp.h>
17 
18 #include "BundleImage.h"
19 #include "Camera.h"
20 #include "FileName.h"
21 #include "IException.h"
22 #include "IString.h"
23 #include "Project.h"
24 #include "PvlKeyword.h"
25 #include "PvlObject.h"
26 #include "XmlStackedHandlerReader.h"
27 
28 
29 namespace Isis {
30 
35  initialize();
36  }
37 
38 
47  Project *project,
48  XmlStackedHandlerReader *xmlReader) {
49  initialize();
50  xmlReader->pushContentHandler(new XmlHandler(this, project));
51  xmlReader->setErrorHandler(new XmlHandler(this, project));
52  }
53 
54 
55 #if 0
56 
63  FileName xmlFile,
64  Project *project,
65  XmlStackedHandlerReader *xmlReader) {
66 
67  initialize();
68  QString xmlPath = xmlFile.expanded();
69  QFile qXmlFile(xmlPath);
70  if (!qXmlFile.open(QFile::ReadOnly) ) {
72  QString("Unable to open xml file, [%1], with read access").arg(xmlPath),
73  _FILEINFO_);
74  }
75 
76  QXmlInputSource xmlInputSource(&qXmlFile);
77  xmlReader->pushContentHandler(new XmlHandler(this, project));
78  xmlReader->setErrorHandler(new XmlHandler(this, project));
79  bool success = xmlReader->parse(xmlInputSource);
80  if (!success) {
81  throw IException(IException::Unknown,
82  QString("Failed to parse xml file, [%1]").arg(xmlPath),
83  _FILEINFO_);
84  }
85  }
86 #endif
87 
88 
89 // BundleObservationSolveSettings::BundleObservationSolveSettings(const BundleObservationSolveSettings &other)
90 // : m_id(new QUuid(other.m_id->toString())),
91 // m_instrumentId(other.m_instrumentId),
92 // m_instrumentPointingSolveOption(other.m_instrumentPointingSolveOption),
93 // m_numberCamAngleCoefSolved(other.m_numberCamAngleCoefSolved),
94 // m_ckDegree(other.m_ckDegree),
95 // m_ckSolveDegree(other.m_ckSolveDegree),
96 // m_solveTwist(other.m_solveTwist),
97 // m_solvePointingPolynomialOverExisting(other.m_solvePointingPolynomialOverExisting),
98 // m_anglesAprioriSigma(other.m_anglesAprioriSigma),
99 // m_pointingInterpolationType(other.m_pointingInterpolationType),
100 // m_instrumentPositionSolveOption(other.m_instrumentPositionSolveOption),
101 // m_numberCamPosCoefSolved(other.m_numberCamPosCoefSolved),
102 // m_spkDegree(other.m_spkDegree),
103 // m_spkSolveDegree(other.m_spkSolveDegree),
104 // m_solvePositionOverHermiteSpline(other.m_solvePositionOverHermiteSpline),
105 // m_positionAprioriSigma(other.m_positionAprioriSigma),
106 // m_positionInterpolationType(other.m_positionInterpolationType) {
107 // }
114 
115  m_id = NULL;
116  m_id = new QUuid(other.m_id->toString());
117  // TODO: add check to all copy constructors (verify other.xxx is not null) and operator= ???
118  // or intit all variables in all constructors
119 
124  m_ckDegree = other.m_ckDegree;
126  m_solveTwist = other.m_solveTwist;
132  m_spkDegree = other.m_spkDegree;
137  }
138 
139 
144 
145  delete m_id;
146  m_id = NULL;
147 
148  }
149 
150 
161  if (&other != this) {
162  delete m_id;
163  m_id = NULL;
164  m_id = new QUuid(other.m_id->toString());
165 
168 
169  // pointing related
172  m_ckDegree = other.m_ckDegree;
174  m_solveTwist = other.m_solveTwist;
178 
179  // position related
182  m_spkDegree = other.m_spkDegree;
187 
188  }
189 
190  return *this;
191 
192  }
193 
194 
199  m_id = NULL;
200  m_id = new QUuid(QUuid::createUuid());
201 
202  m_instrumentId = "";
203 
204  // Camera Pointing Options
205  // Defaults:
206  // m_instrumentPointingSolveOption = AnglesOnly;
207  // m_numberCamAngleCoefSolved = 1; // AnglesOnly;
208  // m_ckDegree = 2;
209  // m_ckSolveDegree = 2;
210  // m_solveTwist = true;
211  // m_solvePointingPolynomialOverExisting = false;
212  // m_pointingInterpolationType = SpiceRotation::PolyFunction;
213  // m_anglesAprioriSigma.append(Isis::Null); // num cam angle
214  // coef = 1
215  setInstrumentPointingSettings(AnglesOnly, true, 2, 2, false);
216 
217  // Spacecraft Position Options
218  // Defaults:
219  // m_instrumentPositionSolveOption = NoPositionFactors;
220  // m_numberCamPosCoefSolved = 0; // NoPositionFactors;
221  // m_spkDegree = 2;
222  // m_spkSolveDegree = 2;
223  // m_solvePositionOverHermiteSpline = false;
224  // m_positionInterpolationType = SpicePosition::PolyFunction;
225  // m_positionAprioriSigma.clear();
227 
228  }
229 
230 
231  // =============================================================================================//
232  // =============================================================================================//
233  // =============================================================================================//
234 
242  }
243 
244 
251  return m_instrumentId;
252  }
253 
254 
263  m_observationNumbers.insert(observationNumber);
264  }
265 
266 
273  return m_observationNumbers;
274  }
275 
276 
277  // =============================================================================================//
278  // ======================== Camera Pointing Options ============================================//
279  // =============================================================================================//
280 
281 
294  if (option.compare("NONE", Qt::CaseInsensitive) == 0) {
296  }
297  else if (option.compare("NoPointingFactors", Qt::CaseInsensitive) == 0) {
299  }
300  else if (option.compare("ANGLES", Qt::CaseInsensitive) == 0) {
302  }
303  else if (option.compare("AnglesOnly", Qt::CaseInsensitive) == 0) {
305  }
306  else if (option.compare("VELOCITIES", Qt::CaseInsensitive) == 0) {
308  }
309  else if (option.compare("AnglesAndVelocity", Qt::CaseInsensitive) == 0) {
311  }
312  else if (option.compare("ACCELERATIONS", Qt::CaseInsensitive) == 0) {
314  }
315  else if (option.compare("AnglesVelocityAndAcceleration", Qt::CaseInsensitive) == 0) {
317  }
318  else if (option.compare("ALL", Qt::CaseInsensitive) == 0) {
320  }
321  else if (option.compare("AllPolynomialCoefficients", Qt::CaseInsensitive) == 0) {
323  }
324  else {
326  "Unknown bundle instrument pointing solve option " + option + ".",
327  _FILEINFO_);
328  }
329  }
330 
331 
344  if (option == NoPointingFactors) return "None";
345  else if (option == AnglesOnly) return "AnglesOnly";
346  else if (option == AnglesVelocity) return "AnglesAndVelocity";
347  else if (option == AnglesVelocityAcceleration) return "AnglesVelocityAndAcceleration";
348  else if (option == AllPointingCoefficients) return "AllPolynomialCoefficients";
350  "Unknown pointing solve option enum [" + toString(option) + "].",
351  _FILEINFO_);
352  }
353 
354 
370  bool solveTwist,
371  int ckDegree,
372  int ckSolveDegree,
373  bool solvePolynomialOverExisting,
374  double anglesAprioriSigma,
375  double angularVelocityAprioriSigma,
376  double angularAccelerationAprioriSigma) {
377 
378  // automatically set the solve option and ck degree to the user entered values
380 
381  // the ck solve degree entered is only used if we are solving for all coefficients
382  // otherwise it defaults to 2.
383  if (option == AllPointingCoefficients) {
384  // update spkDegree and spkSolveDegree
387 
388  // we are solving for (solve degree + 1) coefficients
389  // this is the maximum number of apriori sigmas allowed
391  }
392  else {
393  // let spkDegree and spkSolveDegree default to 2, 2
394  m_ckDegree = 2;
395  m_ckSolveDegree = 2;
396 
397  // solve for the appropriate number of coefficients, based on solve option enum
398  m_numberCamAngleCoefSolved = ((int) option);
399  }
400 
401  m_anglesAprioriSigma.clear();
402  if (m_numberCamAngleCoefSolved > 0) {
403  if (anglesAprioriSigma > 0.0) {
404  m_anglesAprioriSigma.append(anglesAprioriSigma);
405  }
406  else {
408  }
409 
410  if (m_numberCamAngleCoefSolved > 1) {
411  if (angularVelocityAprioriSigma > 0.0) {
412  m_anglesAprioriSigma.append(angularVelocityAprioriSigma);
413  }
414  else {
416  }
417 
418  if (m_numberCamAngleCoefSolved > 2) {
419  if (angularAccelerationAprioriSigma > 0.0) {
420  m_anglesAprioriSigma.append(angularAccelerationAprioriSigma);
421  }
422  else {
424  }
425  }
426  }
427  }
428 
429  m_solveTwist = solveTwist; // dependent on solve option???
430 
431  // Set the SpiceRotation interpolation type enum appropriately
432  m_solvePointingPolynomialOverExisting = solvePolynomialOverExisting;
435  }
436  else {
438  }
439 
440  }
441 
442 
452  }
453 
454 
461  return m_solveTwist;
462  }
463 
464 
471  return m_ckDegree;
472  }
473 
474 
482  return m_ckSolveDegree;
483  }
484 
485 
493  }
494 
495 
504  }
505 
506 
513  return m_anglesAprioriSigma;
514  }
515 
516 
524  }
525 
526 
527  // =============================================================================================//
528  // ======================== Spacecraft Position Options ========================================//
529  // =============================================================================================//
530 
531 
544  if (option.compare("NONE", Qt::CaseInsensitive) == 0) {
546  }
547  else if (option.compare("NoPositionFactors", Qt::CaseInsensitive) == 0) {
549  }
550  else if (option.compare("POSITIONS", Qt::CaseInsensitive) == 0) {
552  }
553  else if (option.compare("PositionOnly", Qt::CaseInsensitive) == 0) {
555  }
556  else if (option.compare("VELOCITIES", Qt::CaseInsensitive) == 0) {
558  }
559  else if (option.compare("PositionAndVelocity", Qt::CaseInsensitive) == 0) {
561  }
562  else if (option.compare("ACCELERATIONS", Qt::CaseInsensitive) == 0) {
564  }
565  else if (option.compare("PositionVelocityAndAcceleration", Qt::CaseInsensitive) == 0) {
567  }
568  else if (option.compare("ALL", Qt::CaseInsensitive) == 0) {
570  }
571  else if (option.compare("AllPolynomialCoefficients", Qt::CaseInsensitive) == 0) {
573  }
574  else {
576  "Unknown bundle instrument position solve option " + option + ".",
577  _FILEINFO_);
578  }
579  }
580 
581 
594  if (option == NoPositionFactors) return "None";
595  else if (option == PositionOnly) return "PositionOnly";
596  else if (option == PositionVelocity) return "PositionAndVelocity";
597  else if (option == PositionVelocityAcceleration) return "PositionVelocityAndAcceleration";
598  else if (option == AllPositionCoefficients) return "AllPolynomialCoefficients";
600  "Unknown position solve option enum [" + toString(option) + "].",
601  _FILEINFO_);
602  }
603 
604 
619  int spkDegree,
620  int spkSolveDegree,
621  bool positionOverHermite,
622  double positionAprioriSigma,
623  double velocityAprioriSigma,
624  double accelerationAprioriSigma) {
625  // automatically set the solve option and spk degree to the user entered values
627 
628  // the spk solve degree entered is only used if we are solving for all coefficients
629  // otherwise it defaults to 2.
630  if (option == AllPositionCoefficients) {
631  // update spkDegree and spkSolveDegree
634  // we are solving for (solve degree + 1) coefficients
635  // this is the maximum number of apriori sigmas allowed
637  }
638  else {
639  // let spkDegree and spkSolveDegree default to 2, 2
640  m_spkDegree = 2;
641  m_spkSolveDegree = 2;
642 
643  // solve for the appropriate number of coefficients, based on solve option enum
644  m_numberCamPosCoefSolved = ((int) option);
645  }
646 
647  m_positionAprioriSigma.clear();
648  if (m_numberCamPosCoefSolved > 0) {
649  if (positionAprioriSigma > 0.0) {
650  m_positionAprioriSigma.append(positionAprioriSigma);
651  }
652  else {
654  }
655 
656  if (m_numberCamPosCoefSolved > 1) {
657  if (velocityAprioriSigma > 0.0) {
658  m_positionAprioriSigma.append(velocityAprioriSigma);
659  }
660  else {
662  }
663 
664  if (m_numberCamPosCoefSolved > 2) {
665  if (accelerationAprioriSigma > 0.0) {
666  m_positionAprioriSigma.append(accelerationAprioriSigma);
667  }
668  else {
670  }
671  }
672  }
673  }
674 
675  // Set the SpicePosition interpolation type enum appropriately
676  m_solvePositionOverHermiteSpline = positionOverHermite;
679  }
680  else {
682  }
683 
684  }
685 
686 
696  }
697 
698 
705  return m_spkDegree;
706  }
707 
708 
716  return m_spkSolveDegree;
717  }
718 
719 
727  }
728 
729 
738  }
739 
740 
747  return m_positionAprioriSigma;
748  }
749 
750 
758  }
759 
760 
761  // =============================================================================================//
762  // =============================================================================================//
763  // =============================================================================================//
764 
765 
774 
775  QString pvlName = "";;
776  if (name == "") {
777  pvlName = instrumentId();
778  }
779  else {
780  pvlName = name;
781  }
782  PvlObject pvl(pvlName);
783 
784  pvl += PvlKeyword("InstrumentPointingSolveOption",
787  pvl += PvlKeyword("NumberAngleCoefficientsSolved",
789  pvl += PvlKeyword("CKDegree", toString(ckDegree()));
790  pvl += PvlKeyword("CKSolveDegree", toString(ckSolveDegree()));
791  pvl += PvlKeyword("SolveTwist", toString(solveTwist()));
792  pvl += PvlKeyword("SolvePointingPolynomialOverExisting",
794  PvlKeyword angleSigmas("AngleAprioriSigmas");
795  for (int i = 0; i < aprioriPointingSigmas().size(); i++) {
797  angleSigmas.addValue("N/A");
798  }
799  else {
800  angleSigmas.addValue(toString(m_anglesAprioriSigma[i]));
801  }
802  }
803  pvl += angleSigmas;
804 
805  pvl += PvlKeyword("InstrumentPointingInterpolationType",
807  // TODO: omit from pvl if pointing option == None ???
808  }
809  else {
810  pvl += PvlKeyword("NumberAngleCoefficientsSolved", "N/A");
811  pvl += PvlKeyword("CKDegree", "N/A");
812  pvl += PvlKeyword("CKSolveDegree", "N/A");
813  pvl += PvlKeyword("SolveTwist", "N/A");
814  pvl += PvlKeyword("SolvePointingPolynomialOverExisting", "N/A");
815  pvl += PvlKeyword("AngleAprioriSigmas", "N/A");
816  pvl += PvlKeyword("InstrumentPointingInterpolationType", "N/A");
817  }
818 
819 
820  // position
821 
822  pvl += PvlKeyword("InstrumentPositionSolveOption",
825  pvl += PvlKeyword("NumberPositionCoefficientsSolved",
827  pvl += PvlKeyword("SPKDegree", toString(spkDegree()));
828  pvl += PvlKeyword("SPKSolveDegree", toString(spkSolveDegree()));
829  pvl += PvlKeyword("SolvePositionOverHermiteSpline", toString(solvePositionOverHermite()));
830 
831  PvlKeyword positionSigmas("PositionAprioriSigmas");
832  for (int i = 0; i < aprioriPositionSigmas().size(); i++) {
834  positionSigmas.addValue("N/A");
835  }
836  else {
837  positionSigmas.addValue(toString(m_positionAprioriSigma[i]));
838  }
839  }
840  pvl += positionSigmas;
841 
842  pvl += PvlKeyword("InstrumentPositionInterpolationType",
844  }
845  else {
846  pvl += PvlKeyword("NumberPositionCoefficientsSolved", "N/A");
847  pvl += PvlKeyword("SPKDegree", "N/A");
848  pvl += PvlKeyword("SPKSolveDegree", "N/A");
849  pvl += PvlKeyword("SolvePositionOverHermiteSpline", "N/A");
850  pvl += PvlKeyword("PositionAprioriSigmas", "N/A");
851  pvl += PvlKeyword("InstrumentPositionInterpolationType", "N/A");
852  }
853  return pvl;
854  }
855 
856 
866  void BundleObservationSolveSettings::save(QXmlStreamWriter &stream,
867  const Project *project) const {
868 
869  stream.writeStartElement("bundleObservationSolveSettings");
870  stream.writeTextElement("id", m_id->toString());
871  stream.writeTextElement("instrumentId", instrumentId());
872 
873  // pointing related
874  stream.writeStartElement("instrumentPointingOptions");
875  stream.writeAttribute("solveOption",
877  stream.writeAttribute("numberCoefSolved", toString(m_numberCamAngleCoefSolved));
878  stream.writeAttribute("degree", toString(m_ckDegree));
879  stream.writeAttribute("solveDegree", toString(m_ckSolveDegree));
880  stream.writeAttribute("solveTwist", toString(m_solveTwist));
881  stream.writeAttribute("solveOverExisting", toString(m_solvePointingPolynomialOverExisting));
882  stream.writeAttribute("interpolationType", toString(m_pointingInterpolationType));
883 
884  stream.writeStartElement("aprioriPointingSigmas");
885  for (int i = 0; i < m_anglesAprioriSigma.size(); i++) {
887  stream.writeTextElement("sigma", "N/A");
888  }
889  else {
890  stream.writeTextElement("sigma", toString(m_anglesAprioriSigma[i]));
891  }
892  }
893  stream.writeEndElement();// end aprioriPointingSigmas
894  stream.writeEndElement();// end instrumentPointingOptions
895 
896  // position related
897  stream.writeStartElement("instrumentPositionOptions");
898  stream.writeAttribute("solveOption",
900  stream.writeAttribute("numberCoefSolved", toString(m_numberCamPosCoefSolved));
901  stream.writeAttribute("degree", toString(m_spkDegree));
902  stream.writeAttribute("solveDegree", toString(m_spkSolveDegree));
903  stream.writeAttribute("solveOverHermiteSpline", toString(m_solvePositionOverHermiteSpline));
904  stream.writeAttribute("interpolationType", toString(m_positionInterpolationType));
905 
906  stream.writeStartElement("aprioriPositionSigmas");
907  for (int i = 0; i < m_positionAprioriSigma.size(); i++) {
909  stream.writeTextElement("sigma", "N/A");
910  }
911  else {
912  stream.writeTextElement("sigma", toString(m_positionAprioriSigma[i]));
913  }
914  }
915  stream.writeEndElement();// end aprioriPositionSigmas
916  stream.writeEndElement(); // end instrumentPositionOptions
917 
918  stream.writeEndElement(); // end bundleObservationSolveSettings
919 
920  }
921 
922 
933  Project *project) {
934  m_xmlHandlerObservationSettings = settings;
935  m_xmlHandlerProject = project; // TODO: does xml stuff need project???
936  m_xmlHandlerCharacters = "";
937  }
938 
939 
944  // do not delete this pointer... we don't own it, do we???
945  // passed into StatCumProbDistDynCalc constructor as pointer
946  // delete m_xmlHandlerProject; // TODO: does xml stuff need project???
947  m_xmlHandlerProject = NULL;
948  }
949 
950 
963  const QString &localName,
964  const QString &qName,
965  const QXmlAttributes &atts) {
966  m_xmlHandlerCharacters = "";
967  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
968  if (localName == "instrumentPointingOptions") {
969 
970  QString pointingSolveOption = atts.value("solveOption");
971  if (!pointingSolveOption.isEmpty()) {
972  m_xmlHandlerObservationSettings->m_instrumentPointingSolveOption
973  = stringToInstrumentPointingSolveOption(pointingSolveOption);
974  }
975 
976  QString numberCoefSolved = atts.value("numberCoefSolved");
977  if (!numberCoefSolved.isEmpty()) {
978  m_xmlHandlerObservationSettings->m_numberCamAngleCoefSolved = toInt(numberCoefSolved);
979  }
980 
981  QString ckDegree = atts.value("degree");
982  if (!ckDegree.isEmpty()) {
983  m_xmlHandlerObservationSettings->m_ckDegree = toInt(ckDegree);
984  }
985 
986  QString ckSolveDegree = atts.value("solveDegree");
987  if (!ckSolveDegree.isEmpty()) {
988  m_xmlHandlerObservationSettings->m_ckSolveDegree = toInt(ckSolveDegree);
989  }
990 
991  QString solveTwist = atts.value("solveTwist");
992  if (!solveTwist.isEmpty()) {
993  m_xmlHandlerObservationSettings->m_solveTwist = toBool(solveTwist);
994  }
995 
996  QString solveOverExisting = atts.value("solveOverExisting");
997  if (!solveOverExisting.isEmpty()) {
998  m_xmlHandlerObservationSettings->m_solvePointingPolynomialOverExisting =
999  toBool(solveOverExisting);
1000  }
1001 
1002  QString interpolationType = atts.value("interpolationType");
1003  if (!interpolationType.isEmpty()) {
1004  m_xmlHandlerObservationSettings->m_pointingInterpolationType =
1005  SpiceRotation::Source(toInt(interpolationType));
1006  }
1007 
1008  }
1009  else if (localName == "aprioriPointingSigmas") {
1010  m_xmlHandlerAprioriSigmas.clear();
1011  }
1012  else if (localName == "instrumentPositionOptions") {
1013 
1014  QString positionSolveOption = atts.value("solveOption");
1015  if (!positionSolveOption.isEmpty()) {
1016  m_xmlHandlerObservationSettings->m_instrumentPositionSolveOption
1017  = stringToInstrumentPositionSolveOption(positionSolveOption);
1018  }
1019 
1020  QString numberCoefSolved = atts.value("numberCoefSolved");
1021  if (!numberCoefSolved.isEmpty()) {
1022  m_xmlHandlerObservationSettings->m_numberCamPosCoefSolved = toInt(numberCoefSolved);
1023  }
1024 
1025  QString spkDegree = atts.value("degree");
1026  if (!spkDegree.isEmpty()) {
1027  m_xmlHandlerObservationSettings->m_spkDegree = toInt(spkDegree);
1028  }
1029 
1030  QString spkSolveDegree = atts.value("solveDegree");
1031  if (!spkSolveDegree.isEmpty()) {
1032  m_xmlHandlerObservationSettings->m_spkSolveDegree = toInt(spkSolveDegree);
1033  }
1034 
1035  QString solveOverHermiteSpline = atts.value("solveOverHermiteSpline");
1036  if (!solveOverHermiteSpline.isEmpty()) {
1037  m_xmlHandlerObservationSettings->m_solvePositionOverHermiteSpline =
1038  toBool(solveOverHermiteSpline);
1039  }
1040 
1041  QString interpolationType = atts.value("interpolationType");
1042  if (!interpolationType.isEmpty()) {
1043  m_xmlHandlerObservationSettings->m_positionInterpolationType =
1044  SpicePosition::Source(toInt(interpolationType));
1045  }
1046  }
1047  else if (localName == "aprioriPositionSigmas") {
1048  m_xmlHandlerAprioriSigmas.clear();
1049  }
1050  }
1051  return true;
1052  }
1053 
1054 
1064  m_xmlHandlerCharacters += ch;
1065  return XmlStackedHandler::characters(ch);
1066  }
1067 
1068 
1080  const QString &localName,
1081  const QString &qName) {
1082  if (!m_xmlHandlerCharacters.isEmpty()) {
1083  if (localName == "id") {
1084  m_xmlHandlerObservationSettings->m_id = NULL;
1085  m_xmlHandlerObservationSettings->m_id = new QUuid(m_xmlHandlerCharacters);
1086  }
1087  else if (localName == "instrumentId") {
1088  m_xmlHandlerObservationSettings->setInstrumentId(m_xmlHandlerCharacters);
1089  }
1090 // else if (localName == "bundleObservationSolveSettings") {
1091 // // end tag for this entire class... how to get out???
1092 // // call parse, as in Control List???
1093 // }
1094  else if (localName == "sigma") {
1095  m_xmlHandlerAprioriSigmas.append(m_xmlHandlerCharacters);
1096  }
1097  else if (localName == "aprioriPointingSigmas") {
1098  m_xmlHandlerObservationSettings->m_anglesAprioriSigma.clear();
1099  for (int i = 0; i < m_xmlHandlerAprioriSigmas.size(); i++) {
1100  if (m_xmlHandlerAprioriSigmas[i] == "N/A") {
1101  m_xmlHandlerObservationSettings->m_anglesAprioriSigma.append(Isis::Null);
1102  }
1103  else {
1104  m_xmlHandlerObservationSettings->m_anglesAprioriSigma.append(
1105  toDouble(m_xmlHandlerAprioriSigmas[i]));
1106  }
1107  }
1108  }
1109  else if (localName == "aprioriPositionSigmas") {
1110  m_xmlHandlerObservationSettings->m_positionAprioriSigma.clear();
1111  for (int i = 0; i < m_xmlHandlerAprioriSigmas.size(); i++) {
1112  if (m_xmlHandlerAprioriSigmas[i] == "N/A") {
1113  m_xmlHandlerObservationSettings->m_positionAprioriSigma.append(Isis::Null);
1114  }
1115  else {
1116  m_xmlHandlerObservationSettings->m_positionAprioriSigma.append(
1117  toDouble(m_xmlHandlerAprioriSigmas[i]));
1118  }
1119  }
1120  }
1121  m_xmlHandlerCharacters = "";
1122  }
1123  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
1124  }
1125 
1126 
1132  QDataStream &BundleObservationSolveSettings::write(QDataStream &stream) const {
1133 
1134  stream << m_id->toString()
1135  << m_instrumentId
1137  << (qint32)m_numberCamAngleCoefSolved
1138  << (qint32)m_ckDegree
1139  << (qint32)m_ckSolveDegree
1140  << m_solveTwist
1143  << (qint32)m_pointingInterpolationType
1145  << (qint32)m_numberCamPosCoefSolved
1146  << (qint32)m_spkDegree
1147  << (qint32)m_spkSolveDegree
1150  << (qint32)m_positionInterpolationType;
1151 
1152  return stream;
1153 
1154  }
1155 
1156 
1162  QDataStream &BundleObservationSolveSettings::read(QDataStream &stream) {
1163 
1164  QString id;
1165  qint32 anglesSolveOption, ckDegree, ckSolveDegree, numCamAngleCoefSolved, anglesInterpType,
1166  positionSolveOption, spkDegree, spkSolveDegree, numCamPosCoefSolved, positionInterpType;
1167 
1168  stream >> id
1169  >> m_instrumentId
1170  >> anglesSolveOption
1171  >> numCamAngleCoefSolved
1172  >> ckDegree
1173  >> ckSolveDegree
1174  >> m_solveTwist
1177  >> anglesInterpType
1178  >> positionSolveOption
1179  >> numCamPosCoefSolved
1180  >> spkDegree
1181  >> spkSolveDegree
1184  >> positionInterpType;
1185 
1186  delete m_id;
1187  m_id = NULL;
1188  m_id = new QUuid(id);
1189 
1191  m_ckDegree = (int)ckDegree;
1192  m_ckSolveDegree = (int)ckSolveDegree;
1193  m_numberCamAngleCoefSolved = (int)numCamAngleCoefSolved;
1196  m_spkDegree = (int)spkDegree;
1197  m_spkSolveDegree = (int)spkSolveDegree;
1198  m_numberCamPosCoefSolved = (int)numCamPosCoefSolved;
1199  m_positionInterpolationType = (SpicePosition::Source)positionInterpType;
1200 
1201  return stream;
1202 
1203  }
1204 
1205 
1217  QDataStream &operator<<(QDataStream &stream, const BundleObservationSolveSettings &settings) {
1218  return settings.write(stream);
1219  }
1220 
1221 
1231  QDataStream &operator>>(QDataStream &stream, BundleObservationSolveSettings &settings) {
1232  return settings.read(stream);
1233  }
1234 
1235 
1236 #if 0
1237 
1241  H5::CompType BundleObservationSolveSettings::compoundH5DataType() {
1242 
1243  H5::CompType compoundDataType((size_t) );
1244 
1245  size_t offset = 0;
1246 
1247  compoundDataType.insertMember("InstrumentId", offset, H5::PredType::C_S1);
1248 
1249  offset += sizeof(m_instrumentId);
1250  compoundDataType.insertMember("InstrumentPointingSolveOption", offset, H5::PredType::NATIVE_INT);
1251 
1252  offset += sizeof(m_instrumentId);
1253  compoundDataType.insertMember("NumCamAngleCoefSolved", offset, H5::PredType::NATIVE_INT);
1254 
1255  offset += sizeof(m_instrumentId);
1256  compoundDataType.insertMember("CkDegree", offset, H5::PredType::NATIVE_INT);
1257 
1258  offset += sizeof(m_instrumentId);
1259  compoundDataType.insertMember("CkSolveDegree", offset, H5::PredType::NATIVE_INT);
1260 
1261  offset += sizeof(m_instrumentId);
1262  compoundDataType.insertMember("SolveTwist", offset, H5::PredType::NATIVE_HBOOL);
1263 
1264  offset += sizeof(m_instrumentId);
1265  compoundDataType.insertMember("SolvePointingPolynomialOverExisting", offset, H5::PredType::NATIVE_HBOOL);
1266 
1267  offset += sizeof(m_instrumentId);
1268 ??? compoundDataType.insertMember("AnglesAprioriSigma", offset, H5::PredType::NATIVE_DOUBLE);
1269 
1270  offset += sizeof(m_instrumentId);
1271  compoundDataType.insertMember("PointingInterpolationType", offset, H5::PredType::NATIVE_INT);
1272 
1273  offset += sizeof(m_instrumentId);
1274  compoundDataType.insertMember("InstrumentPositionSolveOption", offset, H5::PredType::NATIVE_INT);
1275 
1276  offset += sizeof(m_instrumentId);
1277  compoundDataType.insertMember("NumCamPosCoefSolved", offset, H5::PredType::NATIVE_INT);
1278 
1279  offset += sizeof(m_numberCamPosCoefSolved);
1280  compoundDataType.insertMember("SpkDegree", offset, H5::PredType::NATIVE_INT);
1281 
1282  offset += sizeof(m_spkDegree);
1283  compoundDataType.insertMember("SpkSolveDegree", offset, H5::PredType::NATIVE_INT);
1284 
1285  offset += sizeof(m_spkSolveDegree);
1286  compoundDataType.insertMember("SolvePositionOverHermiteSpline", offset, H5::PredType::NATIVE_HBOOL);
1287 
1288  offset += sizeof(m_solvePositionOverHermiteSpline);
1289 ??? compoundDataType.insertMember("PositionAprioriSigma", offset, H5::PredType::NATIVE_DOUBLE);
1290 
1291  offset += sizeof(m_positionAprioriSigma);
1292  compoundDataType.insertMember("PositionInterpolationType", offset, H5::PredType::NATIVE_INT);
1293 
1294  return compoundDataType;
1295 
1296  }
1297 #endif
1298 }
void setInstrumentPositionSettings(InstrumentPositionSolveOption option, int spkDegree=2, int spkSolveDegree=2, bool positionOverHermite=false, double positionAprioriSigma=-1.0, double velocityAprioriSigma=-1.0, double accelerationAprioriSigma=-1.0)
Sets the instrument pointing settings.
static InstrumentPointingSolveOption stringToInstrumentPointingSolveOption(QString option)
Translates a QString InstrumentPointingSolveOption to its enumerated value.
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:109
The main project for cnetsuite.
Definition: Project.h:105
QList< double > aprioriPointingSigmas() const
Accesses the a priori pointing sigmas.
int spkSolveDegree() const
Accesses the degree of thecamera position polynomial being fit to in the bundle adjustment (spkSolveD...
int m_ckSolveDegree
Degree of the camera angles polynomial being fit to in the bundle adjustment.
File name manipulation and expansion.
Definition: FileName.h:111
Object is calculated from nth degree polynomial.
void save(QXmlStreamWriter &stream, const Project *project) const
Saves this BundleObservationSolveSettings to an xml stream.
QDataStream & read(QDataStream &stream)
Reads in the state of a BundleObservationSolveSettings from a stream.
int numberCameraAngleCoefficientsSolved() const
Accesses the number of camera angle coefficients in the solution.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
bool m_solvePositionOverHermiteSpline
The polynomial will be fit over an existing Hermite spline.
InstrumentPositionSolveOption instrumentPositionSolveOption() const
Accesses the instrument position solve option.
bool solvePositionOverHermite() const
Whether or not the polynomial for solving will be fit over an existing Hermite spline.
XmlHandler(BundleObservationSolveSettings *settings, Project *project)
Constructs an XmlHandler for serialization.
void initialize()
Initializes the default state of this BundleObservationSolveSettings.
int numberCameraPositionCoefficientsSolved() const
Accesses the number of camera position coefficients in the solution.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
Solve for pointing angles, their velocities and their accelerations.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:154
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:163
QString m_instrumentId
The spacecraft instrument id for this observation.
bool solveTwist() const
Accesses the flag for solving for twist.
int m_spkSolveDegree
Degree of the camera position polynomial being fit to in the bundle adjustment.
int m_numberCamAngleCoefSolved
The number of camera angle coefficients in solution.
BundleObservationSolveSettings()
Constructor with default parameter initializations.
QList< double > m_positionAprioriSigma
The instrument pointing a priori sigmas.
Solve for all coefficients in the polynomials fit to the instrument positions.
SpicePosition::Source m_positionInterpolationType
SpicePosition interpolation types.
void addObservationNumber(QString observationNumber)
Associates an observation number with these solve settings.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
bool m_solvePointingPolynomialOverExisting
The polynomial will be fit over the existing pointing polynomial.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:463
PvlObject pvlObject(QString name="") const
Serializes this BundleObservationSolveSettings into a PvlObject.
A single keyword-value pair.
Definition: PvlKeyword.h:98
static QString instrumentPointingSolveOptionToString(InstrumentPointingSolveOption option)
Tranlsates an enumerated InstrumentPointingSolveOption value to its string representation.
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:126
SpiceRotation::Source pointingInterpolationType() const
Accesses the SpiceRotation interpolation type for the instrument pointing.
int ckSolveDegree() const
Accesses the degree of the camera angles polynomial being fit to in the bundle adjustment (ckSolveDeg...
QDataStream & write(QDataStream &stream) const
Writes this BundleObservationSolveSettings to a stream.
Kernels plus nth degree polynomial.
InstrumentPointingSolveOption instrumentPointingSolveOption() const
Accesses the instrument pointing solve option.
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:199
Source
The rotation can come from one of 3 places for an Isis cube.
void setInstrumentId(QString instrumentId)
Sets the instrument id for this observation.
QList< double > aprioriPositionSigmas() const
Accesses the a priori position sigmas.
InstrumentPositionSolveOption m_instrumentPositionSolveOption
Option for how to solve for instrument position.
This class is used to modify and manage solve settings for 1 to many BundleObservations.
Solve for instrument positions, velocities, and accelerations.
QSet< QString > observationNumbers() const
Returns a list of observation numbers associated with these solve settings.
QList< double > m_anglesAprioriSigma
The image position a priori sigmas.The size of the list is equal to the number of coefficients in the...
Solve for pointing angles and their angular velocities.
int m_spkDegree
Degree of the polynomial fit to the original camera position.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
bool m_solveTwist
Solve for &quot;twist&quot; angle.
QString instrumentId() const
Accesses the instrument id for this observation.
InstrumentPointingSolveOption m_instrumentPointingSolveOption
Option for how to solve for instrument pointing.
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:53
int m_numberCamPosCoefSolved
The number of camera position coefficients in the solution.
Isis exception class.
Definition: IException.h:99
InstrumentPositionSolveOption
Options for how to solve for instrument position.
static InstrumentPositionSolveOption stringToInstrumentPositionSolveOption(QString option)
Translates a QString InstrumentPositionSolveOption to its enumerated value.
From nth degree polynomial.
Solve for all coefficients in the polynomials fit to the pointing angles.
InstrumentPointingSolveOption
Options for how to solve for instrument pointing.
SpiceRotation::Source m_pointingInterpolationType
SpiceRotation interpolation type.
QSet< QString > m_observationNumbers
Associated observation numbers for these settings.
SpicePosition::Source positionInterpolationType() const
Accesses the SpicePosition interpolation type for the spacecraft position.
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
static QString instrumentPositionSolveOptionToString(InstrumentPositionSolveOption option)
Translates an enumerated InstrumentPositionSolveOption to its string representation.
int m_ckDegree
Degree of the polynomial fit to the original camera angles.
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
bool solvePolyOverPointing() const
Whether or not the solve polynomial will be fit over the existing pointing polynomial.
his enables stack-based XML parsing of XML files.
Solve for pointing angles: right ascension, declination and, optionally, twist.
void setInstrumentPointingSettings(InstrumentPointingSolveOption option, bool solveTwist, int ckDegree=2, int ckSolveDegree=2, bool solvePolynomialOverExisting=false, double anglesAprioriSigma=-1.0, double angularVelocityAprioriSigma=-1.0, double angularAccelerationAprioriSigma=-1.0)
Sets the instrument pointing settings.
QUuid * m_id
A unique ID for this object (useful for others to reference this object when saving to disk)...
int spkDegree() const
Accesses the degree of the polynomial fit to the original camera position (spkDegree).
int ckDegree() const
Accesses the degree of polynomial fit to original camera angles (ckDegree).
Source
This enum indicates the status of the object.
void addValue(QString value, QString unit="")
Adds a value with units.
Definition: PvlKeyword.cpp:268
BundleObservationSolveSettings & operator=(const BundleObservationSolveSettings &src)
Assigns the state of another BundleObservationSolveSettings to this one.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:15:08