#include <Application.h>
|
virtual | ~Application () |
|
void | Initialize () |
|
void | Initialize (int argc, const char *argv[]) |
|
void | Initialize (const char *resource_path) |
| Initializes the application, with a specific path to the resources. More...
|
|
void | SetFontForLanguage (const char *font, const char *lang_code) |
|
void | SetFontForCodePoints (const char *font, const std::vector< uint32_t > &code_points) |
|
void | Run () |
| Does not return until the UI is completely finished. More...
|
|
void | Quit () |
| Closes all the windows, which exits as a result. More...
|
|
void | RunInThread (std::function< void()> f) |
|
void | PostToMainThread (Window *window, std::function< void()> f) |
|
std::shared_ptr< Menu > | GetMenubar () const |
|
void | SetMenubar (std::shared_ptr< Menu > menubar) |
|
void | AddWindow (std::shared_ptr< Window > window) |
| Must be called on the same thread that calls Run() More...
|
|
void | RemoveWindow (Window *window) |
| Must be called on the same thread that calls Run() More...
|
|
void | ShowMessageBox (const char *title, const char *message) |
|
const char * | GetResourcePath () const |
|
const Theme & | GetTheme () const |
|
double | Now () const |
|
void | OnMenuItemSelected (Menu::ItemId itemId) |
| Delivers the itemId to the active window. Used internally. More...
|
|
void | OnTerminate () |
|
bool | RunOneTick (EnvUnlocker &unlocker, bool cleanup_if_no_windows=true) |
|
std::shared_ptr< geometry::Image > | RenderToImage (EnvUnlocker &unlocker, rendering::View *view, rendering::Scene *scene, int width, int height) |
|
const std::vector< UserFontInfo > & | GetUserFontInfo () const |
|
◆ ~Application()
open3d::visualization::gui::Application::~Application |
( |
| ) |
|
|
virtual |
◆ AddWindow()
void open3d::visualization::gui::Application::AddWindow |
( |
std::shared_ptr< Window > |
window | ) |
|
Must be called on the same thread that calls Run()
◆ GetInstance()
Application & open3d::visualization::gui::Application::GetInstance |
( |
| ) |
|
|
static |
◆ GetMenubar()
std::shared_ptr< Menu > open3d::visualization::gui::Application::GetMenubar |
( |
| ) |
const |
◆ GetResourcePath()
const char * open3d::visualization::gui::Application::GetResourcePath |
( |
| ) |
const |
◆ GetTheme()
const Theme & open3d::visualization::gui::Application::GetTheme |
( |
| ) |
const |
This is primarily intended for use by the Window class. Any size-related fields (for example, fontSize) should be accessed through Window::GetTheme() as they are updated to reflect the pixel scaling on the monitor where the Window is displayed.
◆ GetUserFontInfo()
◆ Initialize() [1/3]
void open3d::visualization::gui::Application::Initialize |
( |
| ) |
|
Initializes the application, and in particular, finds the path for the resources. If you can provide the argc/argv arguments it is more reliable.
◆ Initialize() [2/3]
void open3d::visualization::gui::Application::Initialize |
( |
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Initializes the application, and in particular, finds the path for the resources. If you can provide the argc/argv arguments it is more reliable.
◆ Initialize() [3/3]
void open3d::visualization::gui::Application::Initialize |
( |
const char * |
resource_path | ) |
|
Initializes the application, with a specific path to the resources.
◆ Now()
double open3d::visualization::gui::Application::Now |
( |
| ) |
const |
Returns high-resolution counter value (in seconds). Not valid until Initialize() is called.
◆ OnMenuItemSelected()
void open3d::visualization::gui::Application::OnMenuItemSelected |
( |
Menu::ItemId |
itemId | ) |
|
Delivers the itemId to the active window. Used internally.
◆ OnTerminate()
void open3d::visualization::gui::Application::OnTerminate |
( |
| ) |
|
Cleanup everything right now. An example of usage is Cocoa's -applicationWillTermiate: AppDelegate message. Using Quit would result in a crash (and an unsightly message from macOS) due to destructing the windows at the wrong time.
◆ PostToMainThread()
void open3d::visualization::gui::Application::PostToMainThread |
( |
Window * |
window, |
|
|
std::function< void()> |
f |
|
) |
| |
Runs
- Parameters
-
f | on the main thread at some point in the near future. Proper context will be setup for |
window. | f will block the UI, so it should run quickly. If you need to do something slow (e.g. load a file) consider using RunInThread() and have the function pass off UI calls to PostToMainThread(). |
◆ Quit()
void open3d::visualization::gui::Application::Quit |
( |
| ) |
|
Closes all the windows, which exits as a result.
◆ RemoveWindow()
void open3d::visualization::gui::Application::RemoveWindow |
( |
Window * |
window | ) |
|
Must be called on the same thread that calls Run()
◆ RenderToImage()
Returns the scene rendered to an image. This MUST NOT be called while in Run(). It is intended for use when no windows are shown. If you need to render from a GUI, use Scene::RenderToImage().
◆ Run()
void open3d::visualization::gui::Application::Run |
( |
| ) |
|
Does not return until the UI is completely finished.
◆ RunInThread()
void open3d::visualization::gui::Application::RunInThread |
( |
std::function< void()> |
f | ) |
|
Runs
- Parameters
-
f | in a separate thread. Do NOT call UI functions in f ; if you have a long running function that needs to call UI functions (e.g. updating a progress bar), have your function call PostToMainThread() with code that will do the UI (note: your function may finish before the code given to PostToMainThread will run, so if using lambdas, capture by copy and make sure whatever you use will still be alive). |
◆ RunOneTick()
bool open3d::visualization::gui::Application::RunOneTick |
( |
EnvUnlocker & |
unlocker, |
|
|
bool |
cleanup_if_no_windows = true |
|
) |
| |
For internal use. Returns true if the run loop has not finished, and false if the last window has closed or Quit() has been called. EnvUnlocker allows an external environment to provide a way to unlock the environment while we wait for the next event. This is useful to release the Python GIL, for example. Callers of of Open3D's GUI from languages such as scripting languages which do not expect the author to need to clean up after themselves may want to write their own Run() function that calls RunOneTick() with cleanup_if_no_windows=false and schedule a call to OnTerminate() with atexit().
◆ SetFontForCodePoints()
void open3d::visualization::gui::Application::SetFontForCodePoints |
( |
const char * |
font, |
|
|
const std::vector< uint32_t > & |
code_points |
|
) |
| |
Sets the font for the specified code points. The font can be a path to a TrueType (.ttf), TrueType Collection (.ttc), or OpenType (.otf) file, or it can be the name of the font, in which case the system font paths will be searched. The font is assumed to contain the code points; if it does not no error will be produced.
◆ SetFontForLanguage()
void open3d::visualization::gui::Application::SetFontForLanguage |
( |
const char * |
font, |
|
|
const char * |
lang_code |
|
) |
| |
Sets the font for the character range in language specified two-letter lowercase ISO 639-1 codes. The font can be a path to a TrueType (.ttf), TrueType Collection (.ttc), or OpenType (.otf) file, or it can be the name of the font, in which case the system font paths will be searched from the file. Supported languages are: "en" (English) "ja" (Japanese) "ko" (Korean) "th" (Thai) "vi" (Vietnamese) "zh" (Chinese, 2500 most common characters, 50 MB per window) "zh_all" (Chinese, all characters, ~200 MB per window)
◆ SetMenubar()
void open3d::visualization::gui::Application::SetMenubar |
( |
std::shared_ptr< Menu > |
menubar | ) |
|
◆ ShowMessageBox()
void open3d::visualization::gui::Application::ShowMessageBox |
( |
const char * |
title, |
|
|
const char * |
message |
|
) |
| |
Creates a message box window the next time the event loop processes. This message box will be a separate window and not associated with any of the other windows shown with AddWindow(). THIS FUNCTION SHOULD BE USED ONLY AS A LAST RESORT! If you have a window, you should use Window::ShowMessageBox() so that the message box will be modal to that window. If you do not have a window it is better to use ShowNativeAlert(). If the platform does not have an alert (like Linux), then this can be used as a last resort.
The documentation for this class was generated from the following files: