函数在jxmap中查找地图的中心

时间:2017-04-25 18:19:07

标签: java swing maps

在这里输入代码在jxmap中有任何函数可以找到地图的中心。 我想找到以下代码中给出的地图中心。 有没有办法找到该中心,请建议。

 `GeocoderRequest request = new GeocoderRequest(map);
 request.setAddress("30.332823,78.050087");
getServices().getGeocoder().geocode(request, new GeocoderCallback(map) 
{
@Override
public void onComplete(GeocoderResult[] result, GeocoderStatus status)
 {
  if (status == GeocoderStatus.OK)`
 {

                            Marker marker = new Marker(map);
                            System.out.println(result[0].toString());
                            marker.setPosition(result[0].getGeometry().getLocation());                                

                            final InfoWindow window = new InfoWindow(map);
                            window.setContent("Hello, World!");
                            window.open(map, marker);
                        }
                    }
                });

1 个答案:

答案 0 :(得分:0)

以下是doc:

中的一个示例
// Getting the associated map object
final Map map = getMap();
// Setting the map center
map.setCenter(new LatLng(map, 35.91466, 10.312499));
// Setting initial zoom value
map.setZoom(2.0);

https://www.teamdev.com/jxmaps#features