How to add lat/lon grid lines to JMapViewer

亡梦爱人 提交于 2019-12-11 04:35:44

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/17030973/how-to-add-lat-lon-grid-lines-to-jmapviewer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!