Interface UiAPI

All Known Implementing Classes:
UiModule

public interface UiAPI
API definition for the UI module, UiModule.

The UI module contains calls and methods to access, modify, and query the user interface.

  • Method Details

    • display_message

      void display_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. 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.
      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

      void display_message(int id, String msg, double x, double y, double[] color, double size)
      Same as display_image(int, String, float, float, float, float, float, float) but using an array for the color instead of giving each component separately.
      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_text

      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)
      Add 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.
      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_image

      void display_image(int id, String path, float x, float y)
      Add 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.
      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.
    • display_image

      void display_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. 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!
      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

      void display_image(int id, String path, double x, double y, double[] color)
      Same as display_image(int, String, float, float, float, float, float, float) but using a double array for the color instead of each component separately.
      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].
    • remove_all_objects

      void remove_all_objects()
      Remove all objects (messages, texts and images).
    • remove_object

      void remove_object(int id)
      Parameters:
      id - Integer with the integer id of the object to remove.
    • remove_objects

      void remove_objects(int[] ids)
      Remove 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 display_message(int, String, float, float, float, float, float, float, float), display_text(int, String, float, float, float, float, float, float, float, float, float), or display_image(int, String, float, float).

      Parameters:
      ids - Vector with the integer ids of the objects to remove.
    • enable

      void enable()
      Enable the GUI rendering. This makes the user interface to be rendered and updated again if it was previously disabled. Otherwise, it has no effect.
    • disable

      void disable()
      Disable the GUI rendering. This causes the user interface to no longer be rendered or updated.
    • get_ui_scale_factor

      float get_ui_scale_factor()
      Get the current scale factor applied to the UI.
      Returns:
      The scale factor.
    • get_client_width

      int get_client_width()
      Return the width of the client area in logical pixels.
      Returns:
      The width in logical pixels.
    • get_client_height

      int get_client_height()
      Return the height of the client area in logical pixels.
      Returns:
      The height in logical pixels.
    • get_position_and_size

      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.

      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.

      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.
    • expand_pane

      void expand_pane(String name)
      Expand the UI pane with the given name. Possible names are:
      • Time
      • Camera
      • Visibility
      • VisualSettings
      • Datasets
      • Bookmarks
      • LocationLog

      Please, mind the case!

    • collapse_pane

      void collapse_pane(String name)
      Collapse the UI pane with the given name. Possible names are:
      • Time
      • Camera
      • Visibility
      • VisualSettings
      • Datasets
      • Bookmarks
      • LocationLog

      Please, mind the case!

    • display_popup_notification

      void display_popup_notification(String msg)
      Display 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.
      Parameters:
      msg - The notification text.
    • display_popup_notification

      void display_popup_notification(String msg, float duration)
      Display 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.
      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.
    • set_headline_message

      void set_headline_message(String msg)
      Set the contents of the headline message. The headline message appears in the middle of the screen with a big font.
      Parameters:
      msg - The headline text.
    • set_subhead_message

      void set_subhead_message(String msg)
      Set 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.
      Parameters:
      msg - The sub-header text.
    • clear_headline_message

      void clear_headline_message()
      Clear the content of the headline message. After this method is called, the headline message disappears from screen.
    • clear_subhead_message

      void clear_subhead_message()
      Clear the content of the sub-header message. After this method is called, the sub-header message disappears from screen.
    • clear_all_messages

      void clear_all_messages()
      Clear both the headline and the sub-header messages. After this method is called, both the headline and the sub-header messages disappear from screen.
    • set_crosshair_visibility

      void set_crosshair_visibility(boolean visible)
      Set the visibility of all crosshairs. Affects the visibility of the focus, closest, and home objects' crosshairs.
      Parameters:
      visible - The visibility state, which applies to all cross-hairs.
    • set_focus_crosshair_visibility

      void set_focus_crosshair_visibility(boolean visible)
      Set the visibility of the focus object crosshair.
      Parameters:
      visible - The visibility state.
    • set_closest_crosshair_visibility

      void set_closest_crosshair_visibility(boolean visible)
      Set the visibility of the closest object crosshair.
      Parameters:
      visible - The visibility state.
    • set_home_crosshair_visibility

      void set_home_crosshair_visibility(boolean visible)
      Set the visibility of the home object crosshair.
      Parameters:
      visible - The visibility state.
    • set_minimap_visibility

      void set_minimap_visibility(boolean visible)
      Set the visibility of the minimap.
      Parameters:
      visible - The visibility state.
    • preload_textures

      void preload_textures(String[] paths)
      Preload the given image file paths as textures for later use. They will be cached for the subsequent uses.
      Parameters:
      paths - The texture paths as an array of strings.
    • preload_texture

      void preload_texture(String path)
      Preload the given image as a texture for later use. The texture will be cached for later use.
      Parameters:
      path - The path of the image file to preload as a string.
    • reload

      void reload()
      Forces a re-initialization of the entire user interface of Gaia Sky. This causes all elements in the UI to be disposed and re-created.