.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.Drawing Drawing ======= .. type:: public class 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. .. method:: Line addLine(org.javatuples.Triplet start, org.javatuples.Triplet end, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw a line in the scene. :param org.javatuples.Triplet start: Position of the start of the line. :param org.javatuples.Triplet end: Position of the end of the line. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the positions are in. :param boolean visible: Whether the line is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Line addDirection(org.javatuples.Triplet direction, SpaceCenter.ReferenceFrame referenceFrame, float length, boolean visible) Draw a direction vector in the scene, starting from the origin of the given reference frame. :param org.javatuples.Triplet direction: Direction to draw the line in. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the direction is in and defines the start position. :param float length: The length of the line. :param boolean visible: Whether the line is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Line addDirectionFromCom(org.javatuples.Triplet direction, SpaceCenter.ReferenceFrame referenceFrame, float length, boolean visible) Draw a direction vector in the scene, from the center of mass of the active vessel. :param org.javatuples.Triplet direction: Direction to draw the line in. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the direction is in. :param float length: The length of the line. :param boolean visible: Whether the line is visible. :Game Scenes: Flight .. method:: java.util.List addAxes(SpaceCenter.ReferenceFrame referenceFrame, float length, boolean visible) Draw the axes of a reference frame in the scene, as arrows from its origin. :param SpaceCenter.ReferenceFrame referenceFrame: The reference frame. :param float length: The length of each axis. :param boolean visible: Whether the axes are visible. :returns: The lines for the x, y and z axes, colored red, green and blue. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Polygon addPolygon(java.util.List> vertices, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw a polygon in the scene, defined by a list of vertices. :param java.util.List> vertices: Vertices of the polygon. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the vertices are in. :param boolean visible: Whether the polygon is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Polyline addPolyline(java.util.List> vertices, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw an open line through a list of vertices in the scene. :param java.util.List> vertices: Vertices of the line. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the vertices are in. :param boolean visible: Whether the line is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Circle addCircle(org.javatuples.Triplet center, org.javatuples.Triplet normal, double radius, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw a circle in the scene. :param org.javatuples.Triplet center: Position of the center of the circle. :param org.javatuples.Triplet normal: Normal of the plane of the circle. :param double radius: Radius of the circle, in meters. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the position and normal are in. :param boolean visible: Whether the circle is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. note:: Throws an exception if the normal is zero. .. method:: Arc addArc(org.javatuples.Triplet center, org.javatuples.Triplet normal, org.javatuples.Triplet startDirection, double angle, double radius, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw an arc of a circle in the scene. :param org.javatuples.Triplet center: Position of the center of the arc. :param org.javatuples.Triplet normal: Normal of the plane of the arc. :param org.javatuples.Triplet startDirection: Direction from the center to the start of the arc. :param double angle: Angle of the arc, in radians. :param double radius: Radius of the arc, in meters. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the position and directions are in. :param boolean visible: Whether the arc is visible. :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. .. method:: OrbitPath addOrbit(SpaceCenter.Orbit orbit, boolean visible) Draw the path of an orbit in the scene. :param SpaceCenter.Orbit orbit: The orbit. :param boolean visible: Whether the path is visible. :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. .. method:: Point addPoint(org.javatuples.Triplet position, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw a point in the scene, as a dot that keeps its size on screen. :param org.javatuples.Triplet position: Position of the point. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the position is in. :param boolean visible: Whether the point is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Box addBox(org.javatuples.Triplet center, org.javatuples.Triplet size, SpaceCenter.ReferenceFrame referenceFrame, org.javatuples.Quartet rotation, boolean visible) Draw the edges of a box in the scene. :param org.javatuples.Triplet center: Position of the center of the box. :param org.javatuples.Triplet size: Lengths of the sides of the box along its x, y and z axes, in meters. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the position and rotation are in. :param org.javatuples.Quartet rotation: Rotation of the box, as a quaternion. :param boolean visible: Whether the box is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Sphere addSphere(org.javatuples.Triplet center, double radius, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw a solid sphere in the scene. :param org.javatuples.Triplet center: Position of the center of the sphere. :param double radius: Radius of the sphere, in meters. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the position is in. :param boolean visible: Whether the sphere is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: Text addText(String text, SpaceCenter.ReferenceFrame referenceFrame, org.javatuples.Triplet position, org.javatuples.Quartet rotation, boolean visible) Draw text in the scene. :param String text: The string to draw. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the text position is in. :param org.javatuples.Triplet position: Position of the text. :param org.javatuples.Quartet rotation: Rotation of the text, as a quaternion. :param boolean visible: Whether the text is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. method:: NavballMarker addNavballMarker(org.javatuples.Triplet direction, SpaceCenter.ReferenceFrame referenceFrame, boolean visible) Draw a marker on the navball, pointing in the given direction. :param org.javatuples.Triplet direction: Direction that the marker points in. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the direction is in. :param boolean visible: Whether the marker is visible. :Game Scenes: Flight .. method:: MapMarker addMapMarker(org.javatuples.Triplet position, SpaceCenter.ReferenceFrame referenceFrame, MapMarkerIcon icon, String caption, boolean visible) Draw a marker in the map view, with one of the game's own map icons. :param org.javatuples.Triplet position: Position of the marker. :param SpaceCenter.ReferenceFrame referenceFrame: Reference frame that the position is in. :param MapMarkerIcon icon: The icon that the marker is drawn with. :param String caption: The caption shown when the mouse is over the marker. :param boolean visible: Whether the marker is visible. :Game Scenes: Flight, Tracking Station .. method:: Image addImage(byte[] 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 byte[] data: The contents of the image file. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. note:: Throws an exception if the data is not a PNG or JPEG image. .. method:: void clear(boolean clientOnly) Remove all objects being drawn. :param boolean clientOnly: If true, only remove objects created by the calling client. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph