Skip to content

Commit 3388e26

Browse files
authored
Merge pull request #80 from nebsar/develop
Avoid NullPointerException and Fix the Anchor Point of Military Symbology
2 parents 7251ae6 + e45b49d commit 3388e26

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/gov/nasa/worldwind/symbology/milstd2525/MilStd2525TacticalSymbol.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
* Copyright 2006-2009, 2017, 2020 United States Government, as represented by the
33
* Administrator of the National Aeronautics and Space Administration.
44
* All rights reserved.
5-
*
5+
*
66
* The NASA World Wind Java (WWJ) platform is licensed under the Apache License,
77
* Version 2.0 (the "License"); you may not use this file except in compliance
88
* with the License. You may obtain a copy of the License at
99
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
10+
*
1111
* Unless required by applicable law or agreed to in writing, software distributed
1212
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
1313
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
1414
* specific language governing permissions and limitations under the License.
15-
*
15+
*
1616
* NASA World Wind Java (WWJ) also contains the following 3rd party Open Source
1717
* software:
18-
*
18+
*
1919
* Jackson Parser – Licensed under Apache 2.0
2020
* GDAL – Licensed under MIT
2121
* JOGL – Licensed under Berkeley Software Distribution (BSD)
2222
* Gluegen – Licensed under Berkeley Software Distribution (BSD)
23-
*
23+
*
2424
* A complete listing of 3rd Party software notices and licenses included in
2525
* NASA World Wind Java (WWJ) can be found in the WorldWindJava-v2.2 3rd-party
2626
* notices and licenses PDF found in code directory.
@@ -540,15 +540,18 @@ protected void layoutDynamicModifiers(DrawContext dc, AVList modifiers, OrderedS
540540
double length = this.iconRect.getHeight();
541541
Boolean directionOnly = true;
542542
Object d = this.getModifier(SymbologyConstants.SPEED_LEADER_SCALE);
543-
if (d != null && d instanceof Number)
543+
if (d != null && d instanceof Number) {
544544
directionOnly = false;
545545
length *= ((Number) d).doubleValue();
546-
546+
}
547547
if (this.useGroundHeadingIndicator)
548548
{
549549
List<? extends Point2D> points = MilStd2525Util.computeGroundHeadingIndicatorPoints(dc, osym.placePoint,
550-
(Angle) o, length, this.iconRect.getHeight(), directionOnly);
551-
this.addLine(dc, Offset.BOTTOM_CENTER, points, LAYOUT_RELATIVE, points.size() - 1, osym);
550+
(Angle) o, length, this.iconRect.getHeight(), directionOnly);
551+
if (directionOnly)
552+
this.addLine(dc, Offset.BOTTOM_CENTER, points, LAYOUT_RELATIVE, points.size() - 4, osym);
553+
else
554+
this.addLine(dc, Offset.BOTTOM_CENTER, points, LAYOUT_RELATIVE, points.size() - 1, osym);
552555
}
553556
else
554557
{
@@ -770,4 +773,4 @@ else if (this.getOffset() == null && this.iconRect != null)
770773
osym.dy = -this.iconRect.getCenterY();
771774
}
772775
}
773-
}
776+
}

0 commit comments

Comments
 (0)