Class UiModule
- All Implemented Interfaces:
UiAPI
-
Field Summary
Fields inherited from class APIModule
api, em, logger, me, nameModifier and TypeFieldDescriptionprotected final APIv2Reference to API object.protected final EventManagerReference to event manager.protected final Logger.Logprotected final APIModuleReference to self.protected final StringModule name. -
Constructor Summary
ConstructorsConstructorDescriptionUiModule(EventManager em, APIv2 api, String name) Create a new module with the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear both the headline and the sub-header messages.voidClear the content of the headline message.voidClear the content of the sub-header message.voidcollapse_pane(String name) Collapse the UI pane with the given name.voiddisable()Disable the GUI rendering.voiddisplay_image(int id, String path, double x, double y, double[] color) Same asUiAPI.display_image(int, String, float, float, float, float, float, float)but using a double array for the color instead of each component separately.voiddisplay_image(int id, String path, double x, double y, List<?> color) voiddisplay_image(int id, String path, float x, float y) Add a new image object at the given coordinates.voiddisplay_image(int id, String path, float x, float y, float r, float g, float b, float a) Add a new image object at the given coordinates.voiddisplay_message(int id, String msg, double x, double y, double[] color, double size) Same asUiAPI.display_image(int, String, float, float, float, float, float, float)but using an array for the color instead of giving each component separately.voiddisplay_message(int id, String message, double x, double y, List<?> color, double fontSize) voiddisplay_message(int id, String msg, float x, float y, float r, float g, float b, float a, float size) Add a new one-line message in the screen with the given id and the given coordinates.voiddisplay_message(int id, String message, float x, float y, float r, float g, float b, float a, int fontSize) voidDisplay a popup notification on the screen with the given contents for the default duration of 8 seconds.voiddisplay_popup_notification(String msg, float duration) Display a popup notification on the screen for the given duration.voiddisplay_popup_notification(String message, Double duration) voiddisplay_text(int id, String msg, float x, float y, float max_w, float max_h, float r, float g, float b, float a, float size) Add a new multi-line text in the screen with the given id, coordinates and size.voiddisplay_text(int id, String text, float x, float y, float maxWidth, float maxHeight, float r, float g, float b, float a, int fontSize) voidenable()Enable the GUI rendering.voidexpand_pane(String name) Expand the UI pane with the given name.intReturn the height of the client area in logical pixels.intReturn the width of the client area in logical pixels.float[]get_position_and_size(String name) Return the size and position of the GUI actor that goes by the given name, or null if such element does not exist.floatGet the current scale factor applied to the UI.voidpreload_texture(String path) Preload the given image as a texture for later use.voidpreload_textures(String[] paths) Preload the given image file paths as textures for later use.voidreload()Forces a re-initialization of the entire user interface of Gaia Sky.voidRemove all objects (messages, texts and images).voidremove_object(int id) Remove the object with the given id.voidremove_objects(int[] ids) Remove the items with the given ids.voidremove_objects(List<?> ids) voidset_closest_crosshair_visibility(boolean visible) Set the visibility of the closest object crosshair.voidset_crosshair_visibility(boolean visible) Set the visibility of all crosshairs.voidset_focus_crosshair_visibility(boolean visible) Set the visibility of the focus object crosshair.voidSet the contents of the headline message.voidset_home_crosshair_visibility(boolean visible) Set the visibility of the home object crosshair.voidset_minimap_visibility(boolean visible) Set the visibility of the minimap.voidSet the contents of the sub-header message.
-
Constructor Details
-
UiModule
Create a new module with the given attributes.- Parameters:
api- Reference to the API class.name- Name of the module.
-
-
Method Details
-
display_message
public void display_message(int id, String msg, float x, float y, float r, float g, float b, float a, float size) Description copied from interface:UiAPIAdd a new one-line message in the screen with the given id and the given coordinates. If an object already exists with the given id, it is removed. However, if a message object already exists with the same id, its properties are updated. The messages placed with this method will not appear in the screenshots/frames in advanced mode. This is intended for running interactively only.- Specified by:
display_messagein interfaceUiAPI- Parameters:
id- A unique identifier, used to identify this message when you want to remove it.msg- The string message, to be displayed in one line. But explicit newline breaks the line.x- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.r- The red component of the color in [0,1].g- The green component of the color in [0,1].b- The blue component of the color in [0,1].a- The alpha component of the color in [0,1].size- The size of the font. The system will use the existing font closest to the chosen size and scale it up or down to match the desired size. Scaling can cause artifacts, so to ensure the best font quality, stick to the existing sizes.
-
display_message
Description copied from interface:UiAPISame asUiAPI.display_image(int, String, float, float, float, float, float, float)but using an array for the color instead of giving each component separately.- Specified by:
display_messagein interfaceUiAPI- Parameters:
id- A unique identifier, used to identify this message when you want to remove it.msg- The string message, to be displayed in one line. But explicit newline breaks the line.x- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.color- The color as an array of RGBA (red, green, blue, alpha) values in [0,1].size- The size of the font. The system will use the existing font closest to the chosen size and scale it up or down to match the desired size. Scaling can cause artifacts, so to ensure the best font quality, stick to the existing sizes.
-
display_message
-
display_message
public void display_message(int id, String message, float x, float y, float r, float g, float b, float a, int fontSize) -
display_text
public void display_text(int id, String msg, float x, float y, float max_w, float max_h, float r, float g, float b, float a, float size) Description copied from interface:UiAPIAdd a new multi-line text in the screen with the given id, coordinates and size. If an object already exists with the given id, it is removed. However, if a text object already exists with the same id, its properties are updated. The texts placed with this method will not appear in the screenshots/frames in advanced mode. This is intended for running interactively only.- Specified by:
display_textin interfaceUiAPI- Parameters:
id- A unique identifier, used to identify this message when you want to remove it.msg- The string message, to be displayed line-wrapped in the box defined by maxWidth and maxHeight. Explicit newline still breaks the line.x- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.max_w- The maximum width in screen percentage [0,1]. Set to 0 to let the system decide.max_h- The maximum height in screen percentage [0,1]. Set to 0 to let the system decide.r- The red component of the color in [0,1].g- The green component of the color in [0,1].b- The blue component of the color in [0,1].a- The alpha component of the color in [0,1].size- The size of the font. The system will use the existing font closest to the chosen size.
-
display_text
public void display_text(int id, String text, float x, float y, float maxWidth, float maxHeight, float r, float g, float b, float a, int fontSize) -
display_image
public void display_image(int id, String path, float x, float y, float r, float g, float b, float a) Description copied from interface:UiAPIAdd a new image object at the given coordinates. If an object already exists with the given id, it is removed. However, if an image object already exists with the same id, its properties are updated.
Warning: This method will only work in the asynchronous mode. Run the script with the "asynchronous" check box activated!- Specified by:
display_imagein interfaceUiAPI- Parameters:
id- A unique identifier, used to identify this message when you want to remove it.path- The path to the image. It can either be an absolute path (not recommended) or a path relative to the Gaia Sky work directory.x- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.r- The red component of the color in [0,1].g- The green component of the color in [0,1].b- The blue component of the color in [0,1].a- The alpha component of the color in [0,1].
-
display_image
Description copied from interface:UiAPISame asUiAPI.display_image(int, String, float, float, float, float, float, float)but using a double array for the color instead of each component separately.- Specified by:
display_imagein interfaceUiAPI- Parameters:
id- A unique identifier, used to identify this message when you want to remove it.path- The path to the image. It can either be an absolute path (not recommended) or a path relative to the Gaia Sky work directory.x- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.color- The color as an array of RGBA (red, green, blue, alpha) values in [0,1].
-
display_image
-
display_image
Description copied from interface:UiAPIAdd a new image object at the given coordinates. If an object already exists with the given id, it is removed. However, if an image object already exists with the same id, its properties are updated.
The messages placed with this method will not appear in the screenshots/frames in advanced mode. This is intended for running interactively only.- Specified by:
display_imagein interfaceUiAPI- Parameters:
id- A unique identifier, used to identify this message when you want to remove it.path- The path to the image. It can either be an absolute path (not recommended) or a path relative to the Gaia Sky work directory.x- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.
-
remove_all_objects
public void remove_all_objects()Description copied from interface:UiAPIRemove all objects (messages, texts and images).- Specified by:
remove_all_objectsin interfaceUiAPI
-
remove_object
public void remove_object(int id) Description copied from interface:UiAPIRemove the object with the given id.This object is assumed to have been added with
UiAPI.display_message(int, String, float, float, float, float, float, float, float),UiAPI.display_text(int, String, float, float, float, float, float, float, float, float, float), orUiAPI.display_image(int, String, float, float).- Specified by:
remove_objectin interfaceUiAPI- Parameters:
id- Integer with the integer id of the object to remove.
-
remove_objects
public void remove_objects(int[] ids) Description copied from interface:UiAPIRemove the items with the given ids. They can either be messages, images or whatever else.The objects to remove are assumed to have been added with
UiAPI.display_message(int, String, float, float, float, float, float, float, float),UiAPI.display_text(int, String, float, float, float, float, float, float, float, float, float), orUiAPI.display_image(int, String, float, float).- Specified by:
remove_objectsin interfaceUiAPI- Parameters:
ids- Vector with the integer ids of the objects to remove.
-
remove_objects
-
enable
-
disable
-
get_client_width
public int get_client_width()Description copied from interface:UiAPIReturn the width of the client area in logical pixels.- Specified by:
get_client_widthin interfaceUiAPI- Returns:
- The width in logical pixels.
-
get_client_height
public int get_client_height()Description copied from interface:UiAPIReturn the height of the client area in logical pixels.- Specified by:
get_client_heightin interfaceUiAPI- Returns:
- The height in logical pixels.
-
get_position_and_size
Description copied from interface:UiAPIReturn the size and position of the GUI actor that goes by the given name, or null if such element does not exist.The actor names are given at creation, and are internal to the Gaia Sky source code. You need to dive into the source code if you want to manipulate GUI actors.
Warning: This will only work in asynchronous mode.
- Specified by:
get_position_and_sizein interfaceUiAPI- Parameters:
name- The name of the gui element.- Returns:
- A vector of floats with the position (0, 1) of the bottom left corner in pixels from the bottom-left of the screen and the size (2, 3) in pixels of the element.
-
get_ui_scale_factor
public float get_ui_scale_factor()Description copied from interface:UiAPIGet the current scale factor applied to the UI.- Specified by:
get_ui_scale_factorin interfaceUiAPI- Returns:
- The scale factor.
-
expand_pane
Description copied from interface:UiAPIExpand the UI pane with the given name. Possible names are:- Time
- Camera
- Visibility
- VisualSettings
- Datasets
- Bookmarks
- LocationLog
Please, mind the case!
- Specified by:
expand_panein interfaceUiAPI
-
collapse_pane
Description copied from interface:UiAPICollapse the UI pane with the given name. Possible names are:- Time
- Camera
- Visibility
- VisualSettings
- Datasets
- Bookmarks
- LocationLog
Please, mind the case!
- Specified by:
collapse_panein interfaceUiAPI
-
display_popup_notification
Description copied from interface:UiAPIDisplay a popup notification on the screen with the given contents for the default duration of 8 seconds. The notification appears at the top-right of the screen and stays there until the duration time elapses, then it disappears.- Specified by:
display_popup_notificationin interfaceUiAPI- Parameters:
msg- The notification text.
-
display_popup_notification
Description copied from interface:UiAPIDisplay a popup notification on the screen for the given duration. The notification appears at the top-right of the screen and stays there until the duration time elapses, then it disappears.- Specified by:
display_popup_notificationin interfaceUiAPI- Parameters:
msg- The notification text.duration- The duration, in seconds, until the notification automatically disappears. Set this to a negative number so that the notification never expires. If this is the case, the notification must be manually closed by the user.
-
display_popup_notification
-
set_headline_message
Description copied from interface:UiAPISet the contents of the headline message. The headline message appears in the middle of the screen with a big font.- Specified by:
set_headline_messagein interfaceUiAPI- Parameters:
msg- The headline text.
-
set_subhead_message
Description copied from interface:UiAPISet the contents of the sub-header message. The sub-header message appears just below the headline message, in the middle of the screen, with a somewhat smaller font.- Specified by:
set_subhead_messagein interfaceUiAPI- Parameters:
msg- The sub-header text.
-
clear_headline_message
public void clear_headline_message()Description copied from interface:UiAPIClear the content of the headline message. After this method is called, the headline message disappears from screen.- Specified by:
clear_headline_messagein interfaceUiAPI
-
clear_subhead_message
public void clear_subhead_message()Description copied from interface:UiAPIClear the content of the sub-header message. After this method is called, the sub-header message disappears from screen.- Specified by:
clear_subhead_messagein interfaceUiAPI
-
clear_all_messages
public void clear_all_messages()Description copied from interface:UiAPIClear both the headline and the sub-header messages. After this method is called, both the headline and the sub-header messages disappear from screen.- Specified by:
clear_all_messagesin interfaceUiAPI
-
set_crosshair_visibility
public void set_crosshair_visibility(boolean visible) Description copied from interface:UiAPISet the visibility of all crosshairs. Affects the visibility of the focus, closest, and home objects' crosshairs.- Specified by:
set_crosshair_visibilityin interfaceUiAPI- Parameters:
visible- The visibility state, which applies to all cross-hairs.
-
set_focus_crosshair_visibility
public void set_focus_crosshair_visibility(boolean visible) Description copied from interface:UiAPISet the visibility of the focus object crosshair.- Specified by:
set_focus_crosshair_visibilityin interfaceUiAPI- Parameters:
visible- The visibility state.
-
set_closest_crosshair_visibility
public void set_closest_crosshair_visibility(boolean visible) Description copied from interface:UiAPISet the visibility of the closest object crosshair.- Specified by:
set_closest_crosshair_visibilityin interfaceUiAPI- Parameters:
visible- The visibility state.
-
set_home_crosshair_visibility
public void set_home_crosshair_visibility(boolean visible) Description copied from interface:UiAPISet the visibility of the home object crosshair.- Specified by:
set_home_crosshair_visibilityin interfaceUiAPI- Parameters:
visible- The visibility state.
-
set_minimap_visibility
public void set_minimap_visibility(boolean visible) Description copied from interface:UiAPISet the visibility of the minimap.- Specified by:
set_minimap_visibilityin interfaceUiAPI- Parameters:
visible- The visibility state.
-
preload_texture
Description copied from interface:UiAPIPreload the given image as a texture for later use. The texture will be cached for later use.- Specified by:
preload_texturein interfaceUiAPI- Parameters:
path- The path of the image file to preload as a string.
-
preload_textures
Description copied from interface:UiAPIPreload the given image file paths as textures for later use. They will be cached for the subsequent uses.- Specified by:
preload_texturesin interfaceUiAPI- Parameters:
paths- The texture paths as an array of strings.
-
reload
-