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);
102 return m_SelectedItems;
109 return m_SelectedNames;
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);
This class represent a ListWidget parameter for the wrapper framework.
std::string GetChoiceKey(int i) const
itk::SmartPointer< const Self > ConstPointer
std::vector< std::string > m_SelectedNames
bool HasValue() const override
void FromString(const std::string &value) override
~ListViewParameter() override
virtual unsigned int GetValue() const
void SetSelectedItemsByNames()
std::vector< std::string > GetSelectedNames() const
void SetSelectedItemsByKeys()
ParameterType GetType() const override
unsigned int m_CurrentChoice
std::vector< std::string > ToStringList() const override
void SetSelectedItems(std::vector< int > selectedItems)
std::vector< ListViewChoice > ChoiceList
std::string GetChoiceName(int i)
unsigned int GetNbChoices(void)
std::vector< std::string > GetChoiceNames()
void operator=(const ListViewParameter &)=delete
void SetSelectedItems(std::vector< std::string > selectedItems)
void SetSelectedKeys(std::vector< std::string > selectedKeys)
void SetSelectedNames(std::vector< std::string > selectedNames)
std::vector< std::string > GetSelectedKeys()
std::vector< int > GetSelectedItems()
void AddChoice(std::string choicekey, std::string choiceName)
std::string ToString() const override
std::vector< int > m_SelectedItems
ListViewParameter(const ListViewParameter &)=delete
void ClearValue() override
virtual void SetValue(std::string choiceKey)
void FromStringList(const std::vector< std::string > &values) override
virtual void SetValue(unsigned int v)
itk::SmartPointer< Self > Pointer
std::vector< std::string > GetChoiceKeys()
std::vector< std::string > m_SelectedKeys
This class represent a parameter for the wrapper framework This class is a high level class represent...
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.