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

#include <VisualizerWithVertexSelection.h>

Inheritance diagram for cloudViewer::visualization::VisualizerWithVertexSelection:
Collaboration diagram for cloudViewer::visualization::VisualizerWithVertexSelection:

Classes

struct  PickedPoint
 

Public Types

enum class  SelectionMode { None = 0 , Point = 1 , Rectangle = 2 , Moving = 3 }
 

Public Member Functions

 VisualizerWithVertexSelection ()
 
 ~VisualizerWithVertexSelection () override
 
 VisualizerWithVertexSelection (const VisualizerWithVertexSelection &)=delete
 
VisualizerWithVertexSelectionoperator= (const VisualizerWithVertexSelection &)=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...
 
bool UpdateGeometry (std::shared_ptr< const ccHObject > geometry_ptr=nullptr) override
 Function to update geometry. More...
 
void PrintVisualizerHelp () override
 
void UpdateWindowTitle () override
 
void BuildUtilities () override
 
void SetPointSize (double size)
 
std::vector< int > PickPoints (double x, double y, double w, double h)
 
std::vector< PickedPointGetPickedPoints () const
 
void ClearPickedPoints ()
 
void AddPickedPoints (const std::vector< int > indices)
 
void RemovePickedPoints (const std::vector< int > indices)
 
void RegisterSelectionChangedCallback (std::function< void()> f)
 
void RegisterSelectionMovingCallback (std::function< void()> f)
 
void RegisterSelectionMovedCallback (std::function< void()> f)
 
- 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 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 Types

enum  DragType { DRAG_MOVING , DRAG_END }
 

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 ()
 
float GetDepth (int winX, int winY)
 
Eigen::Vector3d CalcDragDelta (double winX, double winY)
 
void DragSelectedPoints (const Eigen::Vector3d &delta, DragType type)
 
const std::vector< CCVector3 > * GetGeometryPoints (std::shared_ptr< const ccHObject > geometry)
 
const std::vector< Eigen::Vector3d > * GetGeometryEigenPoints (std::shared_ptr< const ccHObject > geometry)
 
- 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
 
Eigen::Vector2d mouse_down_pos_
 
std::vector< int > points_in_rect_
 
float drag_depth_ = 0.0f
 
std::shared_ptr< PointCloudPickerpointcloud_picker_ptr_
 
std::shared_ptr< glsl::PointCloudPickerRenderer > pointcloud_picker_renderer_ptr_
 
std::shared_ptr< const ccHObjectgeometry_ptr_
 
std::shared_ptr< glsl::GeometryRenderer > geometry_renderer_ptr_
 
RenderOption pick_point_opts_
 
std::shared_ptr< ccPointCloudui_points_geometry_ptr_
 
std::shared_ptr< glsl::GeometryRenderer > ui_points_renderer_ptr_
 
std::unordered_map< int, Eigen::Vector3d > selected_points_
 
std::unordered_map< int, Eigen::Vector3d > selected_points_before_drag_
 
std::shared_ptr< ccPointCloudui_selected_points_geometry_ptr_
 
std::shared_ptr< glsl::GeometryRenderer > ui_selected_points_renderer_ptr_
 
std::function< void()> on_selection_changed_
 
std::function< void()> on_selection_moving_
 
std::function< void()> on_selection_moved_
 
- 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

Definition at line 22 of file VisualizerWithVertexSelection.h.

Member Enumeration Documentation

◆ DragType

Enumerator
DRAG_MOVING 
DRAG_END 

Definition at line 79 of file VisualizerWithVertexSelection.h.

◆ SelectionMode

Enumerator
None 
Point 
Rectangle 
Moving 

Definition at line 24 of file VisualizerWithVertexSelection.h.

Constructor & Destructor Documentation

◆ VisualizerWithVertexSelection() [1/2]

cloudViewer::visualization::VisualizerWithVertexSelection::VisualizerWithVertexSelection ( )
inline

Definition at line 27 of file VisualizerWithVertexSelection.h.

◆ ~VisualizerWithVertexSelection()

cloudViewer::visualization::VisualizerWithVertexSelection::~VisualizerWithVertexSelection ( )
inlineoverride

Definition at line 28 of file VisualizerWithVertexSelection.h.

◆ VisualizerWithVertexSelection() [2/2]

