.. default-domain:: cs .. highlight:: csharp .. namespace:: KRPC.Client.Services.Drawing Drawing ======= .. 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. .. function:: Line AddLine(System.Tuple start, System.Tuple end, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw a line in the scene. :parameters: * **start** -- Position of the start of the line. * **end** -- Position of the end of the line. * **referenceFrame** -- Reference frame that the positions are in. * **visible** -- Whether the line is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Line AddDirection(System.Tuple direction, SpaceCenter.ReferenceFrame referenceFrame, float length = 1e+01f, bool visible = true) Draw a direction vector in the scene, starting from the origin of the given reference frame. :parameters: * **direction** -- Direction to draw the line in. * **referenceFrame** -- Reference frame that the direction is in and defines the start position. * **length** -- The length of the line. * **visible** -- Whether the line is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Line AddDirectionFromCom(System.Tuple direction, SpaceCenter.ReferenceFrame referenceFrame, float length = 1e+01f, bool visible = true) Draw a direction vector in the scene, from the center of mass of the active vessel. :parameters: * **direction** -- Direction to draw the line in. * **referenceFrame** -- Reference frame that the direction is in. * **length** -- The length of the line. * **visible** -- Whether the line is visible. :Game Scenes: Flight .. function:: System.Collections.Generic.IList AddAxes(SpaceCenter.ReferenceFrame referenceFrame, float length = 1e+01f, bool visible = true) Draw the axes of a reference frame in the scene, as arrows from its origin. :parameters: * **referenceFrame** -- The reference frame. * **length** -- The length of each axis. * **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 .. function:: Polygon AddPolygon(System.Collections.Generic.IList> vertices, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw a polygon in the scene, defined by a list of vertices. :parameters: * **vertices** -- Vertices of the polygon. * **referenceFrame** -- Reference frame that the vertices are in. * **visible** -- Whether the polygon is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Polyline AddPolyline(System.Collections.Generic.IList> vertices, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw an open line through a list of vertices in the scene. :parameters: * **vertices** -- Vertices of the line. * **referenceFrame** -- Reference frame that the vertices are in. * **visible** -- Whether the line is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Circle AddCircle(System.Tuple center, System.Tuple normal, double radius, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw a circle in the scene. :parameters: * **center** -- Position of the center of the circle. * **normal** -- Normal of the plane of the circle. * **radius** -- Radius of the circle, in meters. * **referenceFrame** -- Reference frame that the position and normal are in. * **visible** -- Whether the circle is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. note:: Throws an exception if the normal is zero. .. function:: Arc AddArc(System.Tuple center, System.Tuple normal, System.Tuple startDirection, double angle, double radius, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw an arc of a circle in the scene. :parameters: * **center** -- Position of the center of the arc. * **normal** -- Normal of the plane of the arc. * **startDirection** -- Direction from the center to the start of the arc. * **angle** -- Angle of the arc, in radians. * **radius** -- Radius of the arc, in meters. * **referenceFrame** -- Reference frame that the position and directions are in. * **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. .. function:: OrbitPath AddOrbit(SpaceCenter.Orbit orbit, bool visible = true) Draw the path of an orbit in the scene. :parameters: * **orbit** -- The orbit. * **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. .. function:: Point AddPoint(System.Tuple position, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw a point in the scene, as a dot that keeps its size on screen. :parameters: * **position** -- Position of the point. * **referenceFrame** -- Reference frame that the position is in. * **visible** -- Whether the point is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Box AddBox(System.Tuple center, System.Tuple size, SpaceCenter.ReferenceFrame referenceFrame, System.Tuple rotation = null, bool visible = true) Draw the edges of a box in the scene. :parameters: * **center** -- Position of the center of the box. * **size** -- Lengths of the sides of the box along its x, y and z axes, in meters. * **referenceFrame** -- Reference frame that the position and rotation are in. * **rotation** -- Rotation of the box, as a quaternion. If null, defaults to ``new System.Tuple(0.0, 0.0, 0.0, 1.0)``. * **visible** -- Whether the box is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Sphere AddSphere(System.Tuple center, double radius, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw a solid sphere in the scene. :parameters: * **center** -- Position of the center of the sphere. * **radius** -- Radius of the sphere, in meters. * **referenceFrame** -- Reference frame that the position is in. * **visible** -- Whether the sphere is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: Text AddText(string text, SpaceCenter.ReferenceFrame referenceFrame, System.Tuple position, System.Tuple rotation, bool visible = true) Draw text in the scene. :parameters: * **text** -- The string to draw. * **referenceFrame** -- Reference frame that the text position is in. * **position** -- Position of the text. * **rotation** -- Rotation of the text, as a quaternion. * **visible** -- Whether the text is visible. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph .. function:: NavballMarker AddNavballMarker(System.Tuple direction, SpaceCenter.ReferenceFrame referenceFrame, bool visible = true) Draw a marker on the navball, pointing in the given direction. :parameters: * **direction** -- Direction that the marker points in. * **referenceFrame** -- Reference frame that the direction is in. * **visible** -- Whether the marker is visible. :Game Scenes: Flight .. function:: MapMarker AddMapMarker(System.Tuple position, SpaceCenter.ReferenceFrame referenceFrame, MapMarkerIcon icon = MapMarkerIcon.Generic, string caption = "", bool visible = true) Draw a marker in the map view, with one of the game's own map icons. :parameters: * **position** -- Position of the marker. * **referenceFrame** -- Reference frame that the position is in. * **icon** -- The icon that the marker is drawn with. * **caption** -- The caption shown when the mouse is over the marker. * **visible** -- Whether the marker is visible. :Game Scenes: Flight, Tracking Station .. function:: 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. :parameters: * **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. .. function:: void Clear(bool clientOnly = false) Remove all objects being drawn. :parameters: * **clientOnly** -- If true, only remove objects created by the calling client. :Game Scenes: Flight, Tracking Station, Editor Vab, Editor Sph