如何使用PointPlacemarks的添加图层?

问题描述:

我正在使用World Wind来为我的雇主创建应用程序。我一直在关注官方网站推荐的tutorial,但它很简单,但不是很详细。他在他的教程中使用的添加位置标记的方法在我的应用程序中不适用于我,因为我不想使用ApplicationTemplate如何使用PointPlacemarks的添加图层?

我已经创建了我的WorldWindowGLCanvas对象,并且使用BorderLayout将它集中在JPanel中,就像这样;

wwd = new WorldWindowGLCanvas(); 
wwd.setPreferredSize(this.getPreferredSize()); 
wwd.setModel(new BasicModel()); 
wwd.getView().setEyePosition(Position.fromDegrees(53.044516, -1.659794, 65e4)); // Set initial view position. ie over England. 
layer = new RenderableLayer(); 
... 
this.setLayout(new BorderLayout()); 
this.add(wwd, BorderLayout.CENTER); 

然后(从其他类中的方法),我创建了PointPlacemark对象,并将它们添加到layer ...

pointPosition = Position.fromDegrees(periodical.getLatitude(), periodical.getLongitude()); 
placeMark = new PointPlacemark(pointPosition); 
placeMark.setValue(AVKey.DISPLAY_NAME, periodical.getReference()); 
thisOne.layer.addRenderable(placeMark); 

但现在我无法弄清楚如何添加layer到我的WorldWindowGLCanvas,以便PointPlacemark会出现,或者即使那我需要做的。我已经尝试了一大堆(可怕的)想法,但迄今为止没有。

这怎么办?

添加图层非常简单。

wwd.getModel().getLayers().add(layer); 

编辑: 你设置图像通过设置其属性PointPlacemark?

PointPlacemarkAttributes atts = new PointPlacemarkAttributes(); 
atts.setImageAddress(String address); 
placeMark.setAttributes(atts); 
+0

我试过了,但地图标记在地图上仍然不可见。还有什么需要做的吗?至少我知道我并不太遥远。 –

+0

自从我与World Wind积极编码已经过去几个月。添加图层后,可能需要添加wwd.repaint()调用。 – flight2039

+0

事实证明,你第一次是正确的,我的长期和纬度值是不正确的(这是绘画,但他们在地球的另一端绘画)。我会编辑你的答案回到它是如何并接受它。 >