Open3D (C++ API)
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
open3d::visualization::VisualizerWithKeyCallback Class Reference

Visualizer with custom key callack capabilities. More...

#include <VisualizerWithKeyCallback.h>

Inheritance diagram for open3d::visualization::VisualizerWithKeyCallback:
open3d::visualization::Visualizer

Public Types

typedef std::pair< int, std::function< bool(Visualizer *)> > KeyCallbackPair
 

Public Member Functions

 VisualizerWithKeyCallback ()
 Default Constructor. More...
 
 ~VisualizerWithKeyCallback () override
 
 VisualizerWithKeyCallback (const VisualizerWithKeyCallback &)=delete
 
VisualizerWithKeyCallbackoperator= (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)
 
- Public Member Functions inherited from open3d::visualization::Visualizer
 Visualizer ()
 
virtual ~Visualizer ()
 
 Visualizer (Visualizer &&)=delete
 
 Visualizer (const Visualizer &)=delete
 
Visualizeroperator= (const Visualizer &)=delete
 
bool CreateVisualizerWindow (const std::string &window_name="Open3D", 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 geometry::Geometry > 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 geometry::Geometry > 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 geometry::Geometry > 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 UpdateWindowTitle ()
 
virtual void BuildUtilities ()
 
ViewControlGetViewControl ()
 Function to retrieve the associated ViewControl. More...
 
RenderOptionGetRenderOption ()
 Function to retrieve the associated RenderOption. More...
 
std::shared_ptr< geometry::ImageCaptureScreenFloatBuffer (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::ImageCaptureDepthFloatBuffer (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
 
std::string PrintKeyToString (int key)
 
- Protected Member Functions inherited from open3d::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 ()
 
void CopyViewStatusToClipboard ()
 
void CopyViewStatusFromClipboard ()
 
virtual void WindowRefreshCallback (GLFWwindow *window)
 
virtual void WindowResizeCallback (GLFWwindow *window, int w, int h)
 
virtual void MouseMoveCallback (GLFWwindow *window, double x, double y)
 
virtual void MouseScrollCallback (GLFWwindow *window, double x, double y)
 
virtual void MouseButtonCallback (GLFWwindow *window, int button, int action, int mods)
 
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_
 
- Protected Attributes inherited from open3d::visualization::Visualizer
GLFWwindow * window_ = NULL
 
std::string window_name_ = "Open3D"
 
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_
 
std::unique_ptr< ViewControlview_control_ptr_
 
std::unique_ptr< RenderOptionrender_option_ptr_
 
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
 
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
 
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
 
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
 
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOptionutility_renderer_opts_
 
std::shared_ptr< geometry::TriangleMeshcoordinate_frame_mesh_ptr_
 
std::shared_ptr< glsl::CoordinateFrameRenderercoordinate_frame_mesh_renderer_ptr_
 

Detailed Description

Visualizer with custom key callack capabilities.

Member Typedef Documentation

◆ KeyCallbackPair

typedef std::pair<int, std::function<bool(Visualizer *)> > open3d::visualization::VisualizerWithKeyCallback::KeyCallbackPair

Constructor & Destructor Documentation

◆ VisualizerWithKeyCallback() [1/2]

open3d::visualization::VisualizerWithKeyCallback::VisualizerWithKeyCallback ( )

Default Constructor.

◆ ~VisualizerWithKeyCallback()

open3d::visualization::VisualizerWithKeyCallback::~VisualizerWithKeyCallback ( )
override

◆ VisualizerWithKeyCallback() [2/2]

open3d::visualization::VisualizerWithKeyCallback::VisualizerWithKeyCallback ( const VisualizerWithKeyCallback )
delete

Member Function Documentation

◆ KeyPressCallback()

void open3d::visualization::VisualizerWithKeyCallback::KeyPressCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)
overrideprotectedvirtual

Reimplemented from open3d::visualization::Visualizer.

◆ operator=()

VisualizerWithKeyCallback& open3d::visualization::VisualizerWithKeyCallback::operator= ( const VisualizerWithKeyCallback )
delete

◆ PrintKeyToString()

std::string open3d::visualization::VisualizerWithKeyCallback::PrintKeyToString ( int  key)
protected

◆ PrintVisualizerHelp()

void open3d::visualization::VisualizerWithKeyCallback::PrintVisualizerHelp ( )
overridevirtual

Reimplemented from open3d::visualization::Visualizer.

◆ RegisterKeyActionCallback()

void open3d::visualization::VisualizerWithKeyCallback::RegisterKeyActionCallback ( int  key,
std::function< bool(Visualizer *, int, int)>  callback 
)

Register callback function with access to GLFW key actions.

Parameters
keyGLFW key value, see GLFW key values.
callbackThe 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.

◆ RegisterKeyCallback()

void open3d::visualization::VisualizerWithKeyCallback::RegisterKeyCallback ( int  key,
std::function< bool(Visualizer *)>  callback 
)

Field Documentation

◆ key_action_to_callback_

std::map<int, std::function<bool(Visualizer *, int, int)> > open3d::visualization::VisualizerWithKeyCallback::key_action_to_callback_
protected

◆ key_to_callback_

std::map<int, std::function<bool(Visualizer *)> > open3d::visualization::VisualizerWithKeyCallback::key_to_callback_
protected

The documentation for this class was generated from the following files: