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:
Emma Broman
2025-01-29 16:11:47 +01:00
committed by GitHub
parent ad0e5b92dc
commit 3d3580fa65
18 changed files with 267 additions and 346 deletions
+3 -11
View File
@@ -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);