cloudViewer::visualization::VisualizerWithVertexSelection::VisualizerWithVertexSelection ( const VisualizerWithVertexSelection )
delete

Member Function Documentation

◆ AddGeometry()

bool cloudViewer::visualization::VisualizerWithVertexSelection::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 82 of file VisualizerWithVertexSelection.cpp.

References CV_TYPES::BBOX, CV_TYPES::CUSTOM_H_OBJECT, geometry_ptr_, cloudViewer::visualization::Visualizer::geometry_ptrs_, geometry_renderer_ptr_, cloudViewer::visualization::Visualizer::geometry_renderer_ptrs_, CV_TYPES::HALF_EDGE_MESH, CV_TYPES::HIERARCHY_OBJECT, CV_TYPES::IMAGE2, cloudViewer::visualization::Visualizer::is_initialized_, cloudViewer::visualization::RenderOption::LEqual, cloudViewer::visualization::RenderOption::Less, CV_TYPES::LINESET, LogDebug, LogInfo, CV_TYPES::MESH, CV_TYPES::MESH_BASE, CV_TYPES::ORIENTED_BBOX, CV_TYPES::POINT_CLOUD, CV_TYPES::POINT_OCTREE2, cloudViewer::visualization::Visualizer::ResetViewPoint(), CV_TYPES::RGBD_IMAGE, SetPointSize(), CV_TYPES::TETRA_MESH, ui_points_geometry_ptr_, ui_points_renderer_ptr_, ui_selected_points_geometry_ptr_, ui_selected_points_renderer_ptr_, UpdateGeometry(), cloudViewer::visualization::Visualizer::utility_renderer_opts_, cloudViewer::visualization::Visualizer::utility_renderer_ptrs_, cloudViewer::visualization::Visualizer::view_control_ptr_, CV_TYPES::VOXEL_GRID, and cloudViewer::visualization::Visualizer::window_.

Referenced by cloudViewer::visualization::DrawGeometriesWithVertexSelection().

◆ AddPickedPoints()

◆ BuildUtilities()

◆ CalcDragDelta()

Eigen::Vector3d cloudViewer::visualization::VisualizerWithVertexSelection::CalcDragDelta ( double  winX,
double  winY 
)
protected

◆ ClearPickedPoints()

void cloudViewer::visualization::VisualizerWithVertexSelection::ClearPickedPoints ( )

◆ DragSelectedPoints()

void cloudViewer::visualization::VisualizerWithVertexSelection::DragSelectedPoints ( const Eigen::Vector3d &  delta,
DragType  type 
)
protected

◆ GetDepth()

◆ GetGeometryEigenPoints()

const std::vector< Eigen::Vector3d > * cloudViewer::visualization::VisualizerWithVertexSelection::GetGeometryEigenPoints ( std::shared_ptr< const ccHObject geometry)
protected

◆ GetGeometryPoints()

const std::vector< CCVector3 > * cloudViewer::visualization::VisualizerWithVertexSelection::GetGeometryPoints ( std::shared_ptr< const ccHObject geometry)
protected

◆ GetPickedPoints()

std::vector< VisualizerWithVertexSelection::PickedPoint > cloudViewer::visualization::VisualizerWithVertexSelection::GetPickedPoints ( ) const

◆ InitRenderOption()

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

◆ InitViewControl()

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

◆ InvalidatePicking()

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

◆ InvalidateSelectionPolygon()

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

◆ KeyPressCallback()

◆ MouseButtonCallback()

◆ MouseMoveCallback()

◆ MouseScrollCallback()

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

◆ operator=()

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

◆ PickPoints()

◆ PrintVisualizerHelp()

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

◆ RegisterSelectionChangedCallback()

void cloudViewer::visualization::VisualizerWithVertexSelection::RegisterSelectionChangedCallback ( std::function< void()>  f)

Definition at line 448 of file VisualizerWithVertexSelection.cpp.

References on_selection_changed_.

◆ RegisterSelectionMovedCallback()

void cloudViewer::visualization::VisualizerWithVertexSelection::RegisterSelectionMovedCallback ( std::function< void()>  f)

◆ RegisterSelectionMovingCallback()

void cloudViewer::visualization::VisualizerWithVertexSelection::RegisterSelectionMovingCallback ( std::function< void()>  f)

