In NASA WorldWind, one can assign a "direction of travel" speed leader to the Milstd-2525 symbols. However, this speed leader is black, making it very difficult to see against the dark blue ocean background. I have tried changing the internal color material in the TacticalSymbolAttributes, but this doesn't seem to have an effect (on anything). The documentation unfortunately doesn't provide any clues on how to change the line's color.
Is it possible to change the color of the Milstd-2525 Tactical Symbol's speed leader line in Worldwind, and if so, how?
Base of source codes of WorldWindJava on github, class MilStd2525TacticalSymbol
overrides method named layoutDynamicModifiers
. In this method you can see that for DIRECTION_OF_MOVEMENT
only eventually addLine(...)
is called (This method is implemented in the superclass AbstractTacticalSymbol
which only adds a line to a list named currentLines
) and only SPEED_LEADER_SCALE
could be set and other properties for the direction of movement could not be changed externally.
@Override
protected void layoutDynamicModifiers(DrawContext dc, AVList modifiers, OrderedSymbol osym)
{
this.currentLines.clear();
if (!this.isShowGraphicModifiers())
return;
// Direction of Movement indicator. Placed either at the center of the icon or at the bottom of the symbol
// layout.
Object o = this.getModifier(SymbologyConstants.DIRECTION_OF_MOVEMENT);
if (o != null && o instanceof Angle)
{
// The length of the direction of movement line is equal to the height of the symbol frame. See
// MIL-STD-2525C section 5.3.4.1.c, page 33.
double length = this.iconRect.getHeight();
Object d = this.getModifier(SymbologyConstants.SPEED_LEADER_SCALE);
if (d != null && d instanceof Number)
length *= ((Number) d).doubleValue();
if (this.useGroundHeadingIndicator)
{
List<? extends Point2D> points = MilStd2525Util.computeGroundHeadingIndicatorPoints(dc, osym.placePoint,
(Angle) o, length, this.iconRect.getHeight());
this.addLine(dc, Offset.BOTTOM_CENTER, points, LAYOUT_RELATIVE, points.size() - 1, osym);
}
else
{
List<? extends Point2D> points = MilStd2525Util.computeCenterHeadingIndicatorPoints(dc,
osym.placePoint, (Angle) o, length);
this.addLine(dc, Offset.CENTER, points, null, 0, osym);
}
}
}
In the superclass AbstractTacticalSymbol
, field currentLines
(which contains the line for the direction of movement) is used in a method named drawLines(...)
which draws added lines to the mentioned list (line 2366 of class). In line 2364 you can see that color is set to black.
gl.glColor4f(0f, 0f, 0f, opacity.floatValue());
Now I suggest you extend MilStd2525TacticalSymbol
and do following:
AbstractTacticalSymbol.Line
and define some fields to store color.layoutDynamicModifiers
and get your own key (for example DIRECTION_OF_MOVEMENT_COLOR
) to get color from modifiers and use this given color to create your own line and add this to currentLines
list (you can override method addLine
for this purpose).drawLines
to use store color in your own Line
class and change the color of gl
before draw line (you can change back color to black after the direction of movement is drawn).I'm running off an earlier Worldwind but try Taking a look at AbstractTacticalSymbol.java -> drawLines() method.
It's defaulting the glColor to black before drawing the lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With