![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Visualizer with custom key callack capabilities. More...
#include <VisualizerWithKeyCallback.h>


Public Types | |
| typedef std::pair< int, std::function< bool(Visualizer *)> > | KeyCallbackPair |
Public Member Functions | |
| VisualizerWithKeyCallback () | |
| Default Constructor. More... | |
| ~VisualizerWithKeyCallback () override | |
| VisualizerWithKeyCallback (const VisualizerWithKeyCallback &)=delete | |
| VisualizerWithKeyCallback & | operator= (const VisualizerWithKeyCallback &)=delete |
| void | PrintVisualizerHelp () override |
| void | RegisterKeyCallback (int key, std::function< bool(Visualizer *)> callback) |
| void | RegisterKeyActionCallback (int key, std::function< bool(Visualizer *, int, int)> callback) |
| void | RegisterMouseMoveCallback (std::function< bool(Visualizer *, double, double)> callback) |
| void | RegisterMouseScrollCallback (std::function< bool(Visualizer *, double, double)> callback) |
| void | RegisterMouseButtonCallback (std::function< bool(Visualizer *, int, int, int)> callback) |
Public Member Functions inherited from cloudViewer::visualization::Visualizer | |
| Visualizer () | |
| virtual | ~Visualizer () |
| Visualizer (Visualizer &&)=delete | |
| Visualizer (const Visualizer &)=delete | |
| Visualizer & | operator= (const Visualizer &)=delete |
| bool | CreateVisualizerWindow (const std::string &window_name="CloudViewer", const int width=640, const int height=480, const int left=50, const int top=50, const bool visible=true) |
| Function to create a window and initialize GLFW. More... | |
| void | DestroyVisualizerWindow () |
| Function to destroy a window. More... | |
| void | RegisterAnimationCallback (std::function< bool(Visualizer *)> callback_func) |
| Function to register a callback function for animation. More... | |
| void | Run () |
| Function to activate the window. More... | |
| void | Close () |
| Function to to notify the window to be closed. More... | |
| bool | WaitEvents () |
| Function to process the event queue and return if the window is closed. More... | |
| bool | PollEvents () |
| virtual bool | AddGeometry (std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true) |
| Function to add geometry to the scene and create corresponding shaders. More... | |
| virtual bool | RemoveGeometry (std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true) |
| Function to remove geometry from the scene. More... | |
| virtual bool | ClearGeometries () |
| virtual bool | UpdateGeometry (std::shared_ptr< const ccHObject > geometry_ptr=nullptr) |
| Function to update geometry. More... | |
| virtual bool | HasGeometry () const |
| virtual void | UpdateRender () |
| Function to inform render needed to be updated. More... | |
| virtual void | SetFullScreen (bool fullscreen) |
| Functions to change between fullscreen and windowed modes. More... | |
| virtual void | ToggleFullScreen () |
| virtual bool | IsFullScreen () |
| virtual void | UpdateWindowTitle () |
| virtual void | BuildUtilities () |
| ViewControl & | GetViewControl () |
| Function to retrieve the associated ViewControl. More... | |
| RenderOption & | GetRenderOption () |
| Function to retrieve the associated RenderOption. More... | |
| std::shared_ptr< geometry::Image > | CaptureScreenFloatBuffer (bool do_render=true) |
| Function to capture screen and store RGB in a float buffer. More... | |
| void | CaptureScreenImage (const std::string &filename="", bool do_render=true) |
| Function to capture and save a screen image. More... | |
| std::shared_ptr< geometry::Image > | CaptureDepthFloatBuffer (bool do_render=true) |
| void | CaptureDepthImage (const std::string &filename="", bool do_render=true, double depth_scale=1000.0) |
| void | CaptureDepthPointCloud (const std::string &filename="", bool do_render=true, bool convert_to_world_coordinate=false) |
| Function to capture and save local point cloud. More... | |
| void | CaptureRenderOption (const std::string &filename="") |
| void | ResetViewPoint (bool reset_bounding_box=false) |
| Function to reset view point. More... | |
| const std::string & | GetWindowName () const |
Protected Member Functions | |
| void | KeyPressCallback (GLFWwindow *window, int key, int scancode, int action, int mods) override |
| void | MouseMoveCallback (GLFWwindow *window, double x, double y) override |
| void | MouseScrollCallback (GLFWwindow *window, double x, double y) override |
| void | MouseButtonCallback (GLFWwindow *window, int button, int action, int mods) override |
| std::string | PrintKeyToString (int key) |
Protected Member Functions inherited from cloudViewer::visualization::Visualizer | |
| virtual bool | InitOpenGL () |
| Function to initialize OpenGL. More... | |
| virtual bool | InitViewControl () |
| Function to initialize ViewControl. More... | |
| virtual bool | InitRenderOption () |
| Function to initialize RenderOption. More... | |
| virtual void | Render (bool render_screen=false) |
| void | CopyViewStatusToClipboard () |
| void | CopyViewStatusFromClipboard () |
| virtual void | WindowRefreshCallback (GLFWwindow *window) |
| virtual void | WindowResizeCallback (GLFWwindow *window, int w, int h) |
| virtual void | WindowCloseCallback (GLFWwindow *window) |
| Function to notify the window to be closed. More... | |
Protected Attributes | |
| std::map< int, std::function< bool(Visualizer *)> > | key_to_callback_ |
| std::map< int, std::function< bool(Visualizer *, int, int)> > | key_action_to_callback_ |
| std::function< bool(Visualizer *, double, double)> | mouse_move_callback_ |
| std::function< bool(Visualizer *, double, double)> | mouse_scroll_callback_ |
| std::function< bool(Visualizer *, int, int, int)> | mouse_button_callback_ |
Protected Attributes inherited from cloudViewer::visualization::Visualizer | |
| GLFWwindow * | window_ = nullptr |
| std::string | window_name_ = "CloudViewer" |
| std::shared_ptr< GLFWContext > | glfw_context_ = nullptr |
| Shared GLFW context. More... | |
| Eigen::Vector2i | saved_window_size_ = Eigen::Vector2i::Zero() |
| Eigen::Vector2i | saved_window_pos_ = Eigen::Vector2i::Zero() |
| std::function< bool(Visualizer *)> | animation_callback_func_ = nullptr |
| std::function< bool(Visualizer *)> | animation_callback_func_in_loop_ |
| MouseControl | mouse_control_ |
| bool | is_redraw_required_ = true |
| bool | is_initialized_ = false |
| GLuint | vao_id_ = 0 |
| GLuint | render_fbo_ = 0 |
| GLuint | render_rgb_tex_ = 0 |
| GLuint | render_depth_stencil_rbo_ = 0 |
| std::unique_ptr< ViewControl > | view_control_ptr_ |
| std::unique_ptr< RenderOption > | render_option_ptr_ |
| std::unordered_set< std::shared_ptr< const ccHObject > > | geometry_ptrs_ |
| std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > | geometry_renderer_ptrs_ |
| std::vector< std::shared_ptr< const ccHObject > > | utility_ptrs_ |
| std::vector< std::shared_ptr< glsl::GeometryRenderer > > | utility_renderer_ptrs_ |
| std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > | utility_renderer_opts_ |
| std::shared_ptr< ccMesh > | coordinate_frame_mesh_ptr_ |
| std::shared_ptr< glsl::CoordinateFrameRenderer > | coordinate_frame_mesh_renderer_ptr_ |
Visualizer with custom key callack capabilities.
Definition at line 20 of file VisualizerWithKeyCallback.h.
| typedef std::pair<int, std::function<bool(Visualizer *)> > cloudViewer::visualization::VisualizerWithKeyCallback::KeyCallbackPair |
Definition at line 22 of file VisualizerWithKeyCallback.h.
| cloudViewer::visualization::VisualizerWithKeyCallback::VisualizerWithKeyCallback | ( | ) |
Default Constructor.
Definition at line 17 of file VisualizerWithKeyCallback.cpp.
|
override |
Definition at line 19 of file VisualizerWithKeyCallback.cpp.
|
delete |
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
Definition at line 66 of file VisualizerWithKeyCallback.cpp.
References callback, key_action_to_callback_, key_to_callback_, cloudViewer::visualization::Visualizer::KeyPressCallback(), cloudViewer::visualization::Visualizer::UpdateGeometry(), and cloudViewer::visualization::Visualizer::UpdateRender().
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
Definition at line 117 of file VisualizerWithKeyCallback.cpp.
References mouse_button_callback_, cloudViewer::visualization::Visualizer::MouseButtonCallback(), cloudViewer::visualization::Visualizer::UpdateGeometry(), and cloudViewer::visualization::Visualizer::UpdateRender().
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
Definition at line 91 of file VisualizerWithKeyCallback.cpp.
References mouse_move_callback_, cloudViewer::visualization::Visualizer::MouseMoveCallback(), cloudViewer::visualization::Visualizer::UpdateGeometry(), and cloudViewer::visualization::Visualizer::UpdateRender().
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
Definition at line 104 of file VisualizerWithKeyCallback.cpp.
References mouse_scroll_callback_, cloudViewer::visualization::Visualizer::MouseScrollCallback(), cloudViewer::visualization::Visualizer::UpdateGeometry(), and cloudViewer::visualization::Visualizer::UpdateRender().
|
delete |
|
protected |
Definition at line 131 of file VisualizerWithKeyCallback.cpp.
References patch::to_string().
Referenced by PrintVisualizerHelp().
|
overridevirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
Definition at line 21 of file VisualizerWithKeyCallback.cpp.
References key_to_callback_, LogInfo, mouse_button_callback_, mouse_move_callback_, mouse_scroll_callback_, PrintKeyToString(), and cloudViewer::visualization::Visualizer::PrintVisualizerHelp().
| void cloudViewer::visualization::VisualizerWithKeyCallback::RegisterKeyActionCallback | ( | int | key, |
| std::function< bool(Visualizer *, int, int)> | callback | ||
| ) |
Register callback function with access to GLFW key actions.
| key | GLFW key value, see GLFW key values. |
| callback | The callback function. The callback function takes Visualizer *, action and mods as input and returns a boolean indicating UpdateGeometry() needs to be run. The action can be one of GLFW_RELEASE (0), GLFW_PRESS (1) or GLFW_REPEAT (2), see GLFW input interface. The mods specifies the modifier key, see GLFW modifier key. |
Definition at line 46 of file VisualizerWithKeyCallback.cpp.
References callback, and key_action_to_callback_.
Referenced by cloudViewer::visualization::pybind_visualizer().
| void cloudViewer::visualization::VisualizerWithKeyCallback::RegisterKeyCallback | ( | int | key, |
| std::function< bool(Visualizer *)> | callback | ||
| ) |
Definition at line 41 of file VisualizerWithKeyCallback.cpp.
References callback, and key_to_callback_.
Referenced by cloudViewer::visualization::DrawGeometriesWithKeyCallbacks(), and cloudViewer::visualization::pybind_visualizer().
| void cloudViewer::visualization::VisualizerWithKeyCallback::RegisterMouseButtonCallback | ( | std::function< bool(Visualizer *, int, int, int)> | callback | ) |
Register callback function with access to GLFW mouse actions.
| callback | The callback function. The callback function takes Visualizer *, button, action and mods as input and returns a boolean indicating UpdateGeometry() needs to be run. The action can be one of GLFW_RELEASE (0), GLFW_PRESS (1) or GLFW_REPEAT (2), see GLFW input interface. The mods specifies the modifier key, see GLFW modifier key. |
Definition at line 61 of file VisualizerWithKeyCallback.cpp.
References callback, and mouse_button_callback_.
Referenced by cloudViewer::visualization::pybind_visualizer().
| void cloudViewer::visualization::VisualizerWithKeyCallback::RegisterMouseMoveCallback | ( | std::function< bool(Visualizer *, double, double)> | callback | ) |
Register callback function with access to GLFW mouse actions.
| callback | The callback function. The callback function takes Visualizer *, and the x and y mouse position inside the window and returns a boolean indicating if UpdateGeometry() needs to be run. See GLFW mouse position for more details. |
Definition at line 51 of file VisualizerWithKeyCallback.cpp.
References callback, and mouse_move_callback_.
Referenced by cloudViewer::visualization::pybind_visualizer().
| void cloudViewer::visualization::VisualizerWithKeyCallback::RegisterMouseScrollCallback | ( | std::function< bool(Visualizer *, double, double)> | callback | ) |
Register callback function with access to GLFW mouse actions.
| callback | The callback function. The callback function takes Visualizer *, and the x and y scroll values and returns a boolean indicating if UpdateGeometry() needs to be run. A normal mouse only provides a y scroll value. See GLFW mouse scrolling for more details. |
Definition at line 56 of file VisualizerWithKeyCallback.cpp.
References callback, and mouse_scroll_callback_.
Referenced by cloudViewer::visualization::pybind_visualizer().
|
protected |
Definition at line 102 of file VisualizerWithKeyCallback.h.
Referenced by KeyPressCallback(), and RegisterKeyActionCallback().
|
protected |
Definition at line 100 of file VisualizerWithKeyCallback.h.
Referenced by KeyPressCallback(), PrintVisualizerHelp(), and RegisterKeyCallback().
|
protected |
Definition at line 105 of file VisualizerWithKeyCallback.h.
Referenced by MouseButtonCallback(), PrintVisualizerHelp(), and RegisterMouseButtonCallback().
|
protected |
Definition at line 103 of file VisualizerWithKeyCallback.h.
Referenced by MouseMoveCallback(), PrintVisualizerHelp(), and RegisterMouseMoveCallback().
|
protected |
Definition at line 104 of file VisualizerWithKeyCallback.h.
Referenced by MouseScrollCallback(), PrintVisualizerHelp(), and RegisterMouseScrollCallback().