14 namespace visualization {
30 " The default functions of these keys will be overridden.");
37 mouse_callbacks.substr(0, mouse_callbacks.size() - 2));
67 GLFWwindow *window,
int key,
int scancode,
int action,
int mods) {
70 if (action_callback->second(
this, action, mods)) {
77 if (action == GLFW_RELEASE) {
132 if (key == GLFW_KEY_SPACE) {
133 return std::string(
"Space");
134 }
else if (key >= 39 && key <= 96) {
135 return std::string(1,
char(key));
136 }
else if (key == GLFW_KEY_ESCAPE) {
137 return std::string(
"Esc");
138 }
else if (key == GLFW_KEY_ENTER) {
139 return std::string(
"Enter");
140 }
else if (key == GLFW_KEY_TAB) {
141 return std::string(
"Tab");
142 }
else if (key == GLFW_KEY_BACKSPACE) {
143 return std::string(
"Backspace");
144 }
else if (key == GLFW_KEY_INSERT) {
145 return std::string(
"Insert");
146 }
else if (key == GLFW_KEY_DELETE) {
147 return std::string(
"Delete");
148 }
else if (key == GLFW_KEY_RIGHT) {
149 return std::string(
"Right arrow");
150 }
else if (key == GLFW_KEY_LEFT) {
151 return std::string(
"Left arrow");
152 }
else if (key == GLFW_KEY_DOWN) {
153 return std::string(
"Down arrow");
154 }
else if (key == GLFW_KEY_UP) {
155 return std::string(
"Up arrow");
156 }
else if (key == GLFW_KEY_PAGE_UP) {
157 return std::string(
"Page up");
158 }
else if (key == GLFW_KEY_PAGE_DOWN) {
159 return std::string(
"Page down");
160 }
else if (key == GLFW_KEY_HOME) {
161 return std::string(
"Home");
162 }
else if (key == GLFW_KEY_END) {
163 return std::string(
"End");
164 }
else if (key == GLFW_KEY_CAPS_LOCK) {
165 return std::string(
"Caps lock");
166 }
else if (key == GLFW_KEY_SCROLL_LOCK) {
167 return std::string(
"Scroll lock");
168 }
else if (key == GLFW_KEY_NUM_LOCK) {
169 return std::string(
"Num lock");
170 }
else if (key == GLFW_KEY_PRINT_SCREEN) {
171 return std::string(
"PrtScn");
172 }
else if (key == GLFW_KEY_PAUSE) {
173 return std::string(
"Pause");
174 }
else if (key >= 290 && key <= 314) {
177 return std::string(
"Unknown");
std::function< void(std::shared_ptr< core::Tensor >)> callback
void RegisterMouseScrollCallback(std::function< bool(Visualizer *, double, double)> callback)
void RegisterMouseMoveCallback(std::function< bool(Visualizer *, double, double)> callback)
std::map< int, std::function< bool(Visualizer *, int, int)> > key_action_to_callback_
void MouseScrollCallback(GLFWwindow *window, double x, double y) override
std::function< bool(Visualizer *, int, int, int)> mouse_button_callback_
std::function< bool(Visualizer *, double, double)> mouse_scroll_callback_
void KeyPressCallback(GLFWwindow *window, int key, int scancode, int action, int mods) override
std::string PrintKeyToString(int key)
~VisualizerWithKeyCallback() override
void RegisterKeyActionCallback(int key, std::function< bool(Visualizer *, int, int)> callback)
VisualizerWithKeyCallback()
Default Constructor.
void MouseMoveCallback(GLFWwindow *window, double x, double y) override
void PrintVisualizerHelp() override
std::function< bool(Visualizer *, double, double)> mouse_move_callback_
void RegisterMouseButtonCallback(std::function< bool(Visualizer *, int, int, int)> callback)
void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods) override
std::map< int, std::function< bool(Visualizer *)> > key_to_callback_
void RegisterKeyCallback(int key, std::function< bool(Visualizer *)> callback)
The main Visualizer class.
virtual bool UpdateGeometry(std::shared_ptr< const ccHObject > geometry_ptr=nullptr)
Function to update geometry.
virtual void KeyPressCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
virtual void UpdateRender()
Function to inform render needed to be updated.
virtual void MouseScrollCallback(GLFWwindow *window, double x, double y)
virtual void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
virtual void MouseMoveCallback(GLFWwindow *window, double x, double y)
virtual void PrintVisualizerHelp()
Generic file read and write utility for python interface.
std::string to_string(const T &n)