mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:03:11 +02:00
Optimization and coding standard
This commit is contained in:
parent
f0f12b0479
commit
8d4cecda62
2 changed files with 11 additions and 10 deletions
|
@ -358,18 +358,19 @@ bool Overlays::isLoaded(unsigned int id) {
|
||||||
return overlay->isLoaded();
|
return overlay->isLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
float Overlays::textWidth(unsigned int id, const QString& text) {
|
const float Overlays::textWidth(unsigned int id, const QString& text) {
|
||||||
if (_overlays2D.contains(id)) {
|
Overlay* thisOverlay = _overlays2D[id];
|
||||||
Overlay* thisOverlay = _overlays2D[id];
|
if (thisOverlay) {
|
||||||
if (typeid(*thisOverlay) == typeid(TextOverlay)) {
|
if (typeid(*thisOverlay) == typeid(TextOverlay)) {
|
||||||
return static_cast<TextOverlay*>(thisOverlay)->textWidth(text);
|
return static_cast<TextOverlay*>(thisOverlay)->textWidth(text);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
if (_overlays3D.contains(id)) {
|
thisOverlay = _overlays3D[id];
|
||||||
Overlay* thisOverlay = _overlays3D[id];
|
if (thisOverlay) {
|
||||||
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
||||||
return static_cast<Text3DOverlay*>(thisOverlay)->textWidth(text);
|
return static_cast<Text3DOverlay*>(thisOverlay)->textWidth(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0.f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public slots:
|
||||||
|
|
||||||
/// returns the width of the given text in the specified overlay if it is a text overlay: in pixels if it is a 2D text
|
/// returns the width of the given text in the specified overlay if it is a text overlay: in pixels if it is a 2D text
|
||||||
/// overlay; in meters if it is a 3D text overlay
|
/// overlay; in meters if it is a 3D text overlay
|
||||||
float textWidth(unsigned int id, const QString& text);
|
const float textWidth(unsigned int id, const QString& text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<unsigned int, Overlay*> _overlays2D;
|
QMap<unsigned int, Overlay*> _overlays2D;
|
||||||
|
|
Loading…
Reference in a new issue