Open3D (C++ API)  0.11.0
GuiVisualizer.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <vector>
30 
32 
33 namespace open3d {
34 
35 namespace geometry {
36 class AxisAlignedBoundingBox;
37 class Geometry;
38 } // namespace geometry
39 
40 namespace visualization {
41 
42 namespace gui {
43 struct Theme;
44 }
45 
46 class GuiVisualizer : public gui::Window {
47  using Super = gui::Window;
48 
49 public:
50  GuiVisualizer(const std::string& title, int width, int height);
51  GuiVisualizer(const std::vector<std::shared_ptr<const geometry::Geometry>>&
52  geometries,
53  const std::string& title,
54  int width,
55  int height,
56  int left,
57  int top);
58  virtual ~GuiVisualizer();
59 
60  void SetTitle(const std::string& title);
61  void SetGeometry(std::shared_ptr<const geometry::Geometry> geometry,
62  bool loaded_model);
63 
64  bool SetIBL(const char* path);
65 
67  void LoadGeometry(const std::string& path);
68 
69  void ExportCurrentImage(const std::string& path);
70 
71  void Layout(const gui::Theme& theme) override;
72 
73 protected:
74  // Add custom items to the application menu (only relevant on macOS)
75  void AddItemsToAppMenu(
76  const std::vector<std::pair<std::string, gui::Menu::ItemId>>&
77  items);
78 
79  void OnMenuItemSelected(gui::Menu::ItemId item_id) override;
80  void OnDragDropped(const char* path) override;
81 
82 private:
83  struct Impl;
84  std::unique_ptr<Impl> impl_;
85 
86  void Init();
87 };
88 
89 } // namespace visualization
90 } // namespace open3d
Definition: Theme.h:39
Definition: Window.h:50
Definition: GuiVisualizer.cpp:329
Definition: GuiVisualizer.h:46
int ItemId
Definition: Menu.h:51
Definition: PinholeCameraIntrinsic.cpp:35
int height
Definition: FilePCD.cpp:72
int width
Definition: FilePCD.cpp:71