简体   繁体   English

在JMapViewer中的两个地理位置之间绘制线

[英]Draw Line between two Geo Points in JMapViewer

I'm working with OpenStreet Maps in Java with JMap Viwer http://wiki.openstreetmap.org/wiki/JMapViewer I can load the maps and everything ok but I don't know how to draw a line between two points from a latitude and longitude. 我正在使用JMap Viwer在Java中使用OpenStreet Maps http://wiki.openstreetmap.org/wiki/JMapViewer我可以加载地图,一切正常,但是我不知道如何从纬度在两点之间绘制一条线和经度。

Any body know the function to draw this kind of lines? 任何人都知道画这种线的功能吗?

Thank you. 谢谢。

The addMapPolygon() method of JMapViewer works for this, but paintPolygon() silently rejects a polygon having fewer than three vertices. 所述addMapPolygon()的方法JMapViewer适用于这一点,但是paintPolygon()默默地拒绝具有少于三个顶点的多边形。 For a line between two points, just repeat the last Coordinate . 对于两点之间的直线,只需重复最后一个Coordinate

Coordinate one = new Coordinate(...);
Coordinate two = new Coordinate(...);
List<Coordinate> route = new ArrayList<Coordinate>(Arrays.asList(one, two, two));
map.addMapPolygon(new MapPolygonImpl(route));

I am also working on this software and using the JMapviewer.jar. 我也在使用此软件并使用JMapviewer.jar。 Yet, I do not seem to have the addMapPolygon nor the MapPolygonImpl ... Is there a specific version I should be working with ? 但是,我似乎没有addMapPolygon或MapPolygonImpl ...是否应该使用特定版本? (I downloaded my version here: enter link description here (我在这里下载了我的版本:在此处输入链接说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM