有没有办法在World Wind中修复PointPlacemarks的绘制顺序?
即使在<{>>地标B 的Placemarks example排序中,只需在特定缩放级别移动鼠标即可更改音频地标:
到目前为止,我已经尝试过:
RenderableLayer.setRenderables
而不是RenderableLayer.addRenderable
答案 0 :(得分:0)
Hacky解决方案(需要修改World Wind源代码)
gov.nasa.worldwind.render.DrawContextImpl
从
orderedRenderables
protected PriorityQueue<OrderedRenderableEntry> orderedRenderables =
new PriorityQueue<OrderedRenderableEntry>(100, new Comparator<OrderedRenderableEntry>()
{
public int compare(OrderedRenderableEntry orA, OrderedRenderableEntry orB)
{
double eA = orA.distanceFromEye;
double eB = orB.distanceFromEye;
return eA > eB ? -1 : eA == eB ? (orA.time < orB.time ? -1 : orA.time == orB.time ? 0 : 1) : 1;
}
});
到
protected Queue<OrderedRenderableEntry> orderedRenderables = new ArrayDeque<>();
(或修改比较器以做你想要的)。这将修复绘图顺序。
替代解决方案(不需要修改World Wind源代码)
扩展PointPlacemark
并覆盖makeOrderedRenderable()
:
public class OrderedPointPlacemark extends PointPlacemark {
public OrderedPointPlacemark(Position position) {
super(position);
}
@Override
protected void makeOrderedRenderable(DrawContext dc) {
super.makeOrderedRenderable(dc);
if (this.intersectsFrustum(dc) || this.isDrawLine(dc)) {
dc.pollOrderedRenderables();
dc.addOrderedSurfaceRenderable(this);
}
}
}