mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
Added description for OptionProperty
This commit is contained in:
@@ -87,6 +87,9 @@ public:
|
||||
void setValue(int value) override;
|
||||
|
||||
private:
|
||||
static const std::string OptionsKey;
|
||||
std::string generateAdditionalDescription() const;
|
||||
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
namespace properties {
|
||||
|
||||
const std::string OptionProperty::OptionsKey = "Options";
|
||||
|
||||
OptionProperty::OptionProperty(std::string identifier, std::string guiName)
|
||||
: IntProperty(std::move(identifier), std::move(guiName))
|
||||
@@ -73,5 +75,20 @@ void OptionProperty::setValue(int value) {
|
||||
LERROR("Could not find an option for value '" << value << "' in OptionProperty");
|
||||
}
|
||||
|
||||
std::string OptionProperty::generateAdditionalDescription() const {
|
||||
// @REFACTOR from selectionproperty.cpp, possible refactoring? ---abock
|
||||
std::string result;
|
||||
result += OptionsKey + " = {";
|
||||
for (size_t i = 0; i < _options.size(); ++i) {
|
||||
const Option& o = _options[i];
|
||||
result += "[\"" + std::to_string(o.value) + "\"] = \"" + o.description + "\"";
|
||||
if (i != _options.size() - 1)
|
||||
result += ",";
|
||||
}
|
||||
|
||||
result += "}";
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user