Open3D (C++ API)  0.18.0+252c867
VisualizerWithKeyCallback.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <map>
11 
13 
14 namespace open3d {
15 namespace visualization {
16 
21 public:
22  typedef std::pair<int, std::function<bool(Visualizer *)>> KeyCallbackPair;
23 
24 public:
27  ~VisualizerWithKeyCallback() override;
30  delete;
31 
32 public:
33  void PrintVisualizerHelp() override;
34  void RegisterKeyCallback(int key,
35  std::function<bool(Visualizer *)> callback);
49  int key, std::function<bool(Visualizer *, int, int)> callback);
50 
51 protected:
52  void KeyPressCallback(GLFWwindow *window,
53  int key,
54  int scancode,
55  int action,
56  int mods) override;
57  std::string PrintKeyToString(int key);
58 
59 protected:
60  std::map<int, std::function<bool(Visualizer *)>> key_to_callback_;
61  std::map<int, std::function<bool(Visualizer *, int, int)>>
63 };
64 
65 } // namespace visualization
66 } // namespace open3d
std::function< void(std::shared_ptr< core::Tensor >)> callback
Definition: FilamentRenderer.cpp:182
The main Visualizer class.
Definition: Visualizer.h:45
Visualizer with custom key callback capabilities.
Definition: VisualizerWithKeyCallback.h:20
std::map< int, std::function< bool(Visualizer *)> > key_to_callback_
Definition: VisualizerWithKeyCallback.h:60
void RegisterKeyActionCallback(int key, std::function< bool(Visualizer *, int, int)> callback)
Definition: VisualizerWithKeyCallback.cpp:36
VisualizerWithKeyCallback(const VisualizerWithKeyCallback &)=delete
void KeyPressCallback(GLFWwindow *window, int key, int scancode, int action, int mods) override
Definition: VisualizerWithKeyCallback.cpp:41
std::pair< int, std::function< bool(Visualizer *)> > KeyCallbackPair
Definition: VisualizerWithKeyCallback.h:22
VisualizerWithKeyCallback & operator=(const VisualizerWithKeyCallback &)=delete
std::string PrintKeyToString(int key)
Definition: VisualizerWithKeyCallback.cpp:66
void RegisterKeyCallback(int key, std::function< bool(Visualizer *)> callback)
Definition: VisualizerWithKeyCallback.cpp:31
~VisualizerWithKeyCallback() override
Definition: VisualizerWithKeyCallback.cpp:16
void PrintVisualizerHelp() override
Definition: VisualizerWithKeyCallback.cpp:18
std::map< int, std::function< bool(Visualizer *, int, int)> > key_action_to_callback_
Definition: VisualizerWithKeyCallback.h:62
VisualizerWithKeyCallback()
Default Constructor.
Definition: VisualizerWithKeyCallback.cpp:14
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c int
Definition: K4aPlugin.cpp:474
Definition: PinholeCameraIntrinsic.cpp:16