Service#

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.

Line addLine(org.javatuples.Triplet<Double, Double, Double> start, org.javatuples.Triplet<Double, Double, Double> end, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw a line in the scene.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Line addDirection(org.javatuples.Triplet<Double, Double, Double> direction, SpaceCenter.ReferenceFrame referenceFrame, float length, boolean visible)#

Draw a direction vector in the scene, starting from the origin of the given reference frame.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Line addDirectionFromCom(org.javatuples.Triplet<Double, Double, Double> direction, SpaceCenter.ReferenceFrame referenceFrame, float length, boolean visible)#

Draw a direction vector in the scene, from the center of mass of the active vessel.

Parameters:
Game Scenes:

Flight

java.util.List<Line> addAxes(SpaceCenter.ReferenceFrame referenceFrame, float length, boolean visible)#

Draw the axes of a reference frame in the scene, as arrows from its origin.

Parameters:
  • referenceFrame (SpaceCenter.ReferenceFrame) – The reference frame.

  • length (float) – The length of each axis.

  • visible (boolean) – 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

Polygon addPolygon(java.util.List<org.javatuples.Triplet<Double, Double, Double>> vertices, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw a polygon in the scene, defined by a list of vertices.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Polyline addPolyline(java.util.List<org.javatuples.Triplet<Double, Double, Double>> vertices, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw an open line through a list of vertices in the scene.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Circle addCircle(org.javatuples.Triplet<Double, Double, Double> center, org.javatuples.Triplet<Double, Double, Double> normal, double radius, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw a circle in the scene.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Note

Throws an exception if the normal is zero.

Arc addArc(org.javatuples.Triplet<Double, Double, Double> center, org.javatuples.Triplet<Double, Double, Double> normal, org.javatuples.Triplet<Double, Double, Double> startDirection, double angle, double radius, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw an arc of a circle in the scene.

Parameters:
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.

OrbitPath addOrbit(SpaceCenter.Orbit orbit, boolean visible)#

Draw the path of an orbit in the scene.

Parameters:
  • orbit (SpaceCenter.Orbit) – The orbit.

  • visible (boolean) – 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.

Point addPoint(org.javatuples.Triplet<Double, Double, Double> position, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw a point in the scene, as a dot that keeps its size on screen.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Box addBox(org.javatuples.Triplet<Double, Double, Double> center, org.javatuples.Triplet<Double, Double, Double> size, SpaceCenter.ReferenceFrame referenceFrame, org.javatuples.Quartet<Double, Double, Double, Double> rotation, boolean visible)#

Draw the edges of a box in the scene.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Sphere addSphere(org.javatuples.Triplet<Double, Double, Double> center, double radius, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw a solid sphere in the scene.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Text addText(String text, SpaceCenter.ReferenceFrame referenceFrame, org.javatuples.Triplet<Double, Double, Double> position, org.javatuples.Quartet<Double, Double, Double, Double> rotation, boolean visible)#

Draw text in the scene.

Parameters:
Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

NavballMarker addNavballMarker(org.javatuples.Triplet<Double, Double, Double> direction, SpaceCenter.ReferenceFrame referenceFrame, boolean visible)#

Draw a marker on the navball, pointing in the given direction.

Parameters:
Game Scenes:

Flight

MapMarker addMapMarker(org.javatuples.Triplet<Double, Double, Double> 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.

Parameters:
Game Scenes:

Flight, Tracking Station

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 (byte[]) – 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.

void clear(boolean clientOnly)#

Remove all objects being drawn.

Parameters:
  • clientOnly (boolean) – If true, only remove objects created by the calling client.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph