作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Point da = map1().getMapPosition(48.922499263758255, 16.875);
System.out.println(da);
有人可以帮助我吗?我想使用此 getMapPosition
将坐标转换为点,但无论我做什么,它都会给我一个 null
值。为什么会这样?
谢谢。
最佳答案
快速查看相关JMapViewer
源代码显示您对 getMapPosition()
的调用调用附近的重载,其中 checkOutside
设置为 true
。如果坐标对应的Point
在可见 map 之外,则结果为null
。
if (checkOutside && (p.x < 0 || p.y < 0 || p.x > getWidth() || p.y > getHeight())) {
return null;
}
相反,使用允许您将 checkOutside
显式设置为 false
的实现之一。例如,
Point da = map1().getMapPosition(48.9225, 16.875, false);
或
Coordinate coord = new Coordinate(48.9225, 16.875);
Point da = map1().getMapPosition(coord, false);
关于java - getMapPostition 返回空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43463367/
Point da = map1().getMapPosition(48.922499263758255, 16.875); System.out.println(da); 有人可以帮助我吗?我想使用此
我是一名优秀的程序员,十分优秀!