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:
- extend class
AbstractTacticalSymbol.Line
and define some fields to store color.
- override method
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).
- finally override
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).