SVG and HTML rendering

SVG and HTML rendering#

module:

navground.sim.ui

A function that returns a dictionary of SVG style attributes for an entity, like {"fill": "red"}.

A rectangle defined by two points, at the bottom-left and top-right vertices.

Returns the SVG representation of an RGB color

Parameters:
  • r – in [0, 1]

  • g – in [0, 1]

  • b – in [0, 1]

Returns:

The SVG representation of the color

Draw the world as a SVG.

Parameters:
  • world – The world to display

  • precision – The number of decimal digits for poses

  • decorate – A function to decorate entities. Should return a dictionary of valid SVG style attributes, e.g., {"fill": "red"} for a given entity.

  • bounds – The rectangular area to be displayed

  • width – The width in pixels

  • min_height – The minimum height in pixels

  • relative_margin – The relative margin

  • background_color – A valid SVG color for the background

  • display_shape – Whether to display the agent circular shape

  • grid – The size of the square grid tile (set to zero or negative to skip drawing a grid)

  • grid_color – The color of the grid

  • grid_thickness – The thickness of the grid

  • rotation – A planar rotation applied before drawing [rad]

  • extras – Provides extras rendering added at the end of to the svg

Returns:

An SVG string

Draw the world as a SVG embedded in HTML, optionally with a javascript script to keep the view in sync with navground.sim.ui.WebUI

Parameters:
  • world – The world to display

  • world_name – The world name used as title

  • with_websocket – Whether to add a websocket client to keep the view in sync

  • notebook – Whether the HTML will be embedded in a notebook

  • port – The websocket port

  • display_shape – Whether to display the agent circular shape

  • external_style_path – The external style path

  • style – An inline CSS style to include

  • include_script_path – An alternative script path to be included

  • kwargs – Arguments forwarded to navground.sim.ui.svg_for_world()

Returns:

An HTML string