9#include <xercesc/util/PlatformUtils.hpp>
10#include <xercesc/util/TransService.hpp>
11#include <xercesc/sax2/XMLReaderFactory.hpp>
13#include <nlohmann/json.hpp>
14using json = nlohmann::json;
17#include "IException.h"
19#include "IsisXMLChTrans.h"
21#include "Preference.h"
24#include "PvlKeyword.h"
33namespace XERCES = XERCES_CPP_NAMESPACE;
69 const QString &value) {
73 if(param->values.size() > 0) {
74 QString message =
"A value for this parameter [" + paramName +
"] has "
75 "already been entered.";
76 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
79 param->values.clear();
80 param->values.push_back(value);
96 const vector<QString> &value) {
100 if(param->values.size() > 0) {
101 QString message =
"A value for this parameter [" + paramName +
"] has "
102 "already been entered.";
103 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
106 param->values.resize(value.size());
107 param->values = value;
133 if(param->type !=
"string" && param->type !=
"combo") {
134 QString message =
"Parameter [" + paramName +
"] is not a string.";
135 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
138 if(param->values.size() > 0) {
139 QString message =
"A value for this parameter [" + paramName +
"] has "
140 "already been saved (possibly by IsisGui). If you need to "
141 "change the value use \"Clear\" before the Put.";
142 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
145 param->values.clear();
146 param->values.push_back(value);
162 const vector<QString> &value) {
166 if(param->type !=
"string" && param->type !=
"combo") {
167 QString message =
"Parameter [" + paramName +
"] is not a string.";
168 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
171 if(param->values.size() > 0) {
172 QString message =
"A value for this parameter [" + paramName +
"] has "
173 "already been saved (possibly by IsisGui). If you need to "
174 "change the value use \"Clear\" before the Put.";
175 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
178 param->values.resize(value.size());
179 param->values = value;
197 const QString &value) {
201 if((param->type !=
"filename") && (param->type !=
"cube")) {
202 QString message =
"Parameter [" + paramName +
"] is not a filename.";
203 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
206 if(param->values.size() > 0) {
207 QString message =
"A value for this parameter [" + paramName +
"] has "
208 "already been saved (possibly by IsisGui). If you need to "
209 "change the value use \"Clear\" before the Put.";
210 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
213 param->values.clear();
214 param->values.push_back(value);
239 const vector<QString> &value) {
243 if((param->type !=
"filename") && (param->type !=
"cube")) {
244 QString message =
"Parameter [" + paramName +
"] is not a filename.";
245 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
248 if(param->values.size() > 0) {
249 QString message =
"A value for this parameter [" + paramName +
"] has "
250 "already been saved (possibly by IsisGui). If you need to "
251 "change the value use \"Clear\" before the Put.";
252 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
255 param->values.resize(value.size());
256 param->values = value;
272 const QString &value) {
276 if(param->type !=
"cube") {
277 QString message =
"Parameter [" + paramName +
"] is not a cubename.";
278 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
281 if(param->values.size() > 0) {
282 QString message =
"A value for this parameter [" + paramName +
"] has "
283 "already been saved (possibly by IsisGui). If you need to "
284 "change the value use \"Clear\" before the Put.";
285 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
288 param->values.clear();
289 param->values.push_back(value);
314 if(param->type !=
"integer") {
315 QString message =
"Parameter [" + paramName +
"] is not an integer.";
316 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
319 if(param->values.size() > 0) {
320 QString message =
"A value for this parameter [" + paramName +
"] has "
321 "already been saved (possibly by IsisGui). If you need to "
322 "change the value use \"Clear\" before the Put.";
323 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
326 param->values.clear();
351 const vector<int> &value) {
355 if(param->type !=
"integer") {
356 QString message =
"Parameter [" + paramName +
"] is not an integer.";
357 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
360 if(param->values.size() > 0) {
361 QString message =
"A value for this parameter [" + paramName +
"] has "
362 "already been saved (possibly by IsisGui). If you need to "
363 "change the value use \"Clear\" before the Put.";
364 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
367 param->values.resize(value.size());
368 for(
unsigned int i = 0; i < value.size(); i++) {
394 const double &value) {
398 if(param->type !=
"double") {
399 QString message =
"Parameter [" + paramName +
"] is not a double.";
400 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
403 if(param->values.size() > 0) {
404 QString message =
"A value for this parameter [" + paramName +
"] has "
405 "already been saved (possibly by IsisGui). If you need to "
406 "change the value use \"Clear\" before the Put.";
407 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
410 param->values.clear();
435 const vector<double> &value) {
439 if(param->type !=
"double") {
440 QString message =
"Parameter [" + paramName +
"] is not a double.";
441 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
444 if(param->values.size() > 0) {
445 QString message =
"A value for this parameter [" + paramName +
"] has "
446 "already been saved (possibly by IsisGui). If you need to "
447 "change the value use \"Clear\" before the Put.";
448 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
451 param->values.resize(value.size());
452 for(
unsigned int i = 0; i < value.size(); i++) {
482 if(param->type !=
"boolean") {
483 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
484 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
487 if(param->values.size() > 0) {
488 QString message =
"A value for this parameter [" + paramName +
"] has "
489 "already been saved (possibly by IsisGui). If you need to "
490 "change the value use \"Clear\" before the Put.";
491 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
494 param->values.clear();
496 param->values.push_back(
"YES");
499 param->values.push_back(
"NO");
524 const vector<bool> &value) {
528 if(param->type !=
"boolean") {
529 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
530 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
533 if(param->values.size() > 0) {
534 QString message =
"A value for this parameter [" + paramName +
"] has "
535 "already been saved (possibly by IsisGui). If you need to "
536 "change the value use \"Clear\" before the Put.";
537 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
540 param->values.resize(value.size());
541 for(
unsigned int i = 0; i < value.size(); i++) {
543 param->values.push_back(
"YES");
546 param->values.push_back(
"NO");
572 if(param->values.size() == 0) {
573 if(param->defaultValues.size() == 0) {
574 QString message =
"Parameter [" + paramName +
"] has no value.";
575 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
578 value = param->defaultValues[0];
582 value = param->values[0];
602 vector<QString> &values)
const {
608 if(param->values.size() == 0) {
609 if(param->defaultValues.size() == 0) {
610 QString message =
"Parameter [" + paramName +
"] has no value.";
611 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
614 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
615 values.push_back(param->defaultValues[i]);
619 for(
unsigned int i = 0; i < param->values.size(); i++)
620 values.push_back(param->values[i]);
642 if(param->type !=
"filename") {
643 QString message =
"Parameter [" + paramName +
"] is not a filename.";
644 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
648 if(param->values.size() == 0) {
649 if(param->defaultValues.size() == 0) {
650 QString message =
"Parameter [" + paramName +
"] has no value.";
651 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
654 value = param->defaultValues[0];
658 value = param->values[0];
661 Isis::FileName name(value);
662 if(extension !=
"") name = name.addExtension(extension);
663 value = name.expanded();
679 vector<QString> &values)
const {
683 if(param->type !=
"filename") {
684 QString message =
"Parameter [" + paramName +
"] is not a filename.";
685 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
689 if(param->values.size() == 0) {
690 if(param->defaultValues.size() == 0) {
691 QString message =
"Parameter [" + paramName +
"] has no value.";
692 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
695 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
696 Isis::FileName name(param->defaultValues[i]);
697 values.push_back(name.expanded());
702 for(
unsigned int i = 0; i < param->values.size(); i++) {
703 Isis::FileName name(param->values[i]);
704 values.push_back(name.expanded());
726 if (param->type !=
"cube") {
727 QString message =
"Parameter [" + paramName +
"] is not a cubename.";
728 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
732 if (param->values.size() == 0) {
733 if (param->defaultValues.size() == 0) {
734 QString message =
"Parameter [" + paramName +
"] has no value.";
735 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
738 value = param->defaultValues[0];
742 value = param->values[0];
745 Isis::FileName name(value);
746 if (extension !=
"") name = name.addExtension(extension);
747 value = name.expanded();
748 if (name.attributes().length() > 0) {
749 value +=
"+" + name.attributes();
772 if(param->type !=
"string" && param->type !=
"combo") {
773 QString message =
"Parameter [" + paramName +
"] is not a string.";
774 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
777 if(param->values.size() == 0) {
778 if(param->defaultValues.size() == 0) {
779 QString message =
"Parameter [" + paramName +
"] has no value.";
780 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
783 value = param->defaultValues[0];
787 value = param->values[0];
790 if(param->listOptions.size() > 0) {
791 value = value.toUpper();
794 for(
unsigned int p = 0; p < param->listOptions.size(); p++) {
795 QString option = param->listOptions[p].value;
796 option = option.toUpper();
797 if(value == option) {
800 else if(value.startsWith(option) || option.startsWith(value)) {
802 foundcount = foundcount + 1;
805 if(foundcount == 0) {
806 QString message =
"Value [" + value +
"] for parameter [" +
807 paramName +
"] is not a valid value.";
808 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
811 QString message =
"Value [" + value +
"] for parameter [" +
812 paramName +
"] is not unique.";
813 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
815 return param->listOptions[found].value;
820 value = param->values[0];
840 vector<QString> &values)
const {
844 if(param->type !=
"string" && param->type !=
"combo") {
845 QString message =
"Parameter [" + paramName +
"] is not a string.";
846 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
851 if(param->values.size() == 0) {
852 if(param->defaultValues.size() == 0) {
853 QString message =
"Parameter [" + paramName +
"] has no value.";
854 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
857 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
858 values.push_back(param->defaultValues[i]);
862 for(
unsigned int i = 0; i < param->values.size(); i++)
863 values.push_back(param->values[i]);
885 if(param->type !=
"integer") {
886 QString message =
"Parameter [" + paramName +
"] is not an integer.";
887 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
891 if(param->values.size() == 0) {
892 if(param->defaultValues.size() == 0) {
893 QString message =
"Parameter [" + paramName +
"] has no value.";
894 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
897 value = param->defaultValues[0];
901 value = param->values[0];
904 return value.ToInteger();
921 vector<int> &values)
const {
925 if(param->type !=
"integer") {
926 QString message =
"Parameter [" + paramName +
"] is not an integer.";
927 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
932 if(param->values.size() == 0) {
933 if(param->defaultValues.size() == 0) {
934 QString message =
"Parameter [" + paramName +
"] has no value.";
935 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
938 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
939 value = param->defaultValues[i];
940 values.push_back(value.ToInteger());
944 for(
unsigned int i = 0; i < param->values.size(); i++)
945 value = param->values[i];
946 values.push_back(value.ToInteger());
968 if(param->type !=
"double") {
969 QString message =
"Parameter [" + paramName +
"] is not a double.";
970 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
974 if(param->values.size() == 0) {
975 if(param->defaultValues.size() == 0) {
976 QString message =
"Parameter [" + paramName +
"] has no value.";
977 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
980 value = param->defaultValues[0];
984 value = param->values[0];
987 return value.ToDouble();
1004 vector<double> &values)
const {
1008 if(param->type !=
"double") {
1009 QString message =
"Parameter [" + paramName +
"] is not a double.";
1010 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
1014 Isis::IString value;
1015 if(param->values.size() == 0) {
1016 if(param->defaultValues.size() == 0) {
1017 QString message =
"Parameter [" + paramName +
"] has no value.";
1018 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
1021 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
1022 value = param->defaultValues[i];
1023 values.push_back(value.ToDouble());
1027 for(
unsigned int i = 0; i < param->values.size(); i++)
1028 value = param->values[i];
1029 values.push_back(value.ToDouble());
1051 if(param->type !=
"boolean") {
1052 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
1053 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
1057 if(param->values.size() == 0) {
1058 if(param->defaultValues.size() == 0) {
1059 QString message =
"Parameter [" + paramName +
"] has no value.";
1060 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
1063 value = param->defaultValues[0];
1067 value = param->values[0];
1070 return Isis::toBool(value);
1088 vector<bool> &values)
const {
1092 if(param->type !=
"boolean") {
1093 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
1094 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
1098 vector <QString> value;
1100 if(param->values.size() == 0) {
1101 if(param->defaultValues.size() == 0) {
1102 QString message =
"Parameter [" + paramName +
"] has no value.";
1103 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
1106 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
1107 tmp = param->defaultValues[i].toUpper();
1108 value.push_back(tmp);
1113 for(
unsigned int i = 0; i < param->values.size(); i++) {
1114 tmp = param->values[i].toUpper();
1115 value.push_back(tmp);
1119 for(
unsigned int i = 0; i < value.size(); i++) {
1163 return groups.size();
1175 QString s = groups[index].name;
1190 for(
int i=0; i<(int)groups.size(); i++) {
1191 if(Isis::IString(grpName).DownCase() == Isis::IString(groups[i].name).DownCase()) {
1205 Isis::PvlGroup group(
"UserParameters");
1208 for(
unsigned int g = 0; g < groups.size(); g++) {
1209 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
1212 if(param->values.size() > 0) {
1213 std::vector<std::string> values(param->values.size());
1215 for(
unsigned int value = 0; value < param->values.size(); value++) {
1216 values[value] = param->values[value].toStdString();
1219 if (values.size() == 0) {
1220 ret[param->name.toStdString()] =
"NULL";
1222 if (values.size() > 1) {
1223 ret[param->name.toStdString()] = values;
1226 ret[param->name.toStdString()] = values.at(0);
1232 else if(param->defaultValues.size() > 0) {
1233 std::vector<std::string> values(param->defaultValues.size());
1235 for(
unsigned int value = 0;
1236 value < param->defaultValues.size();
1238 values[value] = param->defaultValues[value].toStdString();
1241 if (values.size() == 0) {
1242 ret[param->name.toStdString()] =
"NULL";
1244 else if (values.size() > 1) {
1245 ret[param->name.toStdString()] = values;
1248 ret[param->name.toStdString()] = values.at(0);
1271void IsisAml::CreatePVL(Isis::Pvl &pvlDef , QString guiGrpName, QString pvlObjName, QString pvlGrpName, vector<QString> & include) {
1273 Isis::PvlObject *pvlObj = NULL;
1274 if (pvlObjName !=
"") {
1275 pvlObj =
new Isis::PvlObject(pvlObjName);
1281 if (pvlGrpName ==
"" || grpIndex == -1 ) {
1282 QString errMsg =
"Must provide Group Name\n";
1283 throw Isis::IException(Isis::IException::User, errMsg, _FILEINFO_);
1286 Isis::PvlGroup grp(pvlGrpName);
1287 for(
int i=0; i<
NumParams(grpIndex); i++) {
1288 QString paramName =
ParamName(grpIndex, i);
1291 Isis::IString paramType = Isis::IString(
ParamType(grpIndex, i)).DownCase();
1292 if(paramType ==
"double") {
1295 if(paramType ==
"integer") {
1298 if(paramType ==
"boolean") {
1301 if(paramType ==
"string" || paramType ==
"filename" || paramType ==
"combo") {
1302 grp += Isis::PvlKeyword(paramName,
GetAsString(paramName));
1307 if(pvlObj != NULL) {
1331 for(
int i=0; i<(int)include.size(); i++) {
1332 if(Isis::IString(paramName).DownCase() == Isis::IString(include[i]).DownCase()) {
1348 return groups[group].parameters.size();
1361 QString s = groups[group].parameters[param].name;
1375 QString s = groups[group].parameters[param].brief;
1389 QString s = groups[group].parameters[param].description;
1403 QString s = groups[group].parameters[param].minimum;
1417 QString s = groups[group].parameters[param].maximum;
1431 QString s = groups[group].parameters[param].minimum_inclusive;
1445 QString s = groups[group].parameters[param].maximum_inclusive;
1460 QString s = groups[group].parameters[param].odd;
1474 return groups[group].parameters[param].greaterThan.size();
1487 const int ¶m)
const {
1488 return groups[group].parameters[param].greaterThanOrEqual.size();
1501 return groups[group].parameters[param].lessThan.size();
1514 const int ¶m)
const {
1515 return groups[group].parameters[param].lessThanOrEqual.size();
1528 return groups[group].parameters[param].notEqual.size();
1542 const int &great)
const {
1543 QString s = groups[group].parameters[param].greaterThan[great];
1558 const int &great)
const {
1559 QString s = groups[group].parameters[param].greaterThanOrEqual[great];
1574 const int &les)
const {
1575 QString s = groups[group].parameters[param].lessThan[les];
1590 const int &les)
const {
1591 QString s = groups[group].parameters[param].lessThanOrEqual[les];
1606 const int ¬Eq)
const {
1607 QString s = groups[group].parameters[param].notEqual[notEq];
1622 const int &exclude)
const {
1623 QString s = groups[group].parameters[param].exclude[exclude];
1638 const int &include)
const {
1639 QString s = groups[group].parameters[param].include[include];
1653 QString s = groups[group].parameters[param].type;
1668 if(groups[group].parameters[param].defaultValues.size() == 0) {
1672 s = groups[group].parameters[param].defaultValues[0];
1688 if(groups[group].parameters[param].internalDefault.size() == 0) {
1692 s = groups[group].parameters[param].internalDefault;
1708 if(groups[group].parameters[param].filter.size() == 0) {
1712 s = groups[group].parameters[param].filter;
1728 if(groups[group].parameters[param].path.size() == 0) {
1732 s = groups[group].parameters[param].path;
1748 if(groups[group].parameters[param].fileMode.size() == 0) {
1752 s = groups[group].parameters[param].fileMode;
1768 return groups[group].parameters[param].listOptions.size();
1782 const int &option)
const {
1783 QString s = groups[group].parameters[param].listOptions[option].value;
1798 const int &option)
const {
1799 QString s = groups[group].parameters[param].listOptions[option].brief;
1814 const int &option)
const {
1815 QString s = groups[group].parameters[param].listOptions[option].description;
1830 const int &option)
const {
1831 return groups[group].parameters[param].listOptions[option].exclude.size();
1846 const int &option,
const int &exclude)
const {
1847 QString s = groups[group].parameters[param].listOptions[option].exclude[exclude];
1862 const int &option)
const {
1863 return groups[group].parameters[param].listOptions[option].include.size();
1878 const int &option,
const int &include)
const {
1879 QString s = groups[group].parameters[param].listOptions[option].include[include];
1893 return groups[group].parameters[param].exclude.size();
1906 return groups[group].parameters[param].include.size();
1919 return groups[group].parameters[param].pixelType;
1932 return groups[group].parameters[param].helpers.size();
1946 const int &helper)
const {
1947 return groups[group].parameters[param].helpers[helper].name;
1961 const int &helper)
const {
1962 return groups[group].parameters[param].helpers[helper].function;
1976 const int &helper)
const {
1977 return groups[group].parameters[param].helpers[helper].brief;
1991 const int &helper)
const {
1992 return groups[group].parameters[param].helpers[helper].description;
2006 const int &helper)
const {
2007 return groups[group].parameters[param].helpers[helper].icon;
2021 if(param->values.size() == 0) {
2037 param->values.clear();
2060 if(param->type !=
"cube") {
2061 QString message =
"Unable to get input cube attributes. Parameter ["
2062 + paramName +
"] is not a cube. Parameter type = [" + param->type +
"].";
2063 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
2067 if(param->values.size() == 0) {
2068 if(param->defaultValues.size() == 0) {
2074 value = param->defaultValues[0];
2078 value = param->values[0];
2080 if(param->fileMode ==
"input") {
2084 QString message =
"Unable to get input cube attributes. Parameter ["
2085 + paramName +
"] is not an input. Parameter fileMode = [" + param->fileMode +
"].";
2086 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
2088 return param->inCubeAtt;
2106 if(param->type !=
"cube") {
2107 QString message =
"Unable to get output cube attributes. Parameter ["
2108 + paramName +
"] is not a cube. Parameter type = [" + param->type +
"].";
2109 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
2113 if(param->values.size() == 0) {
2114 if(param->defaultValues.size() == 0) {
2120 value = param->defaultValues[0];
2124 value = param->values[0];
2126 if(param->fileMode ==
"output") {
2131 QString message =
"Unable to get output cube attributes. Parameter ["
2132 + paramName +
"] is not an output. Parameter fileMode = [" + param->fileMode +
"].";
2133 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
2135 return param->outCubeAtt;
2150 Isis::IString pn = paramName.split(
'.', Qt::SkipEmptyParts)[0];
2155 Isis::IString cur_pn;
2157 for(
unsigned int g = 0; g < groups.size(); g++) {
2158 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
2159 cur_pn = groups[g].parameters[p].name;
2161 if(cur_pn.find(pn) == 0) {
2164 QString message =
"Parameter [" + paramName +
"] is not unique.";
2165 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2170 param = &(groups[g].parameters[p]);
2175 param = &(groups[g].parameters[p]);
2181 QString message =
"Unknown parameter [" + paramName +
"].";
2182 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2184 else if((found > 1) && (!exact)) {
2185 QString message =
"Parameter [" + paramName +
"] is not unique.";
2186 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2205 for(
unsigned int i = 0; i < param->values.size(); i++) {
2206 if(param->type ==
"integer") {
2208 Isis::IString value(param->values[i]);
2211 catch(Isis::IException &e) {
2212 QString message =
"Unable to convert [" + param->values[i] +
"] to an integer,"
2213 " parameter [" + param->name +
"].";
2214 throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_);
2217 else if(param->type ==
"double") {
2219 Isis::IString value(param->values[i]);
2222 catch(Isis::IException &e) {
2223 QString message =
"Unable to convert [" + param->values[i] +
"] to a double,"
2224 " parameter [" + param->name +
"].";
2225 throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_);
2228 else if(param->type ==
"boolean") {
2229 QString v = param->values[i].toUpper();
2234 catch(Isis::IException &e) {
2235 QString message =
"Illegal value for [" + param->name +
"], [" + param->values[i] +
"].";
2236 throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_);
2239 else if(param->type ==
"filename") {
2242 QString value(param->values[i]);
2243 Isis::FileName name(value);
2244 value = name.expanded();
2245 if(name.fileExists() && param->fileMode ==
"output") {
2266 if(param->values.size() == 0) {
2267 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
2270 if(param->type ==
"integer") {
2272 Isis::IString value(param->defaultValues[i]);
2275 catch(Isis::IException &e) {
2276 QString message =
"Unable to convert default [" + param->defaultValues[i] +
2277 "] to an integer, parameter [" + param->name +
"].";
2278 throw Isis::IException(e, Isis::IException::Programmer, message, _FILEINFO_);
2281 else if(param->type ==
"double") {
2283 Isis::IString value(param->defaultValues[i]);
2286 catch(Isis::IException &e) {
2287 QString message =
"Unable to convert default [" + param->defaultValues[i] +
2288 "] to a double, parameter [" + param->name +
"].";
2289 throw Isis::IException(e, Isis::IException::Programmer, message, _FILEINFO_);
2292 else if(param->type ==
"boolean") {
2293 QString v = param->defaultValues[i].toUpper();
2298 catch(Isis::IException &e) {
2299 QString message =
"Illegal default value for [" + param->name +
"], ["
2300 + param->defaultValues[i] +
"].";
2301 throw Isis::IException(e, Isis::IException::User, message, _FILEINFO_);
2304 else if(param->type ==
"filename") {
2306 QString value(param->defaultValues[i]);
2307 Isis::FileName name(value);
2308 value = name.expanded();
2309 if(name.fileExists() && param->fileMode ==
"output") {
2317 if(param->listOptions.size() > 0) {
2318 for(
unsigned int i = 0; i < param->values.size(); i++) {
2319 Isis::IString value = param->values[i];
2320 value = value.UpCase();
2323 for(
unsigned int p = 0; p < param->listOptions.size(); p++) {
2324 Isis::IString option = param->listOptions[p].value;
2325 option = option.UpCase();
2327 if(value == option) {
2330 QString message =
"Duplicate list options [" +
2331 param->listOptions[p].value +
2332 "] in parameter [" + param->name +
"].";
2333 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
2340 else if(option.compare(0, min(value.size(), option.size()),
2341 value, 0, min(value.size(), option.size())) == 0) {
2345 if(!exact && partial == 0) {
2346 QString message =
"Value of [" + param->name +
"] must be one of [" +
2347 param->listOptions[0].value;
2348 for(
unsigned int p = 1; p < param->listOptions.size(); p++) {
2349 message +=
", " + param->listOptions[p].value;
2352 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2354 else if(!exact && partial > 1) {
2355 QString msg =
"Value of [" + param->name +
2356 "] does not match a list option uniquely.";
2357 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2363 if(param->minimum.length() > 0) {
2364 QString incl = param->minimum_inclusive;
2365 for(
unsigned int i = 0; i < param->values.size(); i++) {
2366 if(param->type ==
"integer") {
2367 QString value(param->values[i]);
2368 int temp = Isis::toInt(value);
2369 value = param->minimum;
2370 int min = Isis::toInt(value);
2372 QString message =
"Parameter [" + param->name +
2373 "] must be greater than or equal to [" + param->minimum +
"].";
2374 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2377 QString message =
"Parameter [" + param->name +
2378 "] must be greater than [" + param->minimum +
"].";
2379 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2382 else if(param->type ==
"double") {
2383 Isis::IString value(param->values[i]);
2384 double temp = value.ToDouble();
2385 value = param->minimum;
2386 double min = value.ToDouble();
2388 QString message =
"Parameter [" + param->name +
2389 "] must be greater than or equal to [" + param->minimum +
"].";
2390 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2393 QString message =
"Parameter [" + param->name +
2394 "] must be greater than [" + param->minimum +
"].";
2395 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2399 if(param->values.size() == 0) {
2400 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
2401 if(param->type ==
"integer") {
2402 Isis::IString value(param->defaultValues[i]);
2403 int temp = value.ToInteger();
2404 value = param->minimum;
2405 int min = value.ToInteger();
2407 QString message =
"Parameter [" + param->name +
2408 "] must be greater than or equal to [" + param->minimum +
"].";
2409 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2412 QString message =
"Parameter [" + param->name +
2413 "] must be greater than [" + param->minimum +
"].";
2414 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2417 else if(param->type ==
"double") {
2418 Isis::IString value(param->defaultValues[i]);
2419 double temp = value.ToDouble();
2420 value = param->minimum;
2421 double min = value.ToDouble();
2423 QString message =
"Parameter [" + param->name +
2424 "] must be greater than or equal to [" + param->minimum +
"].";
2425 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2428 QString message =
"Parameter [" + param->name +
2429 "] must be greater than [" + param->minimum +
"].";
2430 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2438 if(param->maximum.length() > 0) {
2439 QString incl = param->maximum_inclusive.toLower();
2440 for(
unsigned int i = 0; i < param->values.size(); i++) {
2441 if(param->type ==
"integer") {
2442 QString value(param->values[i]);
2443 int temp = Isis::toInt(value);
2444 value = param->maximum;
2445 int max = Isis::toInt(value);
2447 QString message =
"Parameter [" + param->name +
2448 "] must be less than or equal to [" + param->maximum +
"].";
2449 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2452 QString message =
"Parameter [" + param->name +
2453 "] must be less than [" + param->maximum +
"].";
2454 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2457 else if(param->type ==
"double") {
2458 Isis::IString value(param->values[i]);
2459 double temp = value.ToDouble();
2460 value = param->maximum;
2461 double max = value.ToDouble();
2463 QString message =
"Parameter [" + param->name +
2464 "] must be less than or equal to [" + param->maximum +
"].";
2465 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2468 QString message =
"Parameter [" + param->name +
2469 "] must be less than [" + param->maximum +
"].";
2470 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2474 if(param->values.size() == 0) {
2475 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
2476 if(param->type ==
"integer") {
2477 Isis::IString value(param->defaultValues[i]);
2478 int temp = value.ToInteger();
2479 value = param->maximum;
2480 int max = value.ToInteger();
2482 QString message =
"Parameter [" + param->name +
2483 "] must be less than or equal to [" + param->maximum +
"].";
2484 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2487 QString message =
"Parameter [" + param->name +
2488 "] must be less than [" + param->maximum +
"].";
2489 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2492 else if(param->type ==
"double") {
2493 Isis::IString value(param->defaultValues[i]);
2494 double temp = value.ToDouble();
2495 value = param->maximum;
2496 double max = value.ToDouble();
2498 QString message =
"Parameter [" + param->name +
2499 "] must be less than or equal to [" + param->maximum +
"].";
2500 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2503 QString message =
"Parameter [" + param->name +
2504 "] must be less than [" + param->maximum +
"].";
2505 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2513 QString odd = param->odd.toLower();
2516 if(param->type !=
"integer") {
2517 QString message =
"Parameter [" + param->name +
2518 "] must be of type integer to have an [odd] test.";
2519 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
2522 for(
unsigned int i = 0; i < param->values.size(); i++) {
2523 Isis::IString value(param->values[i]);
2524 if((value.ToInteger() % 2) != 1) {
2525 QString message =
"Value for [" + param->name +
"] must be odd.";
2526 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2553 Isis::PvlGroup fileCustomization = Isis::Preference::Preferences().findGroup(
"FileCustomization");
2554 QString overwritePreference = fileCustomization.findKeyword(
"Overwrite")[0].simplified().trimmed();
2555 QString temp = overwritePreference;
2556 if(overwritePreference.toUpper() ==
"ERROR") {
2557 QString message =
"Invalid output filename for [" + paramname +
"]. The file [" + filename +
"] already exists. " +
2558 "The user preference file customization group is set to disallow file overwrites.";
2559 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2561 else if(overwritePreference.toUpper() !=
"ALLOW") {
2562 QString message =
"Invalid entry in user preference file FileCustomization group.";
2563 message +=
" Overwrite = [" + temp +
"]. Valid values: [Allow] or [Error].";
2564 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2573 for(
unsigned int g = 0; g < groups.size(); g++) {
2574 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
2580 for(
unsigned int item = 0; item < param->include.size(); item++) {
2581 bool paramOneSet =
false;
2583 QString parameterValue =
GetAsString(param->name);
2585 if (param->type ==
"boolean") {
2586 paramOneSet = Isis::toBool(parameterValue);
2589 catch (Isis::IException &e) {
2590 if (param->internalDefault.size() > 0) {
2596 bool paramTwoSet =
false;
2598 QString parameterValue =
GetAsString(param2->name);
2601 catch (Isis::IException &e) {
2602 if (param2->internalDefault.size() > 0) {
2607 if (paramOneSet && !paramTwoSet) {
2608 QString messageEnd =
"is used.";
2609 if (param->type ==
"boolean") {
2610 messageEnd =
"equates to true.";
2612 QString message =
"Parameter [" + param2->name +
2613 "] must be used if parameter [" +
2614 param->name +
"] " + messageEnd;
2615 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2620 for(
unsigned int item = 0; item < param->exclude.size(); item++) {
2621 bool paramOneSet =
false;
2624 if (param->type ==
"boolean" && paramOneSet) {
2628 catch (Isis::IException &e) {}
2631 bool paramTwoSet =
false;
2634 if (param2->type ==
"boolean" && paramTwoSet) {
2638 catch (Isis::IException &e) {}
2640 if (paramOneSet && paramTwoSet) {
2641 QString messageEnd =
"is used.";
2642 if (param->type ==
"boolean") {
2643 messageEnd =
"equates to true.";
2645 QString exclude = param->exclude[item];
2646 if (exclude.contains(
'.')) {
2647 exclude = exclude.split(
'.', Qt::SkipEmptyParts)[1].toUpper();
2648 if (exclude == param2->values[0].toUpper()) {
2649 QString message =
"Parameter [" + param2->name +
2650 "] must NOT be used with option [" + exclude +
"]"
2651 " if parameter [" + param->name +
"] " + messageEnd;
2652 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2656 QString message =
"Parameter [" + param2->name +
2657 "] must NOT be used if parameter [" +
2658 param->name +
"] " + messageEnd;;
2659 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2665 if(param->values.size() > 0) {
2666 for(
unsigned int item = 0; item < param->greaterThan.size(); item++) {
2668 if(param2->values.size() != 0) {
2669 double double1, double2;
2670 if(param->type ==
"integer") {
2673 else if(param->type ==
"double") {
2677 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2679 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2682 if(param2->type ==
"integer") {
2685 else if(param2->type ==
"double") {
2689 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2691 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2694 if(double2 >= double1) {
2695 QString message =
"Parameter [" + param->name +
2696 "] must be greater than parameter [" +
2697 param2->name +
"].";
2698 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2705 if(param->values.size() > 0) {
2706 for(
unsigned int item = 0; item < param->greaterThanOrEqual.size(); item++) {
2709 if(param2->values.size() != 0) {
2710 double double1, double2;
2711 if(param->type ==
"integer") {
2714 else if(param->type ==
"double") {
2718 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2720 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2723 if(param2->type ==
"integer") {
2726 else if(param2->type ==
"double") {
2730 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2732 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2735 if(double2 > double1) {
2736 QString message =
"Parameter [" + param->name +
2737 "] must be greater than or equal to parameter [" +
2738 param2->name +
"].";
2739 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2745 if(param->values.size() > 0) {
2746 for(
unsigned int item = 0; item < param->lessThan.size(); item++) {
2748 if(param2->values.size() != 0) {
2749 double double1, double2;
2750 if(param->type ==
"integer") {
2753 else if(param->type ==
"double") {
2757 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2759 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2762 if(param2->type ==
"integer") {
2765 else if(param2->type ==
"double") {
2769 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2771 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2774 if(double2 <= double1) {
2775 QString message =
"Parameter [" + param->name +
2776 "] must be less than parameter [" +
2777 param2->name +
"].";
2778 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2785 if(param->values.size() > 0) {
2786 for(
unsigned int item = 0; item < param->lessThanOrEqual.size(); item++) {
2789 if(param2->values.size() != 0) {
2790 double double1, double2;
2791 if(param->type ==
"integer") {
2794 else if(param->type ==
"double") {
2798 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2800 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2803 if(param2->type ==
"integer") {
2806 else if(param2->type ==
"double") {
2810 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2812 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2815 if(double2 < double1) {
2816 QString message =
"Parameter [" + param->name +
2817 "] must be less than or equal to parameter [" +
2818 param2->name +
"].";
2819 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2826 if(param->values.size() > 0) {
2827 for(
unsigned int item = 0; item < param->notEqual.size(); item++) {
2829 if(param2->values.size() != 0) {
2830 double double1, double2;
2831 if(param->type ==
"integer") {
2834 else if(param->type ==
"double") {
2838 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2840 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2843 if(param2->type ==
"integer") {
2846 else if(param2->type ==
"double") {
2850 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2852 throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_);
2855 if(double2 == double1) {
2856 QString message =
"Parameter [" + param->name +
2857 "] must NOT be equal to parameter [" +
2858 param2->name +
"].";
2859 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2868 if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
2869 for(
unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) {
2870 QString value, option;
2871 if(param->type ==
"string" || param->type ==
"combo") {
2873 value = value.toUpper();
2874 option = param->listOptions[o2].value;
2875 option = option.toUpper();
2877 else if(param->type ==
"integer") {
2879 value = value.trimmed();
2880 option = param->listOptions[o2].value;
2881 option = option.trimmed();
2883 if(value == option) {
2884 for(
unsigned int e2 = 0; e2 < param->listOptions[o2].exclude.size(); e2++) {
2886 QString exclude = param->listOptions[o2].exclude[e2];
2887 if (exclude.contains(
'.')) {
2888 QStringList splitList = exclude.split(
'.', Qt::SkipEmptyParts);
2890 exclude = splitList[1].toUpper();
2891 if (exclude == param2->values[0].toUpper()) {
2892 QString message =
"Parameter [" + param2->name +
2893 "] can not be be used with option [" + exclude +
"] "
2894 "if parameter [" +param->name +
"] is equal to [" +
2896 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2901 if(param2->values.size() > 0) {
2902 QString message =
"Parameter [" + param2->name +
2903 "] can not be entered if parameter [" +
2904 param->name +
"] is equal to [" +
2906 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2916 if ((param->values.size() > 0) || (param->defaultValues.size() > 0)) {
2917 for(
unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) {
2918 QString value, option;
2919 if(param->type ==
"string" || param->type ==
"combo") {
2921 value = value.toUpper();
2922 option = param->listOptions[o2].value;
2923 option = option.toUpper();
2925 else if(param->type ==
"integer") {
2927 value = value.trimmed();
2928 option = param->listOptions[o2].value;
2929 option = option.trimmed();
2931 if(value == option) {
2932 for(
unsigned int e2 = 0; e2 < param->listOptions[o2].include.size(); e2++) {
2935 if((param2->values.size() == 0) &&
2936 (param2->defaultValues.size() == 0)) {
2937 QString message =
"Parameter [" + param2->name +
2938 "] must be entered if parameter [" +
2939 param->name +
"] is equal to [" +
2941 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
2953 if((param->values.size() == 0) && (param->defaultValues.size() == 0) &&
2954 (param->internalDefault.size() == 0)) {
2955 bool excluded =
false;
2957 for(
unsigned int g2 = 0; g2 < groups.size(); g2++) {
2958 for(
unsigned int p2 = 0; p2 < groups[g2].parameters.size(); p2++) {
2959 for(
unsigned int o2 = 0;
2960 o2 < groups[g2].parameters[p2].listOptions.size(); o2++) {
2961 for(
unsigned int e2 = 0;
2962 e2 < groups[g2].parameters[p2].listOptions[o2].exclude.size();
2965 this->groups[g2].parameters[p2].listOptions[o2].exclude[e2];
2966 if(excl == param->name) {
2973 if(groups[g2].parameters[p2].type ==
"boolean") {
2975 if(((param2->values.size() > 0) && !
StringToBool(param2->values[0])) ||
2976 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2978 for(
unsigned int e2 = 0; e2 < groups[g2].parameters[p2].include.size();
2981 this->groups[g2].parameters[p2].include[e2];
2982 if(incl == param->name) {
2987 else if(((param2->values.size() > 0) &&
StringToBool(param2->values[0])) ||
2988 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2990 for(
unsigned int e2 = 0; e2 < groups[g2].parameters[p2].exclude.size();
2993 this->groups[g2].parameters[p2].exclude[e2];
2994 if(excl == param->name) {
3005 for(
unsigned int item = 0; item < param->exclude.size(); item++) {
3007 if((param2->values.size() != 0) ||
3008 (param2->defaultValues.size() != 0) ||
3009 (param2->internalDefault.size() != 0)) {
3010 if(param2->type !=
"boolean") {
3014 if(((param2->values.size() > 0) && !
StringToBool(param2->values[0])) ||
3015 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
3025 for(
unsigned int item = 0; item < param->include.size(); item++) {
3027 if(param2->type ==
"boolean") {
3028 if(((param2->values.size() > 0) && !
StringToBool(param2->values[0])) ||
3029 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
3037 QString message =
"Parameter [" + param->name +
"] must be entered.";
3038 throw Isis::IException(Isis::IException::User, message, _FILEINFO_);
3057 value = value.toUpper();
3061 else if(!value.compare(
"NO")) {
3064 else if(!value.compare(
"FALSE")) {
3067 else if(!value.compare(
"F")) {
3070 else if(!value.compare(
"N")) {
3073 else if(!value.compare(
"YES")) {
3076 else if(!value.compare(
"TRUE")) {
3079 else if(!value.compare(
"Y")) {
3082 else if(!value.compare(
"T")) {
3086 QString message =
"Invalid boolean value [" + value +
"].";
3087 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
3099 Isis::PvlGroup group(
"UserParameters");
3102 for(
unsigned int g = 0; g < groups.size(); g++) {
3103 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
3106 if(param->values.size() > 0) {
3107 Isis::PvlKeyword paramKeyword(param->name);
3109 for(
unsigned int value = 0; value < param->values.size(); value++) {
3110 paramKeyword.addValue(param->values[value]);
3113 group += paramKeyword;
3117 else if(param->defaultValues.size() > 0) {
3118 Isis::PvlKeyword paramKeyword(param->name);
3120 for(
unsigned int value = 0;
3121 value < param->defaultValues.size();
3123 paramKeyword.addValue(param->defaultValues[value]);
3126 group += paramKeyword;
3131 for(
unsigned int g = 0; g < groups.size(); g++) {
3132 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
3135 if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
3136 for(
unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) {
3137 Isis::IString value, option;
3138 if(param->type ==
"string" || param->type ==
"combo") {
3140 value = value.UpCase();
3141 option = param->listOptions[o2].value;
3142 option = option.UpCase();
3144 else if(param->type ==
"integer") {
3146 value = value.Trim(
"\n\r\t\f\v\b");
3147 option = param->listOptions[o2].value;
3148 option = option.Trim(
"\n\r\t\f\v\b");
3150 if(value == option) {
3151 for(
unsigned int e2 = 0; e2 < param->listOptions[o2].exclude.size(); e2++) {
3154 if(group.hasKeyword(param2->name)) {
3155 group.deleteKeyword(param2->name);
3165 cont.addGroup(group);
3176 QString st =
"000-00-00";
3177 for(
unsigned int i = 0; i < changes.size(); i++) {
3178 if(changes[i].date > st) st = changes[i].date;
3195 XERCES::XMLPlatformUtils::Initialize();
3198 catch(
const XERCES::XMLException &toCatch) {
3200 QString message =
"Error during XML parser initialization" +
3201 (QString)XERCES::XMLString::transcode(toCatch.getMessage());
3202 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
3209 parser = XERCES::XMLReaderFactory::createXMLReader();
3212 XERCES::SAX2XMLReader::ValSchemes valScheme = XERCES::SAX2XMLReader::Val_Never;
3213 if(valScheme == XERCES::SAX2XMLReader::Val_Auto) {
3214 parser->setFeature(XERCES::XMLString::transcode(
"http://xml.org/sax/features/validation"),
true);
3215 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/dynamic"),
true);
3217 else if(valScheme == XERCES::SAX2XMLReader::Val_Never) {
3218 parser->setFeature(XERCES::XMLString::transcode(
"http://xml.org/sax/features/validation"),
false);
3221 else if(valScheme == XERCES::SAX2XMLReader::Val_Always) {
3222 parser->setFeature(XERCES::XMLString::transcode(
"http://xml.org/sax/features/validation"),
true);
3223 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/dynamic"),
false);
3227 bool doSchema =
false;
3228 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/schema"), doSchema);
3230 bool schemaFullChecking =
false;
3231 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/schema-full-checking"), schemaFullChecking);
3235 char *encodingName =
const_cast<char *
>(
"LATIN1");
3236 bool expandNamespaces = false ;
3239 IsisAmlData *mydata =
this;
3243 catch (
const XERCES::XMLException &toCatch) {
3244 QString message =
"Error in application XML file: " +
3245 (QString)XERCES::XMLString::transcode(toCatch.getMessage());
3246 throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
3247 XERCES::XMLPlatformUtils::Terminate();
3252 catch (Isis::IException &e) {
3253 QString filePath = (QString) xmlfile;
3254 QString previousErrorMessage = (QString) e.toString();
3255 QString additionalErrorMessage =
"Error while parsing application XML file [" + filePath +
"]";
3257 throw Isis::IException(Isis::IException::Programmer, additionalErrorMessage +
"\n" + previousErrorMessage, _FILEINFO_);
3258 XERCES::XMLPlatformUtils::Terminate();
3264 XERCES::XMLPlatformUtils::Terminate();
void addAttributes(const FileName &fileNameWithAtts)
Append the attributes found in the filename to these cube attributes.
void setAttributes(const FileName &fileName)
Replaces the current attributes with the attributes in the given file name.
Manipulate and parse attributes of output cube filenames.
double GetDouble(const QString ¶mName) const
Allows the retrieval of a value for a parameter of type "double".
IsisXMLApplication * appHandler
The application handler.
void CommandLine(Isis::Pvl &lab) const
Creates a QString which could be used as a command line.
QString ParamOdd(const int &group, const int ¶m) const
Returns whether the selected parameter has a restriction on odd values or not.
int ParamExcludeSize(const int &group, const int ¶m) const
Returns the number of parameters excluded in this parameter's exclusions.
Isis::CubeAttributeInput & GetInputAttribute(const QString ¶mName)
Gets the attributes for an input cube.
int GetInteger(const QString ¶mName) const
Allows the retrieval of a value for a parameter of type "integer".
QString ParamLessThan(const int &group, const int ¶m, const int &great) const
Returns the name of the specified lessThan parameter.
QString ParamLessThanOrEqual(const int &group, const int ¶m, const int &les) const
Returns the name of the specified lessThanOrEqual parameter.
QString ParamBrief(const int &group, const int ¶m) const
Returns the brief description of a parameter in a specified group.
QString ParamListInclude(const int &group, const int ¶m, const int &option, const int &include) const
Returns the parameter name to be included if this option is selected.
QString ParamDescription(const int &group, const int ¶m) const
Returns the long description of a parameter in a specified group.
bool StringToBool(QString value) const
Returns a boolean value based on the QString contents.
void PutCubeName(const QString ¶mName, const QString &value)
Allows the insertion of a value for a parameter of type "cubename".
int ParamListIncludeSize(const int &group, const int ¶m, const int &option) const
Returns the number of items in a parameters list include section.
void PutBoolean(const QString ¶mName, const bool &value)
Allows the insertion of a value for a parameter of type "boolean".
QString GetFileName(const QString ¶mName, QString extension="") const
Allows the retrieval of a value for a parameter of type "filename".
bool WasEntered(const QString ¶mName) const
Returns a true if the parameter has a value, and false if it does not.
QString ParamListValue(const int &group, const int ¶m, const int &option) const
Returns the option value for a specific option to a parameter.
int NumGroups() const
Returns the number of groups found in the XML.
int ParamListExcludeSize(const int &group, const int ¶m, const int &option) const
Returns the number of items in a parameters list exclude section.
QString PixelType(const int &group, const int ¶m) const
Returns the default pixel type from the XML.
QString GetString(const QString ¶mName) const
Allows the retrieval of a value for a parameter of type "string".
bool GetBoolean(const QString ¶mName) const
Allows the retrieval of a value for a parameter of type "boolean".
nlohmann::json GetParams()
Creates a json object which could be used as a command line.
int ParamGreaterThanSize(const int &group, const int ¶m) const
Returns the number of values in the parameters greater than list.
QString ParamNotEqual(const int &group, const int ¶m, const int ¬Eq) const
Returns the name of the specified notEqual parameter.
void PutInteger(const QString ¶mName, const int &value)
Allows the insertion of a value for a parameter of type "integer".
int HelpersSize(const int &group, const int ¶m) const
Returns the number of helpers the parameter has.
QString ParamGreaterThanOrEqual(const int &group, const int ¶m, const int &great) const
Returns the name of the specified greaterThanOrEqual parameter.
void CreatePVL(Isis::Pvl &pvlDef, QString guiGrpName, QString pvlObjName, QString pvlGrpName, std::vector< QString > &exclude)
Create Pvl with the parameters in a user defined group given the Pvl object and group name.
QString GetCubeName(const QString ¶mName, QString extension="") const
Retrieves of a value for a parameter of type "cubename".
QString ParamMaximumInclusive(const int &group, const int ¶m) const
Returns whether the maximum value is inclusive or not.
QString Description() const
Returns the full description of the program.
QString ParamType(const int &group, const int ¶m) const
Returns the parameter type of a parameter in a specified group.
int ParamListSize(const int &group, const int ¶m) const
Returns the number of options in the specified parameter's list.
int NumParams(const int &) const
Returns the number of parameters in a group.
QString Version() const
Returns the application version date.
QString GroupName(const int &group) const
Returns the group name of group[index].
QString ParamExclude(const int &group, const int ¶m, const int &exclude) const
Returns the name of the specified excluded parameter.
QString HelperFunction(const int &group, const int ¶m, const int &helper) const
Returns the name of the helper function.
QString HelperButtonName(const int &group, const int ¶m, const int &helper) const
Returns the name of the helper button.
QString Brief() const
Returns the brief description of the program.
const IsisParameterData * ReturnParam(const QString ¶mName) const
Returns a pointer to a parameter whose name starts with paramName.
IsisAml(const QString &xmlfile)
Constructs an IsisAml object and internalizes the XML data in the given file name.
QString ParamFilter(const int &group, const int ¶m) const
Returns the parameter filter for a parameter in a specified group.
QString ParamListExclude(const int &group, const int ¶m, const int &option, const int &exclude) const
Returns the parameter name to be excluded if this option is selected.
int ParamLessThanOrEqualSize(const int &group, const int ¶m) const
Returns the number of values in the parameters less than or equal list.
QString ParamListBrief(const int &group, const int ¶m, const int &option) const
Returns the brief description for a specific option to a parameter.
QString ParamListDescription(const int &group, const int ¶m, const int &option) const
Returns the full description for a specific option to a parameter.
QString ParamDefault(const int &group, const int ¶m) const
Returns the default for a parameter in a specified group.
int ParamLessThanSize(const int &group, const int ¶m) const
Returns the number of values in the parameters less than list.
QString HelperBrief(const int &group, const int ¶m, const int &helper) const
Returns the brief description of the helper button.
QString ParamInclude(const int &group, const int ¶m, const int &include) const
Returns the name of the specified included parameter.
QString GetAsString(const QString ¶mName) const
Allows the retrieval of a value for a parameter of any type.
int GroupIndex(const QString &grpName) const
Given the group name get its index in group array.
void PutDouble(const QString ¶mName, const double &value)
Allows the insertion of a value for a parameter of type "double".
int ParamGreaterThanOrEqualSize(const int &group, const int ¶m) const
Returns the number of values in the parameters greater than or equal list.
QString ParamInternalDefault(const int &group, const int ¶m) const
Returns the internal default for a parameter in a specified group.
int ParamNotEqualSize(const int &group, const int ¶m) const
Returns the number of values in the not equal list.
QString ProgramName() const
Returns the Program name.
int ParamIncludeSize(const int &group, const int ¶m) const
Returns the number of parameters included in this parameter's inclusions.
QString ParamMinimumInclusive(const int &group, const int ¶m) const
Returns whether the minimum value is inclusive or not.
void PutString(const QString ¶mName, const QString &value)
Allows the insertion of a value for any parameter.
QString ParamGreaterThan(const int &group, const int ¶m, const int &great) const
Returns the name of the specified greaterThan parameter.
QString ParamMinimum(const int &group, const int ¶m) const
Returns the minimum value of a parameter in a specified group.
QString ParamFileMode(const int &group, const int ¶m) const
Returns the file mode for a parameter in a specified group.
XERCES::SAX2XMLReader * parser
The XML file parser.
Isis::CubeAttributeOutput & GetOutputAttribute(const QString ¶mName)
Gets the attributes for an output cube.
void CheckFileNamePreference(QString filename, QString paramname)
This method checks whether the user preferences are set to allow overwrites of existing files.
void Clear(const QString ¶mName)
Clears the value(s) in the named parameter.
void Verify(const IsisParameterData *param)
Throws an Isis::iExceptionXxxxxxxx if the parameter value(s) is invalid.
QString ParamPath(const int &group, const int ¶m) const
Returns the default path for a filename/cube parameter.
QString HelperDescription(const int &group, const int ¶m, const int &helper) const
Returns the long description of the helper button.
void StartParser(const char *xmlfile)
Starts parsing an application xml file.
void VerifyAll()
Verify all parameters.
QString ParamName(const int &group, const int ¶m) const
Returns the parameter name.
QString HelperIcon(const int &group, const int ¶m, const int &helper) const
Returns the name of the icon for the helper button.
bool IsParamInPvlInclude(QString ¶mName, std::vector< QString > &exclude)
Verify whether Parameter name is in the Include list Used in creation of DefFile.
void PutAsString(const QString ¶mName, const QString &value)
Allows the insertion of a value for any parameter.
~IsisAml()
Destructs an IsisAml object.
void PutFileName(const QString ¶mName, const QString &value)
Allows the insertion of a value for a parameter of type "filename".
QString ParamMaximum(const int &group, const int ¶m) const
Returns the maximum value of a parameter in a specified group.
This is free and unencumbered software released into the public domain.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.