The path planning of the German map navigation SDK Gets the trip information mainly used in the Amapnavimanager class
Then adjust the following method
/*! @brief The driving path with the starting point calculates the @param startpoints start coordinates. Support multiple starting points, the end point of the start list is the actual navigation starting point, the other coordinate points are auxiliary information, with directionality, can effectively avoid the road to the other side of the road. @param the endpoints endpoint coordinates. Supports multiple endpoints, the end point of the endpoint list is the actual navigation endpoint, the other coordinate points are auxiliary information, with directionality, can effectively avoid the road to the other side of the road. @param waypoints through the point coordinate sequence and supports path planning of up to 3 pass points. @param calculation strategy of strategy driving path @return path is calculated successfully */-(BOOL) calculatedriveroutewithstartpoints: (Nsarray *) Startpointsendpoints: (Nsarray *) endpointswaypoints: (Nsarray *) Waypointsdrivingstrategy: (AMapNaviDrivingStrategy) strategy;
After success, I will go amapnavimanagerdelegate agent method
/*! @brief Drive Path Planning successful callback function */-(void) navimanageroncalculateroutesuccess: (Amapnavimanager *) Navimanager;
The Amapnavimanager returned by the agent has path information
/*! @brief information about the current navigation path */@property (nonatomic, readonly) Amapnaviroute *naviroute;
When we went in and looked, we found it.
/*! @brief total length of navigation path (in meters) */@property (nonatomic, assign) int routelength;/*! the time required to @brief navigation path (in seconds) */@property ( Nonatomic, assign) int routetime;
Show start point (add to top)
/*** creates the start and end points of the annitation (the starting point is the anchor point if the incoming coordinates are not created at the time) */-(void) addbeginandendannotation {_endannotation = [[ Mapointannotation alloc] init]; cllocationcoordinate2d coordinate = {30.655593,104.073803}; [_endannotation Setcoordinate:coordinate];_endannotation.title = @ "end point"; [ Self.mapview addannotation:_endannotation];_beginannotation = [[Mapointannotation alloc] init]; Cllocationcoordinate2d Coordinatebegin = {30.612339,104.071503}; [_beginannotation Setcoordinate:coordinatebegin];_beginannotation.title = @ "starting point"; [ Self.mapview addannotation:_beginannotation];}
Generates the corresponding anntation in the Mamapviewdelegate
/*! @brief generates the corresponding View@param Mapview map View@param Annotation The specified callout @return (view*/-*) based on anntation Mapview: (Mamapview *) Mapview viewforannotation: (id <MAAnnotation>) annotation;
Draw path (get path information drawn)
-(void) Showroutewithnaviroute: (Amapnaviroute *) naviroute{if (Naviroute = = nil) {return;} Clear Old Overlaysif (_polyline) {[Self.mapview removeoverlay:_polyline];self.polyline = nil;} Nsuinteger Coordiantecount = [naviroute.routecoordinates count]; Cllocationcoordinate2d coordinates[coordiantecount];for (int i = 0; i < Coordiantecount; i++) {Amapnavipoint * Acoordinate = [Naviroute.routecoordinates objectatindex:i];coordinates[i] = Cllocationcoordinate2dmake ( Acoordinate.latitude, acoordinate.longitude);} _polyline = [Mapolyline polylinewithcoordinates:coordinates count:coordiantecount]; [Self.mapview addoverlay:_polyline];}
German map Path Planning