You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.6 KiB

//
// MATileOverlay.h
// MapKit_static
//
// Created by Li Fei on 11/22/13.
// Copyright © 2016 Amap. All rights reserved.
//
#import "MAConfig.h"
#if MA_INCLUDE_OVERLAY_TILE
#import "MAOverlay.h"
///该类是覆盖在球面墨卡托投影上的图片tiles的数据源
@interface MATileOverlay : NSObject <MAOverlay>
///瓦片大小,默认是256x256, 最小支持64*64
@property (nonatomic, assign) CGSize tileSize;
///tileOverlay的可见最小Zoom值
@property NSInteger minimumZ;
///tileOverlay的可见最大Zoom值
@property NSInteger maximumZ;
///同initWithURLTemplate:中的URLTemplate
@property (readonly) NSString *URLTemplate;
///暂未开放
@property (nonatomic) BOOL canReplaceMapContent;
///区域外接矩形,可用来设定tileOverlay的可渲染区域
@property (nonatomic) MAMapRect boundingMapRect;
///是否停止不在显示区域内的瓦片下载,默认NO. since 5.3.0
@property (nonatomic, assign) BOOL disableOffScreenTileLoading;
/**
* @brief URLTemplate生成tileOverlay
* @param URLTemplate URLTemplate是一个包含"{x}","{y}","{z}","{scale}","{x}","{y}","{z}","{scale}"tile path的值所替换tile图片数据的URL http://server/path?x={x}&y={y}&z={z}&scale={scale}
* @return URLTemplate字符串生成tileOverlay
*/
- (id)initWithURLTemplate:(NSString *)URLTemplate;
@end
///MATileOverlayPath
struct MATileOverlayPath{
NSInteger x; ///< x坐标
NSInteger y; ///< y坐标
NSInteger z; ///< 缩放级别
CGFloat contentScaleFactor; ///< 屏幕的scale factor
};
typedef struct MATileOverlayPath MATileOverlayPath;
///子类可覆盖CustomLoading中的方法来自定义加载MATileOverlay的行为。
@interface MATileOverlay (CustomLoading)
/**
* @brief tile path生成URLtile,URLTemplate
* @param path tile path
* @return tile path生成tileOverlay
*/
- (NSURL *)URLForTilePath:(MATileOverlayPath)path;
/**
* @brief tile,tile数据或加载tile失败error访问回调block;URLForTilePath去获取URL,NSURLConnection加载tile
* @param path tile path
* @param result tile数据或加载tile失败的error访问的回调block
*/
- (void)loadTileAtPath:(MATileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result;
/**
* @brief , disableOffScreenTileLoading=YES时会被调用since 5.3.0
* @param path tile path
*/
- (void)cancelLoadOfTileAtPath:(MATileOverlayPath)path;
@end
#endif