本文介绍了如何将纬度/经度网格线添加到JMapViewer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JMapViewer时,有什么方法可以自动显示纬度/经度网格线?不幸的是,JMapViewer.setTileGridVisible方法不是一回事.我知道可以手动执行此操作,但是随后我必须弄清楚何时显示什么分辨率等.听起来很痛苦.

When using JMapViewer, is there any way to automatically display lat/lon grid lines? The JMapViewer.setTileGridVisible method is unfortunately not the same thing. I know it's possible to do it manually, but then I have to figure out when to display what resolutions, etc. Sounds like a pain.

推荐答案

或者,您可以使用.在处理程序中,您可以更新标签或设置工具提示,例如:

As an alternative, you can override mouseMoved() in DefaultMapController using the approach shown here. In the handler, you can update a label or set a tooltip, for example:

new DefaultMapController(map) {

    @Override
    public void mouseMoved(MouseEvent e) {
        map.setToolTipText(map.getPosition(e.getPoint()).toString());
    }
};

这篇关于如何将纬度/经度网格线添加到JMapViewer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 06:07