scenepic 1.1.0
3D Visualization Made Easy
label.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#ifndef _SCENEPIC_LABEL_H_
5#define _SCENEPIC_LABEL_H_
6
7#include "color.h"
8#include "json_value.h"
9#include "mesh.h"
10
11#include <cstdint>
12#include <string>
13
14namespace scenepic
15{
17 class Label
18 {
19 public:
21 const std::string& label_id() const;
22
24 const std::string& mesh_id() const;
25
27 const std::string& text() const;
28
30 Label& text(const std::string& value);
31
33 const Color& fill_color() const;
34
36 Label& fill_color(const Color& value);
37
39 double size_in_pixels() const;
40
42 Label& size_in_pixels(double value);
43
45 const std::string& font_family() const;
46
48 Label& font_family(const std::string& value);
49
52 const std::string& horizontal_align() const;
53
56 Label& horizontal_align(const std::string& value);
57
59 const std::string& vertical_align() const;
60
62 Label& vertical_align(const std::string& value);
63
66 double offset_distance() const;
67
70 Label& offset_distance(double value);
71
76 bool camera_space() const;
77
83
89 const std::string& layer_id() const;
90
96 Label& layer_id(const std::string& layer_id);
97
99 std::string to_string() const;
100
105
106 private:
107 friend class Scene;
108
115 Label(const std::string& label_id, const std::shared_ptr<Mesh>& mesh);
116
117 std::string m_label_id;
118 std::string m_text;
119 double m_size_in_pixels;
120 std::string m_font_family;
121 std::string m_horizontal_align;
122 std::string m_vertical_align;
123 double m_offset_distance;
124 std::shared_ptr<Mesh> m_mesh;
125 };
126} // namespace scenepic
127
128#endif
Class for representing color values.
Definition: color.h:19
Representation of a JSON value according to the specification at https://www.json....
Definition: json_value.h:30
A ScenePic label type.
Definition: label.h:18
const std::string & layer_id() const
An identifier to allow several Meshes to be grouped together into a "layer".
Label & vertical_align(const std::string &value)
How to align the label vertically (one of 'top', 'middle', 'bottom')
double offset_distance() const
Distance in world space to offset the label by when using left/right/top/bottom alignment.
const std::string & label_id() const
A unique identifier for the Label.
std::string to_string() const
Return a JSON string representing the object.
const std::string & mesh_id() const
The mesh associated with this label.
Label & text(const std::string &value)
The text to use in the label.
Label & camera_space(bool camera_space)
Whether this Mesh is defined in camera space (cannot be moved in the ScenePic user interface) or worl...
Label & layer_id(const std::string &layer_id)
An identifier to allow several Meshes to be grouped together into a "layer".
double size_in_pixels() const
The size in pixels to display the label at.
JsonValue to_json() const
Convert this object into ScenePic json.
Label & size_in_pixels(double value)
The size in pixels to display the label at.
Label & offset_distance(double value)
Distance in world space to offset the label by when using left/right/top/bottom alignment.
const std::string & text() const
The text to use in the label.
Label & font_family(const std::string &value)
HTML font family name.
Label & horizontal_align(const std::string &value)
How to align the label horizontally (one of 'left', 'center', 'right')
const std::string & font_family() const
HTML font family name.
bool camera_space() const
Whether this Mesh is defined in camera space (cannot be moved in the ScenePic user interface) or worl...
Label & fill_color(const Color &value)
The color to use.
const std::string & vertical_align() const
How to align the label vertically (one of 'top', 'middle', 'bottom')
const Color & fill_color() const
The color to use.
const std::string & horizontal_align() const
How to align the label horizontally (one of 'left', 'center', 'right')
Top level container representing an entire ScenePic.
Definition: scene.h:58
Definition: audio_track.h:14