0
내 뷰의 오른쪽 확대/축소와 모든 뷰를 맞출 수있는 방법을 찾고 있는데,이 뷰는 주석과 사용자 위치를 연결하는 경로를 나타내는 하나의 주석과 userlocation 및 전체 폴리 라인입니다.Mapbox iOS SDK의지도보기에 맞게 폴리 라인과 사용자 위치를 포함한 모든 주석을 입력 하시겠습니까?
나는지도는지도보기로드마다 부르는 아래에이 코드가 있습니다
func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {
if let location = mapView.userLocation?.location?.coordinate, let annotations = mapView.annotations {
let coordinate = annotations.first?.coordinate
mapView.setVisibleCoordinateBounds(MGLCoordinateBounds(sw: location, ne: coordinate!), edgePadding: UIEdgeInsetsMake(100, 50, 100, 200), animated: true)
}
}
이 노선은 거의 선형 좌표 잘 작동하지만이 경로는 좀 더 복잡하고 긴 경우 도움이 안돼. 줌 레벨이 다각형의 무게 중심을 잡아 Truf's centroid 기능을 사용하여 알고있는 경우