Open3D (C++ API)  0.16.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-2021 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
33namespace open3d {
34
35namespace geometry {
36class AxisAlignedBoundingBox;
37class Geometry;
38} // namespace geometry
39
40namespace visualization {
41
42namespace gui {
43struct Theme;
44}
45
46class GuiVisualizer : public gui::Window {
47 using Super = gui::Window;
48
49public:
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::LayoutContext& context) override;
72
74 void StartRPCInterface(const std::string& address, int timeout);
75
76 void StopRPCInterface();
77
78protected:
79 // Add custom items to the application menu (only relevant on macOS)
81 const std::vector<std::pair<std::string, gui::Menu::ItemId>>&
82 items);
83
84 void OnMenuItemSelected(gui::Menu::ItemId item_id) override;
85 void OnDragDropped(const char* path) override;
86
87private:
88 struct Impl;
89 std::unique_ptr<Impl> impl_;
90
91 void Init();
92};
93
94} // namespace visualization
95} // namespace open3d
ImGuiContext * context
Definition: Window.cpp:95
Definition: GuiVisualizer.h:46
void LoadGeometry(const std::string &path)
Loads asynchronously, will return immediately.
Definition: GuiVisualizer.cpp:1139
virtual ~GuiVisualizer()
Definition: GuiVisualizer.cpp:985
void OnDragDropped(const char *path) override
Definition: GuiVisualizer.cpp:1370
void Layout(const gui::LayoutContext &context) override
Definition: GuiVisualizer.cpp:1090
GuiVisualizer(const std::string &title, int width, int height)
Definition: GuiVisualizer.cpp:766
void StopRPCInterface()
Definition: GuiVisualizer.cpp:1131
void ExportCurrentImage(const std::string &path)
Definition: GuiVisualizer.cpp:1242
void AddItemsToAppMenu(const std::vector< std::pair< std::string, gui::Menu::ItemId > > &items)
Definition: GuiVisualizer.cpp:991
void StartRPCInterface(const std::string &address, int timeout)
Starts the RPC interface. See io/rpc/ZMQReceiver for the parameters.
Definition: GuiVisualizer.cpp:1120
void SetTitle(const std::string &title)
Definition: GuiVisualizer.cpp:987
void SetGeometry(std::shared_ptr< const geometry::Geometry > geometry, bool loaded_model)
Definition: GuiVisualizer.cpp:1007
bool SetIBL(const char *path)
Definition: GuiVisualizer.cpp:1133
void OnMenuItemSelected(gui::Menu::ItemId item_id) override
Definition: GuiVisualizer.cpp:1256
int ItemId
Definition: MenuBase.h:47
Definition: Window.h:49
int width
Definition: FilePCD.cpp:71
int height
Definition: FilePCD.cpp:72
Definition: PinholeCameraIntrinsic.cpp:35
Definition: GuiVisualizer.cpp:331