![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <VisualizerWithVertexSelection.h>
Classes | |
| struct | PickedPoint |
Public Types | |
| enum | SelectionMode { SelectionMode::None = 0, SelectionMode::Point = 1, SelectionMode::Rectangle = 2, SelectionMode::Moving = 3 } |
Public Member Functions | |
| VisualizerWithVertexSelection () | |
| ~VisualizerWithVertexSelection () override | |
| VisualizerWithVertexSelection (const VisualizerWithVertexSelection &)=delete | |
| VisualizerWithVertexSelection & | operator= (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< PickedPoint > | GetPickedPoints () 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 | |
| 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 | 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 () |
| 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 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< SelectionPolygon > | selection_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< PointCloudPicker > | pointcloud_picker_ptr_ |
| std::shared_ptr< glsl::PointCloudPickerRenderer > | pointcloud_picker_renderer_ptr_ |
| std::shared_ptr< const ccHObject > | geometry_ptr_ |
| std::shared_ptr< glsl::GeometryRenderer > | geometry_renderer_ptr_ |
| RenderOption | pick_point_opts_ |
| std::shared_ptr< ccPointCloud > | ui_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< ccPointCloud > | ui_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< 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_ |
|
inline |
|
inlineoverride |
|
delete |
|
overridevirtual |
Function to add geometry to the scene and create corresponding shaders.
| geometry_ptr | The Geometry object. |
Reimplemented from cloudViewer::visualization::Visualizer.
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().
| void cloudViewer::visualization::VisualizerWithVertexSelection::AddPickedPoints | ( | const std::vector< int > | indices | ) |
References Vector3Tpl< double >::fromArray(), geometry_ptr_, GetGeometryEigenPoints(), GetGeometryPoints(), LogInfo, CV_TYPES::MESH, on_selection_changed_, CV_TYPES::POINT_CLOUD, points, selected_points_, ui_selected_points_geometry_ptr_, and ui_selected_points_renderer_ptr_.
Referenced by MouseButtonCallback().
|
overridevirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References cloudViewer::visualization::Visualizer::BuildUtilities(), geometry_ptr_, cloudViewer::visualization::Visualizer::geometry_ptrs_, pointcloud_picker_ptr_, pointcloud_picker_renderer_ptr_, selection_polygon_ptr_, selection_polygon_renderer_ptr_, cloudViewer::visualization::Visualizer::utility_ptrs_, and cloudViewer::visualization::Visualizer::utility_renderer_ptrs_.
|
protected |
References drag_depth_, mouse_down_pos_, cloudViewer::visualization::gl_util::Unproject(), and cloudViewer::visualization::Visualizer::view_control_ptr_.
Referenced by MouseButtonCallback(), and MouseMoveCallback().
| void cloudViewer::visualization::VisualizerWithVertexSelection::ClearPickedPoints | ( | ) |
References LogInfo, None, selected_points_, selected_points_before_drag_, selection_mode_, ui_selected_points_geometry_ptr_, and ui_selected_points_renderer_ptr_.
Referenced by UpdateGeometry().
|
protected |
References DRAG_END, DRAG_MOVING, on_selection_moved_, on_selection_moving_, selected_points_, selected_points_before_drag_, type, ui_selected_points_geometry_ptr_, and ui_selected_points_renderer_ptr_.
Referenced by MouseButtonCallback(), and MouseMoveCallback().
|
protected |
References cloudViewer::visualization::Visualizer::geometry_renderer_ptrs_, cloudViewer::visualization::Visualizer::GetRenderOption(), cloudViewer::visualization::Visualizer::GetViewControl(), height, cloudViewer::visualization::Visualizer::view_control_ptr_, and width.
Referenced by MouseButtonCallback().
|
protected |
| std::vector< VisualizerWithVertexSelection::PickedPoint > cloudViewer::visualization::VisualizerWithVertexSelection::GetPickedPoints | ( | ) | const |
References points, and selected_points_.
|
overrideprotectedvirtual |
Function to initialize RenderOption.
Reimplemented from cloudViewer::visualization::Visualizer.
References cloudViewer::visualization::Visualizer::render_option_ptr_.
|
overrideprotectedvirtual |
Function to initialize ViewControl.
Reimplemented from cloudViewer::visualization::Visualizer.
References cloudViewer::visualization::Visualizer::ResetViewPoint(), and cloudViewer::visualization::Visualizer::view_control_ptr_.
|
protected |
References pointcloud_picker_ptr_, and pointcloud_picker_renderer_ptr_.
|
protected |
References None, points_in_rect_, selection_mode_, selection_polygon_ptr_, and selection_polygon_renderer_ptr_.
Referenced by KeyPressCallback(), MouseButtonCallback(), MouseMoveCallback(), and WindowResizeCallback().
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References InvalidateSelectionPolygon(), cloudViewer::visualization::Visualizer::is_redraw_required_, cloudViewer::visualization::Visualizer::KeyPressCallback(), LogDebug, pick_point_opts_, cloudViewer::visualization::RenderOption::point_size_, points_in_rect_, RemovePickedPoints(), SetPointSize(), ui_points_renderer_ptr_, ui_selected_points_geometry_ptr_, ui_selected_points_renderer_ptr_, UpdateWindowTitle(), cloudViewer::visualization::Visualizer::utility_renderer_ptrs_, and cloudViewer::visualization::Visualizer::view_control_ptr_.
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References AddPickedPoints(), CalcDragDelta(), drag_depth_, DRAG_END, DragSelectedPoints(), GetDepth(), InvalidateSelectionPolygon(), cloudViewer::visualization::Visualizer::is_redraw_required_, LogInfo, mouse_down_pos_, cloudViewer::visualization::Visualizer::MouseButtonCallback(), Moving, None, PickPoints(), Point, Rectangle, RemovePickedPoints(), selected_points_, selected_points_before_drag_, selection_mode_, selection_polygon_ptr_, cloudViewer::visualization::Visualizer::view_control_ptr_, x, and y.
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References CalcDragDelta(), DRAG_MOVING, DragSelectedPoints(), InvalidateSelectionPolygon(), cloudViewer::visualization::Visualizer::is_redraw_required_, mouse_down_pos_, cloudViewer::visualization::Visualizer::MouseMoveCallback(), Moving, None, Point, Rectangle, selection_mode_, selection_polygon_ptr_, selection_polygon_renderer_ptr_, cloudViewer::visualization::Visualizer::view_control_ptr_, x, and y.
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References cloudViewer::visualization::Visualizer::MouseScrollCallback(), x, and y.
|
delete |
| std::vector< int > cloudViewer::visualization::VisualizerWithVertexSelection::PickPoints | ( | double | x, |
| double | y, | ||
| double | w, | ||
| double | h | ||
| ) |
References cloudViewer::utility::ceil(), cloudViewer::visualization::gl_util::ColorCodeToPickIndex(), cloudViewer::visualization::Visualizer::geometry_renderer_ptrs_, cloudViewer::visualization::Visualizer::GetRenderOption(), cloudViewer::visualization::Visualizer::GetViewControl(), height, CV_TYPES::MESH, pick_point_opts_, points_in_rect_, ui_points_geometry_ptr_, cloudViewer::visualization::Visualizer::view_control_ptr_, and width.
Referenced by MouseButtonCallback().
|
overridevirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References LogInfo, and cloudViewer::visualization::Visualizer::PrintVisualizerHelp().
| void cloudViewer::visualization::VisualizerWithVertexSelection::RegisterSelectionChangedCallback | ( | std::function< void()> | f | ) |
References on_selection_changed_.
| void cloudViewer::visualization::VisualizerWithVertexSelection::RegisterSelectionMovedCallback | ( | std::function< void()> | f | ) |
References on_selection_moved_.
| 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().
References on_selection_moving_.
| void cloudViewer::visualization::VisualizerWithVertexSelection::RemovePickedPoints | ( | const std::vector< int > | indices | ) |
References LogInfo, on_selection_changed_, selected_points_, ui_selected_points_geometry_ptr_, and ui_selected_points_renderer_ptr_.
Referenced by KeyPressCallback(), and MouseButtonCallback().
| void cloudViewer::visualization::VisualizerWithVertexSelection::SetPointSize | ( | double | size | ) |
|
overridevirtual |
Function to update geometry.
This function must be called when geometry has been changed. Otherwise the behavior of Visualizer is undefined. If called without an argument, updates all geometries, otherwise only updates the geometry specified.
Reimplemented from cloudViewer::visualization::Visualizer.
References CV_TYPES::BBOX, ClearPickedPoints(), CV_TYPES::CUSTOM_H_OBJECT, geometry_ptr_, geometry_renderer_ptr_, GetGeometryEigenPoints(), GetGeometryPoints(), CV_TYPES::HALF_EDGE_MESH, CV_TYPES::IMAGE2, CV_TYPES::LINESET, LogDebug, CV_TYPES::MESH, CV_TYPES::ORIENTED_BBOX, CV_TYPES::POINT_CLOUD, CV_TYPES::POINT_OCTREE2, result, CV_TYPES::RGBD_IMAGE, cloudViewer::PointCloudTpl< T >::size(), size, CV_TYPES::TETRA_MESH, ccHObjectCaster::ToPointCloud(), ui_points_geometry_ptr_, ui_points_renderer_ptr_, cloudViewer::visualization::Visualizer::UpdateGeometry(), and CV_TYPES::VOXEL_GRID.
Referenced by AddGeometry().
|
overridevirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References cloudViewer::visualization::Visualizer::view_control_ptr_, cloudViewer::visualization::Visualizer::window_, and cloudViewer::visualization::Visualizer::window_name_.
Referenced by KeyPressCallback().
|
overrideprotectedvirtual |
Reimplemented from cloudViewer::visualization::Visualizer.
References InvalidateSelectionPolygon(), and cloudViewer::visualization::Visualizer::WindowResizeCallback().
|
protected |
Referenced by CalcDragDelta(), and MouseButtonCallback().
|
protected |
Referenced by AddGeometry(), AddPickedPoints(), BuildUtilities(), and UpdateGeometry().
|
protected |
Referenced by AddGeometry(), and UpdateGeometry().
|
protected |
Referenced by CalcDragDelta(), MouseButtonCallback(), and MouseMoveCallback().
|
protected |
Referenced by AddPickedPoints(), RegisterSelectionChangedCallback(), and RemovePickedPoints().
|
protected |
Referenced by DragSelectedPoints(), and RegisterSelectionMovedCallback().
|
protected |
Referenced by DragSelectedPoints(), and RegisterSelectionMovingCallback().
|
protected |
Referenced by KeyPressCallback(), PickPoints(), and SetPointSize().
|
protected |
Referenced by BuildUtilities(), and InvalidatePicking().
|
protected |
Referenced by BuildUtilities(), and InvalidatePicking().
|
protected |
Referenced by InvalidateSelectionPolygon(), KeyPressCallback(), and PickPoints().
|
protected |
Referenced by AddPickedPoints(), ClearPickedPoints(), DragSelectedPoints(), GetPickedPoints(), MouseButtonCallback(), and RemovePickedPoints().
|
protected |
Referenced by ClearPickedPoints(), DragSelectedPoints(), and MouseButtonCallback().
|
protected |
Referenced by ClearPickedPoints(), InvalidateSelectionPolygon(), MouseButtonCallback(), and MouseMoveCallback().
|
protected |
Referenced by BuildUtilities(), InvalidateSelectionPolygon(), MouseButtonCallback(), and MouseMoveCallback().
|
protected |
Referenced by BuildUtilities(), InvalidateSelectionPolygon(), and MouseMoveCallback().
|
protected |
Referenced by AddGeometry(), PickPoints(), and UpdateGeometry().
|
protected |
Referenced by AddGeometry(), KeyPressCallback(), SetPointSize(), and UpdateGeometry().
|
protected |
Referenced by AddGeometry(), AddPickedPoints(), ClearPickedPoints(), DragSelectedPoints(), KeyPressCallback(), and RemovePickedPoints().
|
protected |
Referenced by AddGeometry(), AddPickedPoints(), ClearPickedPoints(), DragSelectedPoints(), KeyPressCallback(), RemovePickedPoints(), and SetPointSize().