ベースsource codes of WorldWindJava on github、クラスMilStd2525TacticalSymbolは、layoutDynamicModifiersという名前のメソッドをオーバーライドします。このメソッドでは、DIRECTION_OF_MOVEMENTの場合、最終的にはaddLine(...)が呼び出されます(このメソッドは、currentLinesという名前のリストに行を追加するsuperCals AbstractTacticalSymbolで実装されます)、SPEED_LEADER_SCALEだけを設定でき、移動方向を外部的に変更することはできませんでした。 (移動の方向のための行を含む)スーパークラスAbstractTacticalSymbol、フィールドcurrentLinesで
@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);
}
}
}
挙げリスト(クラスのライン2366)に加え線を描画drawLines(...)という名前のメソッドで使用されています。 2364行目では、色が黒に設定されていることがわかります。
gl.glColor4f(0f, 0f, 0f, opacity.floatValue());
今、私はあなたがMilStd2525TacticalSymbolを拡張し、次の操作を行うことをお勧め:
- は、クラスAbstractTacticalSymbol.Lineを拡張し、店の色にいくつかのフィールドを定義します。
- layoutDynamicModifiersのメソッドをオーバーライドし、修飾子から色を取得し、この特定の色を使用して独自の行を作成し、これをcurrentLinesリストに追加する(この目的でaddLineメソッドをオーバーライドすることができます)独自のキー(たとえばDIRECTION_OF_MOVEMENT_COLOR)を取得します。
- 最後に、独自のLineクラスでストアカラーを使用し、描画線の前にglの色を変更するdrawLinesをオーバーライドします(移動方向が描画された後に黒色に戻すことができます)。
使用しているWorldWindのバージョンはどれですか?すなわち1.X、2.0、2.0-986、2.1 – Igor
2.1.0。私は基本的にマスターのgitブランチに追いついてきました。 – stix