.. default-domain:: py .. highlight:: py .. currentmodule:: Drawing Drawing ======= .. module:: Drawing Provides functionality for drawing objects in the flight scene, the map view, the editor and the tracking station. .. note:: For drawing and interacting with the user interface, see the UI service. Objects drawn by a client are removed when that client disconnects. .. staticmethod:: add_line(start, end, reference_frame, [visible = True]) Draw a line in the scene. :param tuple start: Position of the start of the line. :param tuple end: Position of the end of the line. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the positions are in. :param bool visible: Whether the line is visible. :rtype: :class:`Line` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_direction(direction, reference_frame, [length = 1e+01], [visible = True]) Draw a direction vector in the scene, starting from the origin of the given reference frame. :param tuple direction: Direction to draw the line in. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the direction is in and defines the start position. :param float length: The length of the line. :param bool visible: Whether the line is visible. :rtype: :class:`Line` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_direction_from_com(direction, reference_frame, [length = 1e+01], [visible = True]) Draw a direction vector in the scene, from the center of mass of the active vessel. :param tuple direction: Direction to draw the line in. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the direction is in. :param float length: The length of the line. :param bool visible: Whether the line is visible. :rtype: :class:`Line` :Game Scenes: Flight .. staticmethod:: add_axes(reference_frame, [length = 1e+01], [visible = True]) Draw the axes of a reference frame in the scene, as arrows from its origin. :param SpaceCenter.ReferenceFrame reference_frame: The reference frame. :param float length: The length of each axis. :param bool visible: Whether the axes are visible. :returns: The lines for the x, y and z axes, colored red, green and blue. :rtype: list(:class:`Line`) :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_polygon(vertices, reference_frame, [visible = True]) Draw a polygon in the scene, defined by a list of vertices. :param list vertices: Vertices of the polygon. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the vertices are in. :param bool visible: Whether the polygon is visible. :rtype: :class:`Polygon` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_polyline(vertices, reference_frame, [visible = True]) Draw an open line through a list of vertices in the scene. :param list vertices: Vertices of the line. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the vertices are in. :param bool visible: Whether the line is visible. :rtype: :class:`Polyline` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_circle(center, normal, radius, reference_frame, [visible = True]) Draw a circle in the scene. :param tuple center: Position of the center of the circle. :param tuple normal: Normal of the plane of the circle. :param float radius: Radius of the circle, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position and normal are in. :param bool visible: Whether the circle is visible. :rtype: :class:`Circle` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. note:: Throws an exception if the normal is zero. .. staticmethod:: add_arc(center, normal, start_direction, angle, radius, reference_frame, [visible = True]) Draw an arc of a circle in the scene. :param tuple center: Position of the center of the arc. :param tuple normal: Normal of the plane of the arc. :param tuple start_direction: Direction from the center to the start of the arc. :param float angle: Angle of the arc, in radians. :param float radius: Radius of the arc, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position and directions are in. :param bool visible: Whether the arc is visible. :rtype: :class:`Arc` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. note:: The arc turns counterclockwise about the normal, seen from the side it points to. Throws an exception if the normal is zero, or the start direction is parallel to it. .. staticmethod:: add_orbit(orbit, [visible = True]) Draw the path of an orbit in the scene. :param SpaceCenter.Orbit orbit: The orbit. :param bool visible: Whether the path is visible. :rtype: :class:`OrbitPath` :Game Scenes: Flight, Tracking Station .. note:: The path follows the orbit as it changes, and ends where the orbit leaves the sphere of influence of its body. .. staticmethod:: add_point(position, reference_frame, [visible = True]) Draw a point in the scene, as a dot that keeps its size on screen. :param tuple position: Position of the point. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position is in. :param bool visible: Whether the point is visible. :rtype: :class:`Point` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_box(center, size, reference_frame, [rotation = (0.0, 0.0, 0.0, 1.0)], [visible = True]) Draw the edges of a box in the scene. :param tuple center: Position of the center of the box. :param tuple size: Lengths of the sides of the box along its x, y and z axes, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position and rotation are in. :param tuple rotation: Rotation of the box, as a quaternion. :param bool visible: Whether the box is visible. :rtype: :class:`Box` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_sphere(center, radius, reference_frame, [visible = True]) Draw a solid sphere in the scene. :param tuple center: Position of the center of the sphere. :param float radius: Radius of the sphere, in meters. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position is in. :param bool visible: Whether the sphere is visible. :rtype: :class:`Sphere` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_text(text, reference_frame, position, rotation, [visible = True]) Draw text in the scene. :param str text: The string to draw. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the text position is in. :param tuple position: Position of the text. :param tuple rotation: Rotation of the text, as a quaternion. :param bool visible: Whether the text is visible. :rtype: :class:`Text` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. staticmethod:: add_navball_marker(direction, reference_frame, [visible = True]) Draw a marker on the navball, pointing in the given direction. :param tuple direction: Direction that the marker points in. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the direction is in. :param bool visible: Whether the marker is visible. :rtype: :class:`NavballMarker` :Game Scenes: Flight .. staticmethod:: add_map_marker(position, reference_frame, [icon = MapMarkerIcon.generic], [caption = ''], [visible = True]) Draw a marker in the map view, with one of the game's own map icons. :param tuple position: Position of the marker. :param SpaceCenter.ReferenceFrame reference_frame: Reference frame that the position is in. :param MapMarkerIcon icon: The icon that the marker is drawn with. :param str caption: The caption shown when the mouse is over the marker. :param bool visible: Whether the marker is visible. :rtype: :class:`MapMarker` :Game Scenes: Flight, Tracking Station .. staticmethod:: add_image(data) Load an image that markers can be drawn with, from the contents of a PNG or JPEG file. The transparency of a PNG image is kept. :param bytes data: The contents of the image file. :rtype: :class:`Image` :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. note:: Throws an exception if the data is not a PNG or JPEG image. .. staticmethod:: clear([client_only = False]) Remove all objects being drawn. :param bool client_only: If true, only remove objects created by the calling client. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph