我正在 ios swift 中开发一个社交媒体应用程序,我需要实现 bing 地图,以便用户可以通过在 bing 地图上拖动手指在任何地方绘制或擦除地理围栏(折线和多边形)。
如何绘制和获取多边形的动态坐标?
我正在实现这些代码,但是这段代码需要静态坐标(纬度和经度)来绘制
形状
`函数 drawLineOnMap() { 让 center = self.mapView.mapCenter.position
let geopath = MSGeopath(positions:
[MSGeoposition(latitude: center.latitude-0.0005, longitude: center.longitude-0.001),
MSGeoposition(latitude: center.latitude+0.0005, longitude: center.longitude+0.001)])
let mapPolyline = MSMapPolyline()
mapPolyline.path = geopath
mapPolyline.strokeColor = UIColor.black
mapPolyline.strokeWidth = 3
mapPolyline.strokeDashed = true
// Add Polyline to a layer on the map control.
let linesLayer = MSMapElementLayer()
linesLayer.zIndex = 1
linesLayer.elements.add(mapPolyline)
mapView.layers.add(linesLayer);
}`