我正在使用World Wind作为我为雇主建立的应用程序。我一直在关注官方网站推荐的tutorial,但虽然它非常简单,但不是很详细。他在他的教程中用于添加地点标记的方法在我的应用程序中对我不起作用,因为我不想使用ApplicationTemplate
。
我已经创建了我的WorldWindowGLCanvas
对象,并使用JPanel
将其置于BorderLayout
中,就像这样;
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
,或者即使是}我需要做什么。我尝试了很多(可怕的)想法,但到目前为止还没有。
如何做到这一点?
答案 0 :(得分:2)
添加图层非常简单。
wwd.getModel().getLayers().add(layer);
编辑: 您是通过设置其属性来设置PointPlacemark的图像吗?
PointPlacemarkAttributes atts = new PointPlacemarkAttributes();
atts.setImageAddress(String address);
placeMark.setAttributes(atts);