mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-28 14:59:31 -05:00
Polish and docs for RenderableDistanceLabel and docs for RenderableNodeLine (#3485)
* Update add add documentation for `RenderableDistanceLabel` * Move distancelabel to `base` module and remove now empty `vislab` module * Add examples for `RenderableNodeLine` and `RenderableDistanceLabel` * Fix faultily formatted documentation ID for `RenderableNodeLine` * Make `RenderableDistanceLabel` unit use units from distanceconversion file And simplify how the different names for a unit are specified * Use new distanceUnitList() function for other classes that uses the units * Change default unit to correct option according to documentation * Make the text property readonly for `RenderableDistanceLabel` * Add property to specify the precision of the number distance label precision to docs * Add examples with different units and descriptors * Add docs description to `RenderableNodeLine` * Update name in one of the examples * Remove redundant switch cases * Apply suggestions from code review Co-authored-by: Ylva Selling <ylva.selling@gmail.com> --------- Co-authored-by: Ylva Selling <ylva.selling@gmail.com>
This commit is contained in:
@@ -319,19 +319,11 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
const std::string stringUnit = std::get<std::string>(*p.modelScale);
|
||||
|
||||
// Find matching unit name in list of supported unit names
|
||||
DistanceUnit distanceUnit;
|
||||
bool wasFound = false;
|
||||
for (int i = 0; i < DistanceUnitNamesSingular.size(); ++i) {
|
||||
if (stringUnit == DistanceUnitNamesSingular[i]) {
|
||||
wasFound = true;
|
||||
distanceUnit = DistanceUnits[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (wasFound) {
|
||||
try {
|
||||
DistanceUnit distanceUnit = distanceUnitFromString(stringUnit);
|
||||
_modelScale = toMeter(distanceUnit);
|
||||
}
|
||||
else {
|
||||
catch (const ghoul::MissingCaseException& e) {
|
||||
std::string message = std::format("The given unit name '{}' does not "
|
||||
"match any currently supported unit names", stringUnit);
|
||||
LERROR(message);
|
||||
|
||||
Reference in New Issue
Block a user