21 #ifndef otbWrapperListViewParameter_h
22 #define otbWrapperListViewParameter_h
56 itkSetMacro(SingleSelection,
bool);
57 itkGetMacro(SingleSelection,
bool);
58 itkBooleanMacro(SingleSelection);
61 void AddChoice(std::string choicekey, std::string choiceName);
64 std::string GetChoiceKey(
int i)
const;
67 std::vector<std::string> GetChoiceKeys();
70 std::string GetChoiceName(
int i);
73 std::vector<std::string> GetChoiceNames();
76 unsigned int GetNbChoices(
void);
79 virtual void SetValue(
unsigned int v);
82 virtual void SetValue(std::string choiceKey);
85 virtual unsigned int GetValue()
const;
102 return m_SelectedItems;
105 void SetSelectedNames(std::vector<std::string> selectedNames);
109 return m_SelectedNames;
113 void SetSelectedKeys(std::vector<std::string> selectedKeys);
117 return m_SelectedKeys;
134 std::vector<int> items;
135 for (
unsigned int i = 0; i < selectedItems.size(); i++)
137 items.push_back(atoi(selectedItems[i].c_str()));
139 this->SetSelectedItems(items);
144 m_SelectedItems = selectedItems;
145 m_SelectedNames.clear();
146 m_SelectedKeys.clear();
148 std::vector<std::string> names = this->GetChoiceNames();
149 std::vector<std::string> keys = this->GetChoiceKeys();
150 for (
unsigned int i = 0; i < m_SelectedItems.size(); i++)
152 m_SelectedNames.push_back(names[m_SelectedItems[i]]);
153 m_SelectedKeys.push_back(keys[m_SelectedItems[i]]);
164 std::string choiceKey = GetChoiceKey(GetValue());
165 size_t lastPointPos = choiceKey.find_last_of(
'.');
167 if (lastPointPos != std::string::npos)
169 return choiceKey.substr(lastPointPos);
176 SetSelectedNames({value});
181 return GetSelectedNames();
186 SetSelectedNames(values);