ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::visualization::VisualizerWithEditing Class Reference

Visualizer with editing capabilities. More...

#include <VisualizerWithEditing.h>

Inheritance diagram for cloudViewer::visualization::VisualizerWithEditing:
Collaboration diagram for cloudViewer::visualization::VisualizerWithEditing:

Public Types

enum class  SelectionMode { None = 0 , Rectangle = 1 , Polygon = 2 }
 

Public Member Functions

 VisualizerWithEditing (double voxel_size=-1.0, bool use_dialog=true, const std::string &directory="")
 
 ~VisualizerWithEditing () override
 
 VisualizerWithEditing (const VisualizerWithEditing &)=delete
 
VisualizerWithEditingoperator= (const VisualizerWithEditing &)=delete
 
bool AddGeometry (std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true) override
 Function to add geometry to the scene and create corresponding shaders. More...
 
void PrintVisualizerHelp () override
 
void UpdateWindowTitle () override
 
void BuildUtilities () override
 
int PickPoint (double x, double y)
 
std::vector< size_t > & GetPickedPoints ()
 
- Public Member Functions inherited from cloudViewer::visualization::Visualizer
 Visualizer ()
 
virtual ~Visualizer ()
 
 Visualizer (Visualizer &&)=delete
 
 Visualizer (const Visualizer &)=delete
 
