为满足开发者的实际业务需求,SDK 支持在全景图内绘制自定义标注,并支持响应相应的点击事件。
以下为覆盖物抽象基类 BaiduPanoOverlay:
@interface BaiduPanoOverlay : NSObject@property(strong, nonatomic) NSString *overlayKey;// 覆盖物唯一标识@property(assign, nonatomic) BaiduPanoOverlayType type;//覆盖物类型@property(assign, nonatomic) CLLocationCoordinate2D coordinate;//覆盖物坐标,百度坐标@property(assign, nonatomic) double height;//覆盖物高度@end
百度 iOS 全景 SDK 的接口和功能目前支持 BD09 坐标。因此,开发者在使用全景 SDK 的接口和功能时,需要将 WGS84 坐标或 GCJ02 坐标转换为 BD09 坐标。
相应的接口和转换方法请参考坐标转换,请勿使用非官方的转换方法。
如果要在某个全景中显示文字覆盖物,首先需要设置覆盖物的坐标和高度,然后设置其文字属性即可。
BaiduPanoLabelOverlay *textOverlay = [[BaiduPanoLabelOverlay alloc] init];textOverlay.overlayKey = @"12345";textOverlay.coordinate = CLLocationCoordinate2DMake(36.6, 114.4);textOverlay.height = 100;// 字体颜色textOverlay.textColor = [UIColor redColor];// 背景颜色textOverlay.backgroundColor = [UIColor whiteColor];textOverlay.fontSize = 10;// 支持换行textOverlay.text = @"helloworld";// 边缘距textOverlay.edgeInsets = UIEdgeInsetsMake(2, 3, 4, 5);[self.panoramaView addOverlay:textOverlay];

BaiduPanoImageOverlay *imageOverlay = [[BaiduPanoImageOverlay alloc] init];imageOverlay.overlayKey = @"54321";imageOverlay.coordinate = CLLocationCoordinate2DMake(36.6, 114.4);imageOverlay.height = 100;imageOverlay.size = CGSizeMake(40, 50);imageOverlay.image = [UIImage imageNamed:@"test.jpg"];

上一篇
下一篇