mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +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();
|
||||
}
|
||||
|
||||
float Overlays::textWidth(unsigned int id, const QString& text) {
|
||||
if (_overlays2D.contains(id)) {
|
||||
Overlay* thisOverlay = _overlays2D[id];
|
||||
const float Overlays::textWidth(unsigned int id, const QString& text) {
|
||||
Overlay* thisOverlay = _overlays2D[id];
|
||||
if (thisOverlay) {
|
||||
if (typeid(*thisOverlay) == typeid(TextOverlay)) {
|
||||
return static_cast<TextOverlay*>(thisOverlay)->textWidth(text);
|
||||
}
|
||||
}
|
||||
if (_overlays3D.contains(id)) {
|
||||
Overlay* thisOverlay = _overlays3D[id];
|
||||
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
||||
return static_cast<Text3DOverlay*>(thisOverlay)->textWidth(text);
|
||||
} else {
|
||||
thisOverlay = _overlays3D[id];
|
||||
if (thisOverlay) {
|
||||
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
||||
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
|
||||
/// 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:
|
||||
QMap<unsigned int, Overlay*> _overlays2D;
|
||||
|
|
Loading…
Reference in a new issue