Isis 3 Programmer Reference
NaifDskApi.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "NaifDskApi.h"
8 
9 // Specs for convenient NAIF vectors and matrices
10 #include <tnt/tnt_array1d.h>
11 #include <tnt/tnt_array1d_utils.h>
12 #include <tnt/tnt_array2d.h>
13 #include <tnt/tnt_array2d_utils.h>
14 
15 #include "IString.h"
16 
17 namespace Isis {
28  bool validate(const NaifVertex &v) {
29  if ( 3 != v.dim1() ) return (false);
30  return (true);
31  }
32 
33 
34 
42  bool validate(const NaifTriangle &t) {
43  if ( 3 != t.dim1() ) return (false);
44  if ( 3 != t.dim2() ) return (false);
45  return (true);
46  }
47 
48 
49 
57  QDebug operator<<(QDebug dbg, const TNT::Array1D<SpiceDouble> &tntArray) {
58  dbg.nospace() << toString(tntArray);
59  return dbg;
60  }
61 
62 
63 
72  QDebug operator<<(QDebug dbg, const TNT::Array2D<SpiceDouble> &tntMatrix) {
73  for (int i = 0; i < tntMatrix.dim1(); i++) {
74  dbg.nospace() << " ";
75  for (int j = 0; j < tntMatrix.dim2(); j++) {
76  dbg.nospace() << toString(tntMatrix[i][j], 15) << " ";
77  }
78  dbg.nospace() << endl;
79  }
80  return dbg;
81  }
82 
83 
84 
95  QString toString(const TNT::Array1D<SpiceDouble> &naifArray, int precision) {
96  QString result = "( ";
97  for (int i = 0; i < naifArray.dim1(); i++) {
98  result += toString(naifArray[i], precision);
99  if (i != naifArray.dim1() - 1) result += ", ";
100  }
101  result += " )";
102  return result;
103  }
104 
105 
106 }
107 // namespace Isis
Isis::operator<<
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:314
Isis::NaifVertex
TNT::Array1D< SpiceDouble > NaifVertex
1-D Buffer[3]
Definition: NaifDskApi.h:47
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::NaifTriangle
TNT::Array2D< SpiceDouble > NaifTriangle
3-D triangle[3][3]
Definition: NaifDskApi.h:48
Isis::validate
bool validate(const NaifVertex &v)
Verifies that the given NaifVector or NaifVertex is 3 dimensional.
Definition: NaifDskApi.cpp:28
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16