Skip to content

GNSSPanel

vstarlinger edited this page Aug 29, 2017 · 2 revisions

The GNSSPanel class is responsible for displaying GNSS Coordinates in a 3D view of the Earth. This is done by using the NASA World Wind library and using Markers and Paths which are described in more detail in this section.

The Nasa World Wind library provides an ONLINE and OFFLINE mode. Since the ONLINE mode can be quite data hungry, it might be benefitial to turn to OFFLINE mode in certain cases. This can be done by setting the OFFLINEMODE field in the GNSSPanel class to true.

The GNSSPanel class inherits the Java Swing JPanel class. To use a GNSSPanel in Swing, a simple construtor call is sufficient, then the GNSSPanel can be added to any JComponent. To add the GNSSPanel to a JavaFX Application the static void addGNSSPaneltoStackPane(StackPane stackPane) method needs to be called.

Example:

@FXML
private StackPane pane;
public void initialize(URL url, ResourceBundle rb) {
	GNSSPanel.addGNSSPaneltoStackPane(pane);
}

Markers

The markers of the GNSSPanel are currently set using this code:

    //setting the markers to red spheres with no transperency with a minimum
    //size of 0.5 meters and no maximum size and 4 pixels per marker
    BasicMarkerAttributes markerAttrs = new BasicMarkerAttributes(Material.RED,
            BasicMarkerShape.SPHERE, 1d, 4, 0.5d, Double.MAX_VALUE);

    ArrayList<Marker> markers = new ArrayList<>();
    for (Position position : positions) {
        MyMarker m = new MyMarker(position, markerAttrs, (int) position.elevation);
        markers.add(m);
    }

Note here that the attributes of the markers are set with the BasicMarkerAttributes object. To change the size of the markers there are two options. Frist the pixel size can be changed (currently 4) which determines the numbers of pixels used to represent the marker. Also the maximum and minimum size of the sphere can be set in meters. (If max value is set to low (e.g. 300) the markers will not be visible on a global scale)

Paths

The paths are set similarly to the Markers.

    // Create and set an attribute bundle
    ShapeAttributes shapeAttrs = new BasicShapeAttributes();
    shapeAttrs.setOutlineMaterial(Material.WHITE);
    shapeAttrs.setOutlineWidth(2d);

    // Create a path, set some of its properties and set its attributes.
    Path path = new Path(positions);
    path.setAttributes(shapeAttrs);
    path.setVisible(true);
    path.setAltitudeMode(WorldWind.ABSOLUTE);
    path.setPathType(AVKey.LINEAR);

Here the attributes are set with the BasicShapeAttributes object.

OrbitView

To animate between sets of data, the BasicOrbitView class provided by the NASA World Wind library is used. Currently the transition is animated but can be turned off by setting the boolean value in the bov.addCenterAnimator(bov.getCenterPosition(), newPos, true); method call to false.

Clone this wiki locally