Class VizInterface

Class Documentation

class VizInterface

Virtual visualization interface (see MolaViz)

Public Types

using Ptr = std::shared_ptr<VizInterface>

Public Functions

VizInterface() = default
virtual std::future<nanogui::Window*> create_subwindow(const std::string &title, const std::string &parentWindow = "main") = 0
virtual std::future<void> subwindow_grid_layout(const std::string &subWindowTitle, const bool orientationVertical, int resolution, const std::string &parentWindow = "main") = 0
virtual std::future<void> subwindow_move_resize(const std::string &subWindowTitle, const mrpt::math::TPoint2D_<int> &location, const mrpt::math::TPoint2D_<int> &size, const std::string &parentWindow = "main") = 0
virtual std::future<bool> subwindow_update_visualization(const mrpt::rtti::CObject::Ptr &obj, const std::string &subWindowTitle, const mrpt::containers::yaml *extra_parameters = nullptr, const std::string &parentWindow = "main") = 0

Updates the contents of a subwindow from a given object, typically a mrpt::obs::CObservation, but custom handlers can be installed for arbitrary classes.

Depending on the object class RTTI, the corresponding handler is called.

See also

mola::MolaViz

Returns:

false if no handler is found for the given object.

virtual std::future<bool> update_3d_object(const std::string &objName, const std::shared_ptr<mrpt::opengl::CSetOfObjects> &obj, const std::string &viewportName = "main", const std::string &parentWindow = "main") = 0

Updates or inserts a 3D object in the background scene of a specified window.

This method schedules a task to update (or insert if not present) a named 3D object (objName) in the background scene of the given parent window (parentWindow), optionally within a specific viewport (viewportName). The object is provided as a shared pointer to a mrpt::opengl::CSetOfObjects.

The update is performed in the GUI thread. If the object already exists, its contents and properties are updated by copying the shared pointers contained into obj.

Parameters:
  • objName – The name of the 3D object to update or insert.

  • obj – Shared pointer to the 3D object (CSetOfObjects) to be displayed.

  • viewportName – The name of the viewport where the object should be placed.

  • parentWindow – The name of the parent window containing the background scene.

Returns:

A future<bool>, will return true when the task is run in its thread.

virtual std::future<bool> insert_point_cloud_with_decay(const std::shared_ptr<mrpt::opengl::CPointCloudColoured> &cloud, const double decay_time_seconds, const std::string &viewportName = "main", const std::string &parentWindow = "main") = 0

Inserts a temporary point cloud, which will be visible only during decay_time_seconds

Parameters:
  • obj – Shared pointer to the cloud (CPointCloudColoured) to be added.

  • decay_time_seconds – Seconds that the cloud will be visible before disappearing.

  • viewportName – The name of the viewport where the object should be placed.

  • parentWindow – The name of the parent window containing the background scene.

Returns:

A future<bool>, will return true when the task is run in its thread.

virtual std::future<bool> clear_all_point_clouds_with_decay(const std::string &viewportName = "main", const std::string &parentWindow = "main") = 0

Removes from the visualization all clouds inserted with insert_point_cloud_with_decay()

Parameters:
  • viewportName – The name of the viewport where the object should be placed.

  • parentWindow – The name of the parent window containing the background scene.

Returns:

A future<bool>, will return true when the task is run in its thread.

virtual std::future<bool> update_viewport_look_at(const mrpt::math::TPoint3Df &lookAt, const std::string &viewportName = "main", const std::string &parentWindow = "main") = 0
virtual std::future<bool> update_viewport_camera_azimuth(const double azimuth, bool absolute_falseForRelative = true, const std::string &viewportName = "main", const std::string &parentWindow = "main") = 0
virtual std::future<bool> update_viewport_camera_orthographic(const bool orthographic, const std::string &viewportName = "main", const std::string &parentWindow = "main") = 0
virtual std::future<bool> execute_custom_code_on_background_scene(const std::function<void(mrpt::opengl::Scene&)> &userCode, const std::string &parentWindow = "main") = 0

Executes arbitrary user code on the 3D Scene in the background of the main window space.

This can be used to modify the viewport, create new sub-viewports, etc.

Note

The user-provided code will be executed in the main GUI thread, so mutexes must be used as needed.

virtual std::future<void> enqueue_custom_nanogui_code(const std::function<void(void)> &userCode) = 0
virtual std::future<bool> output_console_message(const std::string &msg, const std::string &parentWindow = "main") = 0