首页 文章

增强现实与wikitude sdk

提问于
浏览
0

我正在使用wikitude sdk开发增强现实应用程序 . 我对这个sdk很安静 . 我按照sdk文档指南实现了一切 . 但我无法在AR浏览器视图中绘制POI点 . 为了生成POI点,我使用了以下代码 .

- (NSMutableArray *)generatePois:(NSUInteger)numberOfPois
{
    NSLog(@"%s",__PRETTY_FUNCTION__);
    NSMutableArray *poiArray = [NSMutableArray arrayWithCapacity:numberOfPois];

    for (NSUInteger i = 0; i < numberOfPois; ++i) {
        objGlobalDatas=[arrayItems objectAtIndex:i];

        WTPoi *poi = [[WTPoi alloc] init];
        NSString *strId=objGlobalDatas.arId;
        NSInteger poiId=[strId integerValue];
        poi.id = poiId;
        poi.name = objGlobalDatas.name;
        NSLog(@"poi name =%@",objGlobalDatas.name);
        poi.detailedDescription = objGlobalDatas.poi_description;
       // poi.type =  i%3; // set the type from 0->2->0->2...
        poi.type=1;
        NSString *strLat=objGlobalDatas.latitude;
        NSString *strLng=objGlobalDatas.longitude;
        float lan=[strLat doubleValue];
        float lng=[strLng doubleValue];
        poi.latitude = lan ;//+ WT_RANDOM(-0.01, 0.01); // set the latitude around your current location
        poi.longitude = lng;// + WT_RANDOM(-0.01, 0.01);
        poi.altitude = YOUR_CURRENT_ALTITUDE + WT_RANDOM(0, 200); // altitude offset
        poi.poiimg=objGlobalDatas.poi_indicator_image;

        poi.weburl=objGlobalDatas.website;
        poi.distance=objGlobalDatas.distance;
        [poiArray addObject:poi];
        [poi release];

    }
    NSLog(@"check =%@",poiArray);
    return poiArray;
}

我通过解析JSON链接获取POI点数据后调用了此函数 . 在poiArray中,我在当前纬度和经度周围得到三个物体 . 但是没有在AR浏览器视图中显示 .

1 回答

  • 2

    这个代码是否与Wikitude SDK API相关?如果是这样,你就错过了 [architectView callJavaScript:@"*jsonString*"] 电话 . 此调用将加载在json字符串中定义的位置以加载到AR中 . 仔细看看SimpleARBrowser示例 . 它演示了在AR中加载场所的所有必要步骤 .

相关问题