WorldWindEarth / WorldWindJava

A community supported fork of the NASA WorldWind Java SDK (WWJ) is for building cross-platform 3D geospatial desktop applications in Java.
https://worldwind.earth/WorldWindJava/
48 stars 14 forks source link

Problem with the anchor point of Military Symbology and NullPointerException when SPEED_LEADER_SCALE is not set #79

Closed nebsar closed 1 year ago

nebsar commented 1 year ago

Description

  1. When direction of movement arrow is added to Military Symbol, symbols with ground heading indicator has wrong anchor point. Because of this, when earth is rotated the symbol's direction of movement shows offset.

SOLUTION: Inside the MilStd2525TacticalSymbol class, at line 547, we need to add the following code:

if (this.useGroundHeadingIndicator) {
    List<? extends Point2D> points = MilStd2525Util.computeGroundHeadingIndicatorPoints(dc, osym.placePoint,
                   (Angle) o, length, this.iconRect.getHeight(), directionOnly);
    if (directionOnly) {
        this.addLine(dc, Offset.BOTTOM_CENTER, points, LAYOUT_RELATIVE, points.size() - 4, osym);
    } else {
        this.addLine(dc, Offset.BOTTOM_CENTER, points, LAYOUT_RELATIVE, points.size() - 1, osym);
    }
}
  1. When SPEED_LEADER_SCALE is not set NullPointerException is get.

SOLUTION: Inside the MilStd2525TacticalSymbol class, at line 543, we need to add curly brackets to if clause as below:

if (d != null && d instanceof Number) {
    directionOnly = false;
    length *= ((Number) d).doubleValue();
}
ComBatVision commented 1 year ago

Create pull-request please.