gpt4 book ai didi

java - PointPlacemarks 的绘制顺序

转载 作者:太空宇宙 更新时间:2023-11-04 13:38:37 25 4
gpt4 key购买 nike

是否有办法修复 World Wind 中 PointPlacemarks 的绘制顺序?

即使在 Placemarks example只需在特定缩放级别移动鼠标即可更改地标 B 和音频地标的顺序:

enter image description here

enter image description here

到目前为止我已经尝试过:

最佳答案

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);
}
}
}

关于java - PointPlacemarks 的绘制顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31437730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com