Isis 3 Programmer Reference
GuiParameterFactory.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "GuiListParameter.h"
8 #include "GuiComboBoxParameter.h"
9 #include "GuiCubeParameter.h"
10 #include "GuiFilenameParameter.h"
11 #include "GuiStringParameter.h"
12 #include "GuiIntegerParameter.h"
13 #include "GuiDoubleParameter.h"
14 #include "GuiBooleanParameter.h"
15 #include "GuiParameterFactory.h"
16 #include "UserInterface.h"
17 #include "Application.h"
18 
19 namespace Isis {
20  GuiParameter *GuiParameterFactory::Create(QGridLayout *grid,
22  int group, int param) {
23  QString paramType = ui.ParamType(group, param);
24 
25  GuiParameter *p = NULL;
26  if(ui.ParamListSize(group, param) > 0) {
27  if (paramType == "combo") {
28  p = new GuiComboBoxParameter(grid, ui, group, param);
29  } else {
30  p = new GuiListParameter(grid, ui, group, param);
31  }
32  }
33  else if(paramType == "cube") {
34  p = new GuiCubeParameter(grid, ui, group, param);
35  }
36  else if(paramType == "filename") {
37  p = new GuiFileNameParameter(grid, ui, group, param);
38  }
39  else if(paramType == "string") {
40  p = new GuiStringParameter(grid, ui, group, param);
41  }
42  else if(paramType == "integer") {
43  p = new GuiIntegerParameter(grid, ui, group, param);
44  }
45  else if(paramType == "double") {
46  p = new GuiDoubleParameter(grid, ui, group, param);
47  }
48  else if(paramType == "boolean") {
49  p = new GuiBooleanParameter(grid, ui, group, param);
50  }
51  else {
52  QString msg = "Invalid parameter type in XML [" + paramType + "]";
53  throw IException(IException::Programmer, msg, _FILEINFO_);
54  }
55 
56  return p;
57  }
58 }
59 
60 
61 
IsisAml::ParamListSize
int ParamListSize(const int &group, const int &param) const
Returns the number of options in the specified parameter's list.
Definition: IsisAml.cpp:1601
IsisAml::ParamType
QString ParamType(const int &group, const int &param) const
Returns the parameter type of a parameter in a specified group.
Definition: IsisAml.cpp:1492
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::UserInterface
Command Line and Xml loader, validation, and access.
Definition: UserInterface.h:140
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16