NetBeans平台TopComponent上的WorldWind Java [英] WorldWind Java on a Netbeans Platform TopComponent

查看:105
本文介绍了NetBeans平台TopComponent上的WorldWind Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为位于Netbeans平台TopComponent(使用netbeans 7.0)上的WorldWind Java(1.2版)添加一个层. TopComponent处于编辑器模式,对于WWJ,我使用WorldWindowGLCanvas,它是TopComponent上的单个摆动组件,并与BorderLayout.CENTER一起放置. 如果我使用构造函数添加各层,则一切正常,我可以看到各层都很好.如果使用摇摆控件(例如按钮)添加图层,则该图层将添加到图层列表中,但不会渲染. WMS和可渲染层均会发生这种情况. 在纯挥杆应用程序上执行相同的过程也很好,这使我相信WWJ中的渲染过程与TopComponent绘画有某种冲突. 任何帮助将不胜感激.

I'm trying to add a layer to WorldWind Java (version 1.2) situated on a Netbeans Platform TopComponent (using netbeans 7.0). The TopComponent is in Editor mode, and for WWJ I use WorldWindowGLCanvas which is the single swing component on the TopComponent and it is placed with BorderLayout.CENTER. If I add the layers using the constructor all works well, I can see the layers fine. If I add the layer using swing controls (eg a button) the layer gets added to the layer list but it is not rendered. This happens for both WMS and Renderable layer. Same process on a pure swing application works fine which leads me to believe that the rendering process in WWJ is somehow conflicting with the TopComponent painting. Any help with be greatly appreciated.

推荐答案

我已经使用NetBeans Platform(7.0.1)和gov.nasa.worldwind.awt.WorldWindowGLCanvasgov.nasa.worldwindx.examples.LayerPanel

I've set up a demo using NetBeans Platform (7.0.1) with gov.nasa.worldwind.awt.WorldWindowGLCanvas and gov.nasa.worldwindx.examples.LayerPanel

初始化代码:

private void initComponents() {
    canvas = new WorldWindowGLCanvas();

    Model model = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
    canvas.setModel(model);

    layerPanel = new LayerPanel(canvas);

    setLayout(new BorderLayout());
    add(canvas, BorderLayout.CENTER);
    add(layerPanel, BorderLayout.WEST);
}
private WorldWindowGLCanvas canvas;
private LayerPanel layerPanel;

这与单独运行示例一样,因此我想说问题不在于NetBeans平台.没有任何代码,很难说出问题所在.

This works the same as it does running the sample as a stand alone so I would say that the problem does not lie in the NetBeans Platform. Without any code it's hard to say what's going wrong.

请注意,gov.nasa.worldwind.awt.WorldWindowGLCanvas不是Swing组件,而是重量级组件.这与您的问题无关,但我不禁指出. Swing组件是gov.nasa.worldwind.awt.WorldWindowGLJPanel

Note that the gov.nasa.worldwind.awt.WorldWindowGLCanvas is not a Swing component but a heavy weight component. This is irrelevant to your question but I couldn't help but point it out. The Swing component is gov.nasa.worldwind.awt.WorldWindowGLJPanel

我意识到我的回答不是很有帮助,所以要补救一下,我会添加一个建议.您可以尝试使TopComponent无效并在需要渲染新图层时调用repaint.

I realize my answer is not very helpful, so to remedy that I would add a suggestion. You could try to invalidate the TopComponent and call repaint whenever you need it to render the new layer.

这篇关于NetBeans平台TopComponent上的WorldWind Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