Visualizeroperator= (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 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 ()
 
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

bool InitViewControl () override
 Function to initialize ViewControl. More...
 
bool InitRenderOption () override
 Function to initialize RenderOption. More...
 
void WindowResizeCallback (GLFWwindow *window, int w, int h) 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
 
void KeyPressCallback (GLFWwindow *window, int key, int scancode, int action, int mods) override
 
void InvalidateSelectionPolygon ()
 
void InvalidatePicking ()
 
void SaveCroppingResult (const std::string &filename="")
 
- Protected Member Functions inherited from cloudViewer::visualization::Visualizer
virtual bool InitOpenGL ()
 Function to initialize OpenGL. More...
 
virtual void Render (bool render_screen=false)
 
void CopyViewStatusToClipboard ()
 
void CopyViewStatusFromClipboard ()
 
virtual void WindowRefreshCallback (GLFWwindow *window)
 
virtual void WindowCloseCallback (GLFWwindow *window)
 Function to notify the window to be closed. More...
 

Protected Attributes

std::shared_ptr< SelectionPolygonselection_polygon_ptr_
 
std::shared_ptr< glsl::SelectionPolygonRenderer > selection_polygon_renderer_ptr_
 
SelectionMode selection_mode_ = SelectionMode::None
 
std::shared_ptr< PointCloudPickerpointcloud_picker_ptr_
 
std::shared_ptr< glsl::PointCloudPickerRenderer > pointcloud_picker_renderer_ptr_
 
std::shared_ptr< const ccHObjectoriginal_geometry_ptr_
 
std::shared_ptr< ccHObjectediting_geometry_ptr_
 
std::shared_ptr< glsl::GeometryRenderer > editing_geometry_renderer_ptr_
 
double voxel_size_ = -1.0
 
bool use_dialog_ = true
 
std::string default_directory_
 
unsigned int crop_action_count_ = 0
 
- Protected Attributes inherited from cloudViewer::visualization::Visualizer
GLFWwindow * window_ = nullptr
 
std::string window_name_ = "CloudViewer"
 
std::shared_ptr< GLFWContextglfw_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< ViewControlview_control_ptr_
 
std::unique_ptr< RenderOptionrender_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 >, RenderOptionutility_renderer_opts_
 
std::shared_ptr< ccMeshcoordinate_frame_mesh_ptr_
 
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
 

Detailed Description

Visualizer with editing capabilities.

Definition at line 21 of file VisualizerWithEditing.h.

Member Enumeration Documentation

◆ SelectionMode

Enumerator
None 
Rectangle 
Polygon 

Definition at line 23 of file VisualizerWithEditing.h.

Constructor & Destructor Documentation

◆ VisualizerWithEditing() [1/2]

cloudViewer::visualization::VisualizerWithEditing::VisualizerWithEditing ( double  voxel_size = -1.0,
bool  use_dialog = true,
const std::string &  directory = "" 
)
inline

Function to add geometry to the scene and create corresponding shaders.

Parameters
geometryThe Geometry object.

Definition at line 33 of file VisualizerWithEditing.h.

◆ ~VisualizerWithEditing()

cloudViewer::visualization::VisualizerWithEditing::~VisualizerWithEditing ( )
inlineoverride

Definition at line 39 of file VisualizerWithEditing.h.

◆ VisualizerWithEditing() [2/2]

cloudViewer::visualization::VisualizerWithEditing::VisualizerWithEditing ( const VisualizerWithEditing )
delete

Member Function Documentation

◆ AddGeometry()

bool cloudViewer::visualization::VisualizerWithEditing::AddGeometry ( std::shared_ptr< const ccHObject geometry_ptr,
bool  reset_bounding_box = true 
)
overridevirtual

Function to add geometry to the scene and create corresponding shaders.

  1. After calling this function, the Visualizer owns the geometry object.
  2. This function MUST be called after CreateVisualizerWindow().
  3. This function returns FALSE when the geometry is of an unsupported type.
  4. If an added geometry is changed, the behavior of Visualizer is undefined. Programmers are responsible for calling Geometry() to notify the Visualizer that the geometry has been changed and the Visualizer should be updated accordingly.
Parameters
geometry_ptrThe Geometry object.

Reimplemented from cloudViewer::visualization::Visualizer.

Definition at line 32 of file VisualizerWithEditing.cpp.

References CV_TYPES::CUSTOM_H_OBJECT, editing_geometry_ptr_, editing_geometry_renderer_ptr_, cloudViewer::visualization::Visualizer::geometry_ptrs_, cloudViewer::visualization::Visualizer::geometry_renderer_ptrs_, CV_TYPES::HALF_EDGE_MESH, CV_TYPES::IMAGE2, cloudViewer::visualization::Visualizer::is_initialized_, CV_TYPES::LINESET, LogDebug, CV_TYPES::MESH, original_geometry_ptr_, CV_TYPES::POINT_CLOUD, cloudViewer::visualization::Visualizer::ResetViewPoint(), cloudViewer::visualization::Visualizer::UpdateGeometry(), cloudViewer::visualization::Visualizer::view_control_ptr_, and cloudViewer::visualization::Visualizer::window_.

Referenced by cloudViewer::visualization::DrawGeometriesWithEditing(), and main().

◆ BuildUtilities()

◆ GetPickedPoints()

◆ InitRenderOption()

bool cloudViewer::visualization::VisualizerWithEditing::InitRenderOption ( )
overrideprotectedvirtual

◆ InitViewControl()

bool cloudViewer::visualization::VisualizerWithEditing::InitViewControl ( )
overrideprotectedvirtual

◆ InvalidatePicking()

void cloudViewer::visualization::VisualizerWithEditing::InvalidatePicking ( )
protected

Definition at line 637 of file VisualizerWithEditing.cpp.

References pointcloud_picker_ptr_, and pointcloud_picker_renderer_ptr_.

Referenced by KeyPressCallback().

◆ InvalidateSelectionPolygon()

void cloudViewer::visualization::VisualizerWithEditing::InvalidateSelectionPolygon ( )
protected

◆ KeyPressCallback()

◆ MouseButtonCallback()

◆ MouseMoveCallback()

void cloudViewer::visualization::VisualizerWithEditing::MouseMoveCallback ( GLFWwindow *  window,
double  x,
double  y 
)
overrideprotectedvirtual

◆ MouseScrollCallback()

void cloudViewer::visualization::VisualizerWithEditing::MouseScrollCallback ( GLFWwindow *  window,
double  x,
double  y 
)
overrideprotectedvirtual

◆ operator=()

VisualizerWithEditing& cloudViewer::visualization::VisualizerWithEditing::operator= ( const VisualizerWithEditing )
delete

◆ PickPoint()

◆ PrintVisualizerHelp()

void cloudViewer::visualization::VisualizerWithEditing::PrintVisualizerHelp ( )
overridevirtual

◆ SaveCroppingResult()

◆ UpdateWindowTitle()

void cloudViewer::visualization::VisualizerWithEditing::UpdateWindowTitle ( )
overridevirtual

◆ WindowResizeCallback()

void cloudViewer::visualization::VisualizerWithEditing::WindowResizeCallback ( GLFWwindow *  window,
int  w,
int  h 
)
overrideprotectedvirtual

Member Data Documentation

◆ crop_action_count_

unsigned int cloudViewer::visualization::VisualizerWithEditing::crop_action_count_ = 0
protected

Definition at line 88 of file VisualizerWithEditing.h.

Referenced by KeyPressCallback().

◆ default_directory_

std::string cloudViewer::visualization::VisualizerWithEditing::default_directory_
protected

Definition at line 87 of file VisualizerWithEditing.h.

Referenced by KeyPressCallback().

◆ editing_geometry_ptr_

std::shared_ptr<ccHObject> cloudViewer::visualization::VisualizerWithEditing::editing_geometry_ptr_
protected

◆ editing_geometry_renderer_ptr_

std::shared_ptr<glsl::GeometryRenderer> cloudViewer::visualization::VisualizerWithEditing::editing_geometry_renderer_ptr_
protected

Definition at line 83 of file VisualizerWithEditing.h.

Referenced by AddGeometry(), and KeyPressCallback().

◆ original_geometry_ptr_

std::shared_ptr<const ccHObject> cloudViewer::visualization::VisualizerWithEditing::original_geometry_ptr_
protected

Definition at line 81 of file VisualizerWithEditing.h.

Referenced by AddGeometry(), and KeyPressCallback().

◆ pointcloud_picker_ptr_

std::shared_ptr<PointCloudPicker> cloudViewer::visualization::VisualizerWithEditing::pointcloud_picker_ptr_
protected

◆ pointcloud_picker_renderer_ptr_

std::shared_ptr<glsl::PointCloudPickerRenderer> cloudViewer::visualization::VisualizerWithEditing::pointcloud_picker_renderer_ptr_
protected

Definition at line 79 of file VisualizerWithEditing.h.

Referenced by BuildUtilities(), and InvalidatePicking().

◆ selection_mode_

SelectionMode cloudViewer::visualization::VisualizerWithEditing::selection_mode_ = SelectionMode::None
protected

◆ selection_polygon_ptr_

std::shared_ptr<SelectionPolygon> cloudViewer::visualization::VisualizerWithEditing::selection_polygon_ptr_
protected

◆ selection_polygon_renderer_ptr_

std::shared_ptr<glsl::SelectionPolygonRenderer> cloudViewer::visualization::VisualizerWithEditing::selection_polygon_renderer_ptr_
protected

◆ use_dialog_

bool cloudViewer::visualization::VisualizerWithEditing::use_dialog_ = true
protected

Definition at line 86 of file VisualizerWithEditing.h.

Referenced by KeyPressCallback().

◆ voxel_size_

double cloudViewer::visualization::VisualizerWithEditing::voxel_size_ = -1.0
protected

Definition at line 85 of file VisualizerWithEditing.h.

Referenced by KeyPressCallback().


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