Open3D (C++ API)  0.18.0+252c867
GuiVisualizer.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <vector>
11 
13 
14 namespace open3d {
15 
16 namespace geometry {
17 class AxisAlignedBoundingBox;
18 class Geometry;
19 } // namespace geometry
20 
21 namespace visualization {
22 
23 namespace gui {
24 struct Theme;
25 }
26 
27 class GuiVisualizer : public gui::Window {
28  using Super = gui::Window;
29 
30 public:
31  GuiVisualizer(const std::string& title, int width, int height);
32  GuiVisualizer(const std::vector<std::shared_ptr<const geometry::Geometry>>&
33  geometries,
34  const std::string& title,
35  int width,
36  int height,
37  int left,
38  int top);
39  virtual ~GuiVisualizer();
40 
41  void SetTitle(const std::string& title);
42  void SetGeometry(std::shared_ptr<const geometry::Geometry> geometry,
43  bool loaded_model);
44 
45  bool SetIBL(const char* path);
46 
48  void LoadGeometry(const std::string& path);
49 
50  void ExportCurrentImage(const std::string& path);
51 
52  void Layout(const gui::LayoutContext& context) override;
53 
55  void StartRPCInterface(const std::string& address, int timeout);
56 
57  void StopRPCInterface();
58 
59 protected:
60  // Add custom items to the application menu (only relevant on macOS)
61  void AddItemsToAppMenu(
62  const std::vector<std::pair<std::string, gui::Menu::ItemId>>&
63  items);
64 
65  void OnMenuItemSelected(gui::Menu::ItemId item_id) override;
66  void OnDragDropped(const char* path) override;
67 
68 private:
69  struct Impl;
70  std::unique_ptr<Impl> impl_;
71 
72  void Init();
73 };
74 
75 } // namespace visualization
76 } // namespace open3d
ImGuiContext * context
Definition: Window.cpp:76
Definition: GuiVisualizer.h:27
void LoadGeometry(const std::string &path)
Loads asynchronously, will return immediately.
Definition: GuiVisualizer.cpp:1120
virtual ~GuiVisualizer()
Definition: GuiVisualizer.cpp:966
void OnDragDropped(const char *path) override
Definition: GuiVisualizer.cpp:1351
void Layout(const gui::LayoutContext &context) override
Definition: GuiVisualizer.cpp:1071
void AddItemsToAppMenu(const std::vector< std::pair< std::string, gui::Menu::ItemId >> &items)
Definition: GuiVisualizer.cpp:972
GuiVisualizer(const std::string &title, int width, int height)
Definition: GuiVisualizer.cpp:747
void StopRPCInterface()
Definition: GuiVisualizer.cpp:1112
void ExportCurrentImage(const std::string &path)
Definition: GuiVisualizer.cpp:1223
void StartRPCInterface(const std::string &address, int timeout)
Starts the RPC interface. See io/rpc/ZMQReceiver for the parameters.
Definition: GuiVisualizer.cpp:1101
void SetTitle(const std::string &title)
Definition: GuiVisualizer.cpp:968
void SetGeometry(std::shared_ptr< const geometry::Geometry > geometry, bool loaded_model)
Definition: GuiVisualizer.cpp:988
bool SetIBL(const char *path)
Definition: GuiVisualizer.cpp:1114
void OnMenuItemSelected(gui::Menu::ItemId item_id) override
Definition: GuiVisualizer.cpp:1237
int ItemId
Definition: MenuBase.h:28
Definition: Window.h:30
int width
Definition: FilePCD.cpp:52
int height
Definition: FilePCD.cpp:53
Definition: PinholeCameraIntrinsic.cpp:16
Definition: GuiVisualizer.cpp:312