Do not change the number of vertices in geometry, but can change the vertex values and call UpdateGeometry().

Definition at line 453 of file VisualizerWithVertexSelection.cpp.

References on_selection_moving_.

◆ RemovePickedPoints()

void cloudViewer::visualization::VisualizerWithVertexSelection::RemovePickedPoints ( const std::vector< int >  indices)

◆ SetPointSize()

◆ UpdateGeometry()

bool cloudViewer::visualization::VisualizerWithVertexSelection::UpdateGeometry ( std::shared_ptr< const ccHObject geometry_ptr = nullptr)
overridevirtual

◆ UpdateWindowTitle()

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

◆ WindowResizeCallback()

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

Member Data Documentation

◆ drag_depth_

float cloudViewer::visualization::VisualizerWithVertexSelection::drag_depth_ = 0.0f
protected

Definition at line 95 of file VisualizerWithVertexSelection.h.

Referenced by CalcDragDelta(), and MouseButtonCallback().

◆ geometry_ptr_

std::shared_ptr<const ccHObject> cloudViewer::visualization::VisualizerWithVertexSelection::geometry_ptr_
protected

◆ geometry_renderer_ptr_

std::shared_ptr<glsl::GeometryRenderer> cloudViewer::visualization::VisualizerWithVertexSelection::geometry_renderer_ptr_
protected

Definition at line 102 of file VisualizerWithVertexSelection.h.

Referenced by AddGeometry(), and UpdateGeometry().

◆ mouse_down_pos_

Eigen::Vector2d cloudViewer::visualization::VisualizerWithVertexSelection::mouse_down_pos_
protected

◆ on_selection_changed_

std::function<void()> cloudViewer::visualization::VisualizerWithVertexSelection::on_selection_changed_
protected

◆ on_selection_moved_

std::function<void()> cloudViewer::visualization::VisualizerWithVertexSelection::on_selection_moved_
protected

◆ on_selection_moving_

std::function<void()> cloudViewer::visualization::VisualizerWithVertexSelection::on_selection_moving_
protected

◆ pick_point_opts_

RenderOption cloudViewer::visualization::VisualizerWithVertexSelection::pick_point_opts_
protected

Definition at line 104 of file VisualizerWithVertexSelection.h.

Referenced by KeyPressCallback(), PickPoints(), and SetPointSize().

◆ pointcloud_picker_ptr_

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

Definition at line 97 of file VisualizerWithVertexSelection.h.

Referenced by BuildUtilities(), and InvalidatePicking().

◆ pointcloud_picker_renderer_ptr_

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

Definition at line 99 of file VisualizerWithVertexSelection.h.

Referenced by BuildUtilities(), and InvalidatePicking().

◆ points_in_rect_

std::vector<int> cloudViewer::visualization::VisualizerWithVertexSelection::points_in_rect_
protected

◆ selected_points_

std::unordered_map<int, Eigen::Vector3d> cloudViewer::visualization::VisualizerWithVertexSelection::selected_points_
protected

◆ selected_points_before_drag_

std::unordered_map<int, Eigen::Vector3d> cloudViewer::visualization::VisualizerWithVertexSelection::selected_points_before_drag_
protected

◆ selection_mode_

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

◆ selection_polygon_ptr_

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

◆ selection_polygon_renderer_ptr_

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

◆ ui_points_geometry_ptr_

std::shared_ptr<ccPointCloud> cloudViewer::visualization::VisualizerWithVertexSelection::ui_points_geometry_ptr_
protected

Definition at line 106 of file VisualizerWithVertexSelection.h.

Referenced by AddGeometry(), PickPoints(), and UpdateGeometry().

◆ ui_points_renderer_ptr_

std::shared_ptr<glsl::GeometryRenderer> cloudViewer::visualization::VisualizerWithVertexSelection::ui_points_renderer_ptr_
protected

◆ ui_selected_points_geometry_ptr_

std::shared_ptr<ccPointCloud> cloudViewer::visualization::VisualizerWithVertexSelection::ui_selected_points_geometry_ptr_
protected

◆ ui_selected_points_renderer_ptr_

std::shared_ptr<glsl::GeometryRenderer> cloudViewer::visualization::VisualizerWithVertexSelection::ui_selected_points_renderer_ptr_
protected

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