豆豆豆木子 最新主题

推荐阅读

2 2137 2018-07-06
本帖最后由 豆豆豆木子 于 2018-07-06编辑

如何处理导航方向?

/**
 *  设备旋转方向事件回调。结合地图方向模式TYMapViewModeFollowing可以处理地图自动旋转,
 以及方向箭头随地磁旋转功能。
 *
 *  @param manager    定位引擎实例
 *  @param newHeading 新的设备方向结果
 */- (void)TYLocationManager:(TYLocationManager *)manager didUpdateDeviceHeading:
 (double)newHeading {
	NSLog(@"地图初始北偏角:%f,当前设备北偏角:%f",self.mapView.building.
	initAngle,newHeading);
	//初始北偏角内部已经处理
	[self.mapView processDeviceRotation:newHeading];}

2. 如何计算导航距离?

  double len = 0;
        for (TYRoutePart *rp in routeResult.allRoutePartArray) {
            len += [[AGSGeometryEngine defaultGeometryEngine] distanceFromGeometry:rp.
            getFirstPoint toGeometry:rp.getLastPoint];
        }
        int min = ceil(len/80);
        [self textToSpeech:
        [NSString stringWithFormat:@"开始导航,全程%.0f米,大约需要%d分钟",len,min]];

3. 如何获取导航提示?

       TYRoutePart *part = [routeResult getNearestRoutePart:localPoint];
        //导航提示
        NSArray *routeGuides = [routeResult getRouteDirectionalHint:part];
        if (routeGuides.count) {
            TYDirectionalHint *hint = 
            [routeResult getDirectionHintForLocation:localPoint FromHints:routeGuides];
            [self textToSpeech:[hint getDirectionString]];

        }

4. 导航语音怎么集成?

直接使用IOS自带AVSpeechSynthesizer即可实现:

       - (IBAction)textToSpeech:(NSString *)text
{
    [self.speech stopSpeakingAtBoundary:AVSpeechBoundaryImmediate];
    AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:text]; 
     //需要转换的文本
    utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];
    float sysVer = [UIDevice currentDevice].systemVersion.floatValue;
    if (sysVer < 9) {
        utterance.rate = 0.15;
    }else if(sysVer == 9){
        utterance.rate = 0.53;
    }else{
        utterance.rate = 0.5;
    }
    //    utterance.pitchMultiplier = 2;
    [self.speech speakUtterance:utterance];
}
0

2条回复

沙发

智石科技联系:18682337749(手机与微信同号),室内定位,场景:人员定位(监狱,医院,幼儿园,养老院,游乐场等)

0
 
板凳

因这里的留言难以即时关注到,需要详细方案资料/预算报价/需求沟通的客官,请主动联系智石科技  商务:罗 137 6049 3160(微信同步),QQ:529673310,随时在线。欢迎来电交流~~

0