[英]JMapViewer centering
I am trying to put a JMapViewer into a program I am doing and I want it to be centered in a specific area (Leicester, UK). 我正在尝试将JMapViewer放入我正在做的程序中,并希望它集中在特定区域(莱斯特,英国)。 Although I am not sure how the .setDisplayPosition function works and how I can use the co ordinates i have for it to do this task?
虽然我不确定.setDisplayPosition函数是如何工作的,以及我如何使用它的坐标来完成这项任务? Thanks.
谢谢。
Use JMapViewer#setDisplayPositionByLatLon()
to zoom to a particular point. 使用
JMapViewer#setDisplayPositionByLatLon()
缩放到特定点。
Addendum: I don't have the method setDisplayPositionByLatLon()
. 附录: 我没有方法
setDisplayPositionByLatLon()
。
Ah, the method was removed in r30244
in favor of setDisplayPosition()
. 啊,在
r30244
中删除了该方法,转而使用setDisplayPosition()
。
Coordinate paris = new Coordinate(48.8567, 2.3508);
map.setDisplayPosition(paris, 8);
From the log: 从日志中:
$ svn log -r30244 src/org/openstreetmap/gui/jmapviewer/JMapViewer.java ------------------------------------------------------------------------ r30244 | glebius | 2014-01-31 07:51:51 -0500 (Fri, 31 Jan 2014) | 3 lines To match getPosition() and simplify code rename setDisplayPositionByLatLon() into setDisplayPosition(Coordinate to, ...).
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.