我正在通过以下代码迅速通过位置对象列表绘制路径:
let path = GMSMutablePath()
for location in locationArray {
path.add(CLLocationCoordinate2D(latitude: CLLocationDegrees(location.latitude!)!,
longitude: CLLocationDegrees(location.longitude!)!))
}
let polyline = GMSPolyline(path: path)
polyline.map = self.mapView
它在位置之间绘制一条简单的蓝线,但我需要在之类的位置之间绘制方向线。
这是js在网站上实现的; js代码是
var lineSymbol = {
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
strokeColor: '#393',
strokeColor: '#f70202',
fillColor: '#f70202',
fillOpacity: 1
};
var line = new google.maps.Polyline({
path: drivePathCoordinates,
geodesic: true,
strokeColor: '#0c6016',
strokeOpacity: 1.0,
strokeWeight: 2,
icons: [{
icon: lineSymbol,
offset: '0%'
}]
});
line.setMap(map);