opensurgsim
TextRepresentation.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_TEXTREPRESENTATION_H
17 #define SURGSIM_GRAPHICS_TEXTREPRESENTATION_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Graphics/Representation.h"
22 #include "SurgSim/DataStructures/OptionalValue.h"
23 #include "SurgSim/Math/Vector.h"
24 
25 namespace SurgSim
26 {
27 namespace Framework
28 {
29 class Asset;
30 }
31 namespace Graphics
32 {
33 
34 class Font;
35 
39 class TextRepresentation : public virtual Representation
40 {
41 public:
44  explicit TextRepresentation(const std::string name);
45 
47  virtual ~TextRepresentation() {}
48 
51  virtual void loadFont(const std::string& fileName) = 0;
52 
55  virtual void setFont(std::shared_ptr<SurgSim::Framework::Asset> font) = 0;
56 
58  virtual std::shared_ptr<Font> getFont() const = 0;
59 
62  virtual void setLocation(double x, double y) = 0;
63 
66  virtual void getLocation(double* x, double* y) const = 0;
67 
70  virtual void setText(const std::string& text) = 0;
71 
73  virtual std::string getText() const = 0;
74 
79  virtual void setMaximumWidth(double width) = 0;
80 
82  virtual double getMaximumWidth() = 0;
83 
86  virtual void setFontSize(double size) = 0;
87 
89  virtual double getFontSize() const = 0;
90 
93  virtual void setColor(SurgSim::Math::Vector4d color) = 0;
94 
96  virtual SurgSim::Math::Vector4d getColor() const = 0;
97 
102  virtual void setUseScreenSpace(bool value) = 0;
103 
105  virtual bool isUsingScreenSpace() const = 0;
106 
109  virtual void setDrawBackground(bool value) = 0;
110 
112  virtual bool isDrawingBackground() const = 0;
113 
116  virtual void setBackgroundColor(Math::Vector4d color) = 0;
117 
119  virtual Math::Vector4d getBackgroundColor() = 0;
120 
125  virtual void setBackgroundMargin(double margin) = 0;
126 
128  virtual double getBackgroundMargin() const = 0;
129 
130 protected:
135  virtual void setOptionalMaximumWidth(SurgSim::DataStructures::OptionalValue<double> width) = 0;
136 
139  virtual SurgSim::DataStructures::OptionalValue<double> getOptionalMaximumWidth() = 0;
140 };
141 
142 }; // Graphics
143 }; // SurgSim
144 
145 #endif // SURGSIM_GRAPHICS_TEXTREPRESENTATION_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:61
A text to be displayed on the screen in screen space coordinates, use setPose() to set the position b...
Definition: TextRepresentation.h:39
virtual ~TextRepresentation()
Destructor.
Definition: TextRepresentation.h:47
Base graphics representation class, which defines the interface that all graphics representations mus...
Definition: Representation.h:40
Definitions of small fixed-size vector types.