我有一些位置,例如: - a到b点,c到点d。
点a到b应该用红色绘制,点d到c应该用黄色绘制。这一点c和点d将是移动车辆,因此它将是动态的。
目前
func initializePolylineAnnotation2(_newLocation: CLLocation)
{
//self.polyline.strokeColor = UIColor(red:1.00, green:0.84, blue:0.00, alpha:1.0)
//self.polyline.strokeWidth = 5.0
var polyline = GMSPolyline()
let solidRed = GMSStrokeStyle.solidColor(UIColor(red:1.00, green:0.84, blue:0.00, alpha:1.0))
polyline.spans = [GMSStyleSpan(style: solidRed)]
polyline.map = self.mapView
self.updateOverlay(_newLocation,polyline: polyline)
self.updateCurrentPositionMarker(_newLocation)
}
func updateOverlay(_ currentPosition: CLLocation,polyline : GMSPolyline)
{
self.path.add(currentPosition.coordinate)
polyline.path = self.path
if self.DBidArr.contains(self.movingChannel)
{
let index = self.DBidArr.index(of: self.movingChannel)
if index! < self.pathDB.count
{
self.pathDB[index!].add(currentPosition.coordinate)
}
}
}