ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Label3D.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <string>
11 
12 namespace cloudViewer {
13 namespace visualization {
14 namespace gui {
15 
16 static const Color DEFAULT_COLOR(0, 0, 0, 1);
17 
18 struct Label3D::Impl {
19  std::string text_;
20  Eigen::Vector3f position_;
22 };
23 
24 Label3D::Label3D(const Eigen::Vector3f& pos, const char* text /*= nullptr*/)
25  : impl_(new Label3D::Impl()) {
26  SetPosition(pos);
27  if (text) {
28  SetText(text);
29  }
30 }
31 
33 
34 const char* Label3D::GetText() const { return impl_->text_.c_str(); }
35 
36 void Label3D::SetText(const char* text) { impl_->text_ = text; }
37 
38 Eigen::Vector3f Label3D::GetPosition() const { return impl_->position_; }
39 
40 void Label3D::SetPosition(const Eigen::Vector3f& pos) {
41  impl_->position_ = pos;
42 }
43 
44 Color Label3D::GetTextColor() const { return impl_->color_; }
45 
46 void Label3D::SetTextColor(const Color& color) { impl_->color_ = color; }
47 
48 } // namespace gui
49 } // namespace visualization
50 } // namespace cloudViewer
math::float4 color
void SetText(const char *text)
Sets the text of the label (copies text)
Definition: Label3D.cpp:36
void SetPosition(const Eigen::Vector3f &pos)
Definition: Label3D.cpp:40
void SetTextColor(const Color &color)
Definition: Label3D.cpp:46
Eigen::Vector3f GetPosition() const
Definition: Label3D.cpp:38
Label3D(const Eigen::Vector3f &pos, const char *text=nullptr)
Copies text.
Definition: Label3D.cpp:24
static const Color DEFAULT_COLOR(0, 0, 0, 0)
Generic file read and write utility for python interface.