Initial commit

This commit is contained in:
ifish
2017-08-15 16:59:01 +08:00
commit bdc83e07ef
5766 changed files with 423223 additions and 0 deletions
@@ -0,0 +1,21 @@
/*
* BMKActionPaopaoView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
/// 该类用于定义一个PaopaoView
@interface BMKActionPaopaoView : UIView
/**
*初始化并返回一个BMKActionPaopaoView
*@param customView 自定义ViewcustomViewnil时返回默认的PaopaoView
*@return 初始化成功则返回BMKActionPaopaoView,否则返回nil
*/
- (id)initWithCustomView:(UIView*)customView;
@end
@@ -0,0 +1,38 @@
//
// BMKAnnotation.h
// BMapKit
//
// Copyright 2011 Baidu Inc. All rights reserved.
//
#import <CoreGraphics/CoreGraphics.h>
#import <CoreLocation/CoreLocation.h>
#import <Foundation/Foundation.h>
/// 该类为标注点的protocol,提供了标注类的基本信息函数
@protocol BMKAnnotation <NSObject>
///标注view中心坐标.
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@optional
/**
*获取annotation标题
*@return 返回annotation的标题信息
*/
- (NSString *)title;
/**
*获取annotation副标题
*@return 返回annotation的副标题信息
*/
- (NSString *)subtitle;
/**
*设置标注的坐标,在拖拽时会被调用.
*@param newCoordinate 新的坐标值
*/
- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate;
@end
@@ -0,0 +1,110 @@
/*
* BMKAnnotationView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKActionPaopaoView.h"
#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
enum {
BMKAnnotationViewDragStateNone = 0, ///< 静止状态.
BMKAnnotationViewDragStateStarting, ///< 开始拖动
BMKAnnotationViewDragStateDragging, ///< 拖动中
BMKAnnotationViewDragStateCanceling, ///< 取消拖动
BMKAnnotationViewDragStateEnding ///< 拖动结束
};
typedef NSUInteger BMKAnnotationViewDragState;
#endif
@class BMKAnnotationViewInternal;
@protocol BMKAnnotation;
@class BMKMapView;
@class BMKMapViewInternal;
///标注view
@interface BMKAnnotationView : UIView
{
@private
BMKAnnotationViewInternal *_internal;
BOOL _enabled3D;
CGPoint _originPt;
CGPoint startPoint;
}
/**
*初始化并返回一个annotation view
*@param annotation 关联的annotation对象
*@param reuseIdentifier 如果要重用view,传入一个字符串,否则设为nil,建议重用view
*@return 初始化成功则返回annotation view,否则返回nil
*/
- (id)initWithAnnotation:(id <BMKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier;
///复用标志
@property (nonatomic, readonly) NSString *reuseIdentifier;
///paopaoView
@property (nonatomic, strong)BMKActionPaopaoView* paopaoView;
/**
*当view从reuse队列里取出时被调用
*默认不做任何事
*/
- (void)prepareForReuse;
///关联的annotation
@property (nonatomic, strong) id <BMKAnnotation> annotation;
///annotation view显示的图像
@property (nonatomic, strong) UIImage *image;
///默认情况下, annotation view的中心位于annotation的坐标位置,可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
@property (nonatomic) CGPoint centerOffset;
///默认情况下, 弹出的气泡位于view正中上方,可以设置calloutOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
@property (nonatomic) CGPoint calloutOffset;
///默认情况下,标注没有3D效果,可以设置enabled3D改变使用3D效果,使得标注在地图旋转和俯视时跟随旋转、俯视
@property (nonatomic) BOOL enabled3D;
///默认为YES,当为NO时view忽略触摸事件
@property (nonatomic, getter=isEnabled) BOOL enabled;
///默认为NO,当view被点中时被设为YES,用户不要直接设置这个属性.若设置,需要在设置后调用BMKMapView的- (void)mapForceRefresh; 方法刷新地图
@property (nonatomic, getter=isSelected) BOOL selected;
/**
*设定view的选中状态
*该方法被BMKMapView调用
*@param selected 如果view需要显示为选中状态,该值为YES
*@param animated 如果需要动画效果,该值为YES,暂不支持
*/
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
///当为YES时,view被选中时会弹出气泡,annotation必须实现了title这个方法
@property (nonatomic) BOOL canShowCallout;
///显示在气泡左侧的view(使用默认气泡时,view的width最大值为32,height最大值为41,大于则使用最大值)
@property (strong, nonatomic) UIView *leftCalloutAccessoryView;
///显示在气泡右侧的view(使用默认气泡时,view的width最大值为32,height最大值为41,大于则使用最大值)
@property (strong, nonatomic) UIView *rightCalloutAccessoryView;
///当设为YES并实现了setCoordinate:方法时,支持将view在地图上拖动, ios 3.2以后支持
@property (nonatomic, getter=isDraggable) BOOL draggable __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2);
///当前view的拖动状态, ios 3.2以后支持
@property (nonatomic) BMKAnnotationViewDragState dragState __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2);
@end
@@ -0,0 +1,48 @@
/*
* BMKArcline.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKMultiPoint.h"
#import "BMKOverlay.h"
/// 此类用于定义一段圆弧
@interface BMKArcline : BMKMultiPoint <BMKOverlay>
{
BMKMapRect _boundingMapRect;
bool isYouArc;
}
/**
*根据指定坐标点生成一段圆弧
*@param points 指定的直角坐标点数组(需传入3个点)
*@return 新生成的圆弧对象
*/
+ (BMKArcline *)arclineWithPoints:(BMKMapPoint *)points;
/**
*根据指定经纬度生成一段圆弧
*@param coords 指定的经纬度坐标点数组(需传入3个点)
*@return 新生成的圆弧对象
*/
+ (BMKArcline *)arclineWithCoordinates:(CLLocationCoordinate2D *)coords;
/**
*重新设置圆弧坐标
*@param points 指定的直角坐标点数组(需传入3个点)
*@return 是否设置成功
*/
- (BOOL)setArclineWithPoints:(BMKMapPoint *)points;
/**
*重新设置圆弧坐标
*@param coords 指定的经纬度坐标点数组(需传入3个点)
*@param count 坐标点的个数
*@return 是否设置成功
*/
- (BOOL)setArclineWithCoordinates:(CLLocationCoordinate2D *)coords;
@end
@@ -0,0 +1,27 @@
/*
* BMKArclineView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKArcline.h"
#import "BMKOverlayGLBasicView.h"
/// 此类用于定义一个圆弧View
@interface BMKArclineView : BMKOverlayGLBasicView
/**
*根据指定的弧线生成一个圆弧View
*@param arcline 指定的弧线数据对象
*@return 新生成的弧线View
*/
- (id)initWithArcline:(BMKArcline *)arcline;
/// 该View对应的圆弧数据对象
@property (nonatomic, readonly) BMKArcline *arcline;
@end
@@ -0,0 +1,28 @@
//
// BMKBaseIndoorMapInfo.h
// MapComponent
//
// Created by wzy on 16/4/2.
// Copyright © 2016年 baidu. All rights reserved.
//
#ifndef BMKBaseIndoorMapInfo_h
#define BMKBaseIndoorMapInfo_h
#import <CoreLocation/CoreLocation.h>
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
///此类表示室内图基础信息
@interface BMKBaseIndoorMapInfo : NSObject
/// 室内ID
@property (nonatomic, strong) NSString* strID;
/// 当前楼层
@property (nonatomic, strong) NSString* strFloor;
/// 所有楼层信息
@property (nonatomic, strong) NSMutableArray* arrStrFloors;
@end
#endif /* BMKBaseIndoorMapInfo_h */
@@ -0,0 +1,61 @@
/*
* BMKCircle.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKShape.h"
#import "BMKMultiPoint.h"
#import "BMKOverlay.h"
/// 该类用于定义一个圆
@interface BMKCircle : BMKMultiPoint <BMKOverlay> {
@package
BOOL _invalidate;
CLLocationCoordinate2D _coordinate;
CLLocationDistance _radius;
BMKMapRect _boundingMapRect;
}
/**
*根据中心点和半径生成圆
*@param coord 中心点的经纬度坐标
*@param radius 半径,单位:米
*@return 新生成的圆
*/
+ (BMKCircle *)circleWithCenterCoordinate:(CLLocationCoordinate2D)coord
radius:(CLLocationDistance)radius;
/**
*根据指定的直角坐标矩形生成圆,半径由较长的那条边决定,radius = MAX(width, height)/2
*@param mapRect 指定的直角坐标矩形
*@return 新生成的圆
*/
+ (BMKCircle *)circleWithMapRect:(BMKMapRect)mapRect;
/// 中心点坐标
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
/// 半径,单位:米
@property (nonatomic, assign) CLLocationDistance radius;
/// 该圆的外接矩形
@property (nonatomic, readonly) BMKMapRect boundingMapRect;
/**
*设置圆的中心点和半径
*@param coord 中心点的经纬度坐标
*@param radius 半径,单位:米
*@return 是否设置成功
*/
- (BOOL)setCircleWithCenterCoordinate:(CLLocationCoordinate2D)coord radius:(CLLocationDistance)radius;
/**
*根据指定的直角坐标矩形设置圆,半径由较长的那条边决定,radius = MAX(width, height)/2
*@param mapRect 指定的直角坐标矩形
*@return 是否设置成功
*/
- (BOOL)setCircleWithMapRect:(BMKMapRect)mapRect;
@end
@@ -0,0 +1,27 @@
/*
* BMKCircleView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKCircle.h"
#import "BMKOverlayGLBasicView.h"
/// 该类用于定义圆对应的View
@interface BMKCircleView : BMKOverlayGLBasicView
/**
*根据指定圆生成对应的View
*@param circle 指定的圆
*@return 生成的View
*/
- (id)initWithCircle:(BMKCircle *)circle;
/// 该View对应的圆
@property (nonatomic, readonly) BMKCircle *circle;
@end
@@ -0,0 +1,26 @@
/*
* BMKGradient.h
* BMapKit
*
* Copyright 2013 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
///此类表示热力图渐变色
@interface BMKGradient : NSObject{
}
///渐变色用到的所有颜色数组,数组成员类型为UIColor
@property (nonatomic,strong) NSArray* mColors;
///每一个颜色的起始点数组,,数组成员类型为 [0,1]的double值, given as a percentage of the maximum intensity,个数和mColors的个数必须相同,数组内元素必须时递增的
@property (nonatomic,strong) NSArray* mStartPoints;
//渐变色的初始化方法,使用默认colorMapSize1000进行初始化
- (id)initWithColors:(NSArray*)colors startPoints:(NSArray*)startPoints;
@end
@@ -0,0 +1,65 @@
/*
* BMKGroundOverlay.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKMultiPoint.h"
#import "BMKOverlay.h"
/// 该类用于定义一个图片图层
@interface BMKGroundOverlay : BMKMultiPoint<BMKOverlay>
{
@public
float zoomLevel;
CLLocationCoordinate2D _pt;
BMKCoordinateBounds _bound;
CGPoint _anchor;
UIImage* _icon;
int iconID;
BOOL isCenterPt;
int left;
int bottom;
int width;
int height;
}
/// 两种绘制GroundOverlay的方式之一:绘制的位置地理坐标,与anchor配对使用
@property (nonatomic,assign) CLLocationCoordinate2D pt;
/// 用位置绘制时图片的锚点,图片左上角为(0.0f,0.0f),向右向下为正
/// 使用groundOverlayWithPosition初始化时生效
@property (nonatomic,assign) CGPoint anchor;
/// 两种绘制GroundOverlay的方式之二:绘制的地理区域范围,图片在此区域内合理缩放
@property (nonatomic,assign) BMKCoordinateBounds bound;
/// 绘制图片
@property(nonatomic, strong) UIImage *icon;
///图片纹理透明度,最终透明度 = 纹理透明度 * alpha,取值范围为[0.0f, 1.0f],默认为1.0f
@property(nonatomic) GLfloat alpha;
/**
*根据指定经纬度坐标生成一个groundOverlay
*@param position 指定的经纬度坐标
*@param zoomLevel 不损失精度绘制原始图片的地图等级
*@param anchor 绘制图片的锚点
*@param icon 绘制使用的图片
*@return 新生成的groundOverlay对象
*/
+ (BMKGroundOverlay *)groundOverlayWithPosition:(CLLocationCoordinate2D)position
zoomLevel:(CGFloat)zoomLevel
anchor:(CGPoint)anchor
icon:(UIImage*)icon;
/**
*根据指定区域生成一个groundOverlay
*@param bounds 指定的经纬度区域
*@param icon 绘制使用的图片
*@return 新生成的groundOverlay对象
*/
+ (BMKGroundOverlay *)groundOverlayWithBounds:(BMKCoordinateBounds)bounds
icon:(UIImage*)icon;
@end
@@ -0,0 +1,28 @@
/*
* BMKGroundOverlayView.h
* BMapKit
*
* Copyright 2013 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKGroundOverlay.h"
#import "BMKOverlayPathView.h"
/// 该类用于定义一个BMKGroundOverlayView
@interface BMKGroundOverlayView : BMKOverlayView
/**
*根据指定的groundOverlay生成一个View
*@param groundOverlay 指定的groundOverlay数据对象
*@return 新生成的View
*/
- (id)initWithGroundOverlay:(BMKGroundOverlay *)groundOverlay;
/// 该View对应的ground数据对象
@property (nonatomic, readonly) BMKGroundOverlay *groundOverlay;
@end
@@ -0,0 +1,48 @@
/*
* BMKHeatMap.h
* BMapKit
*
* Copyright 2013 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <BaiduMapAPI_Base/BMKTypes.h>
#import "BMKGradient.h"
///热力图节点信息
@interface BMKHeatMapNode : NSObject{
double _intensity;
CLLocationCoordinate2D _pt;
}
///点的强度权值
@property (nonatomic) double intensity;
///点的位置坐标
@property (nonatomic) CLLocationCoordinate2D pt;
@end
///热力图的绘制数据和显示样式类
@interface BMKHeatMap : NSObject
{
int _mRadius; //Heatmap point radius
BMKGradient* _mGradient;//Gradient of the color map
double _mOpacity;//Opacity of the overall heatmap overlay [0...1]
NSMutableArray* _mData;
}
///设置热力图点半径,默认为12ps
@property (nonatomic, assign) int mRadius;
///设置热力图渐变,有默认值 DEFAULT_GRADIENT
@property (nonatomic, strong) BMKGradient* mGradient;
///设置热力图层透明度,默认 0.6
@property (nonatomic, assign) double mOpacity;
///用户传入的热力图数据,数组,成员类型为BMKHeatMapNode
@property (nonatomic, strong) NSMutableArray* mData;
@end
@@ -0,0 +1,33 @@
/*
* BMKLocationViewDisplayParam.h
* BMapKit
*
* Copyright 2013 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
///此类表示定位图层自定义样式参数
@interface BMKLocationViewDisplayParam : NSObject
///定位图标X轴偏移量(屏幕坐标)
@property (nonatomic, assign) CGFloat locationViewOffsetX;
///定位图标Y轴偏移量(屏幕坐标)
@property (nonatomic, assign) CGFloat locationViewOffsetY;
///精度圈是否显示,默认YES
@property (nonatomic, assign) BOOL isAccuracyCircleShow;
///精度圈 填充颜色
@property (nonatomic, strong) UIColor *accuracyCircleFillColor;
///精度圈 边框颜色
@property (nonatomic, strong) UIColor *accuracyCircleStrokeColor;
///跟随态旋转角度是否生效,默认YES
@property (nonatomic, assign) BOOL isRotateAngleValid;
///定位图标名称,需要将该图片放到 mapapi.bundle/images 目录下
@property (nonatomic, strong) NSString* locationViewImgName;
@end
@@ -0,0 +1,39 @@
/*
* BMKMapComponent.h
* BMKMapComponent
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKMapVersion.h"
#import "BMKAnnotation.h"
#import "BMKAnnotationView.h"
#import "BMKMapView.h"
#import "BMKBaseIndoorMapInfo.h"
#import "BMKOfflineMap.h"
#import "BMKOfflineMapType.h"
#import "BMKOverlay.h"
#import "BMKShape.h"
#import "BMKPointAnnotation.h"
#import "BMKPinAnnotationView.h"
#import "BMKMultiPoint.h"
#import "BMKArcline.h"
#import "BMKPolyline.h"
#import "BMKPolygon.h"
#import "BMKCircle.h"
#import "BMKOverlayView.h"
#import "BMKOverlayPathView.h"
#import "BMKOverlayGLBasicView.h"
#import "BMKPolygonView.h"
#import "BMKPolylineView.h"
#import "BMKCircleView.h"
#import "BMKArclineView.h"
#import "BMKGroundOverlay.h"
#import "BMKGroundOverlayView.h"
#import "BMKGradient.h"
#import "BMKTileLayer.h"
#import "BMKTileLayerView.h"
@@ -0,0 +1,40 @@
/*
* BMKMapStatus.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <CoreLocation/CoreLocation.h>
#import <UIKit/UIKit.h>
#import <BaiduMapAPI_Base/BMKTypes.h>
//#import <QuartzCore/QuartzCore.h>
///此类表示地图状态信息
@interface BMKMapStatus : NSObject
{
float _fLevel; // 缩放比例,319级
float _fRotation; // 旋转角度
float _fOverlooking; // 俯视角度
CGPoint _targetScreenPt;//屏幕坐标(中心点)
CLLocationCoordinate2D _targetGeoPt;//地理坐标(中心点)
}
///缩放级别:[3~19]
@property (nonatomic, assign) float fLevel;
///旋转角度
@property (nonatomic, assign) float fRotation;
///俯视角度:[-45~0]
@property (nonatomic, assign) float fOverlooking;
///屏幕中心点坐标:在屏幕内,超过无效
@property (nonatomic) CGPoint targetScreenPt;
///地理中心点坐标:经纬度
@property (nonatomic) CLLocationCoordinate2D targetGeoPt;
///当前地图范围,采用直角坐标系表示,向右向下增长
@property (nonatomic, assign, readonly) BMKMapRect visibleMapRect;
@end
@@ -0,0 +1,32 @@
//
// BMKMapVersion.h
// MapComponent
//
// Created by wzy on 15/9/9.
// Copyright © 2015年 baidu. All rights reserved.
//
#ifndef BMKMapVersion_h
#define BMKMapVersion_h
#import <UIKit/UIKit.h>
/**
*重要:
*map组件的版本和base组件的版本必须一致,否则不能正常使用
*/
/**
*获取当前地图API map组件 的版本号
*当前map组件版本 : 3.3.0
*return 返回当前API map组件 的版本号
*/
UIKIT_EXTERN NSString* BMKGetMapApiMapComponentVersion();
/**
*检查map组件的版本号是否和base组件的版本号一致
*return 版本号一致返回YES
*/
UIKIT_EXTERN BOOL BMKCheckMapComponentIsLegal();
#endif /* BMKMapVersion_h */
@@ -0,0 +1,726 @@
/*
* BMKMapView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <BaiduMapAPI_Base/BMKBaseComponent.h>
#import "BMKAnnotation.h"
#import "BMKAnnotationView.h"
#import "BMKOverlayView.h"
#import "UIKit/UIKit.h"
#import "BMKMapStatus.h"
#import "BMKLocationViewDisplayParam.h"
#import "BMKHeatMap.h"
#import "BMKBaseIndoorMapInfo.h"
@protocol BMKMapViewDelegate;
///点击地图标注返回数据结构
@interface BMKMapPoi : NSObject
///点标注的名称
@property (nonatomic,strong) NSString* text;
///点标注的经纬度坐标
@property (nonatomic,assign) CLLocationCoordinate2D pt;
///点标注的uid,可能为空
@property (nonatomic,strong) NSString* uid;
@end
typedef enum {
BMKUserTrackingModeNone = 0, /// 普通定位模式
BMKUserTrackingModeHeading, /// 定位方向模式
BMKUserTrackingModeFollow, /// 定位跟随模式
BMKUserTrackingModeFollowWithHeading, /// 定位罗盘模式
} BMKUserTrackingMode;
///枚举:logo位置
typedef enum {
BMKLogoPositionLeftBottom = 0, /// 地图左下方
BMKLogoPositionLeftTop, /// 地图左上方
BMKLogoPositionCenterBottom, /// 地图中下方
BMKLogoPositionCenterTop, /// 地图中上方
BMKLogoPositionRightBottom, /// 地图右下方
BMKLogoPositionRightTop, /// 地图右上方
} BMKLogoPosition;
///枚举:室内图切换楼层结果
typedef enum {
BMKSwitchIndoorFloorSuccess = 0, /// 切换楼层成功
BMKSwitchIndoorFloorFailed, /// 切换楼层失败
BMKSwitchIndoorFloorNotFocused, /// 地图还未聚焦到传入的室内图
BMKSwitchIndoorFloorNotExist, /// 当前室内图不存在该楼层
} BMKSwitchIndoorFloorError;
///地图View类,使用此View可以显示地图窗口,并且对地图进行相关的操作
@interface BMKMapView : UIView
/// 地图View的Delegate,此处记得不用的时候需要置nil,否则影响内存的释放
@property (nonatomic, weak) id<BMKMapViewDelegate> delegate;
/// 当前地图类型,可设定为标准地图、卫星地图
@property (nonatomic) BMKMapType mapType;
/// 当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围
@property (nonatomic) BMKCoordinateRegion region;
/// 限制地图的显示范围(地图状态改变时,该范围不会在地图显示范围外。设置成功后,会调整地图显示该范围)
@property (nonatomic) BMKCoordinateRegion limitMapRegion;
/// 指南针的位置,设定坐标以BMKMapView左上角为原点,向右向下增长
@property (nonatomic) CGPoint compassPosition;
/// 指南针的宽高
@property (nonatomic, readonly) CGSize compassSize;
/// 当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化
@property (nonatomic) CLLocationCoordinate2D centerCoordinate;
/// 地图比例尺级别,在手机上当前可使用的级别为3-21级
@property (nonatomic) float zoomLevel;
/// 地图的自定义最小比例尺级别
@property (nonatomic) float minZoomLevel;
/// 地图的自定义最大比例尺级别
@property (nonatomic) float maxZoomLevel;
/// 地图旋转角度,在手机上当前可使用的范围为-180~180度
@property (nonatomic) int rotation;
/// 地图俯视角度,在手机上当前可使用的范围为-45~0度
@property (nonatomic) int overlooking;
///设定地图是否现显示3D楼块效果
@property(nonatomic, getter=isBuildingsEnabled) BOOL buildingsEnabled;
///设定地图是否显示底图poi标注(不包含室内图标注),默认YES
@property(nonatomic, assign) BOOL showMapPoi;
///设定地图是否打开路况图层
@property(nonatomic, getter=isTrafficEnabled) BOOL trafficEnabled;
///设定地图是否打开百度城市热力图图层(百度自有数据),注:地图层级大于11时,可显示热力图
@property(nonatomic, getter=isBaiduHeatMapEnabled) BOOL baiduHeatMapEnabled;
///设定地图View能否支持所有手势操作
@property(nonatomic) BOOL gesturesEnabled;
///设定地图View能否支持用户多点缩放(双指)
@property(nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;
///设定地图View能否支持用户缩放(双击或双指单击)
@property(nonatomic, getter=isZoomEnabledWithTap) BOOL zoomEnabledWithTap;
///设定地图View能否支持用户移动地图
@property(nonatomic, getter=isScrollEnabled) BOOL scrollEnabled;
///设定地图View能否支持俯仰角
@property(nonatomic, getter=isOverlookEnabled) BOOL overlookEnabled;
///设定地图View能否支持旋转
@property(nonatomic, getter=isRotateEnabled) BOOL rotateEnabled;
/// 设定地图是否回调force touch事件,默认为NO,仅适用于支持3D Touch的情况,开启后会回调 - mapview:onForceTouch:force:maximumPossibleForce:
@property(nonatomic) BOOL forceTouchEnabled;
/// 设定是否显式比例尺
@property (nonatomic) BOOL showMapScaleBar;
/// 比例尺的位置,设定坐标以BMKMapView左上角为原点,向右向下增长
@property (nonatomic) CGPoint mapScaleBarPosition;
/// 比例尺的宽高
@property (nonatomic, readonly) CGSize mapScaleBarSize;
/// logo位置,默认BMKLogoPositionLeftBottom
@property (nonatomic) BMKLogoPosition logoPosition;
///当前地图范围,采用直角坐标系表示,向右向下增长
@property (nonatomic) BMKMapRect visibleMapRect;
/**
*地图预留边界,默认:UIEdgeInsetsZero。
*注:设置后,会根据mapPadding调整logo、比例尺、指南针的位置。
* 当updateTargetScreenPtWhenMapPaddingChanged==YES时,地图中心(屏幕坐标:BMKMapStatus.targetScreenPt)跟着改变
*/
@property (nonatomic) UIEdgeInsets mapPadding;
///设置mapPadding时,地图中心(屏幕坐标:BMKMapStatus.targetScreenPt)是否跟着改变,默认YES
@property (nonatomic) BOOL updateTargetScreenPtWhenMapPaddingChanged;
///设定地图View能否支持以手势中心点为轴进行旋转和缩放
@property(nonatomic, getter=isChangeWithTouchPointCenterEnabled) BOOL ChangeWithTouchPointCenterEnabled;
/**
*设置自定义地图样式
*注:必须在BMKMapView对象初始化之前调用
*@param customMapStyleJsonFilePath 自定义样式文件所在路径,包含文件名
*/
+ (void)customMapStyle:(NSString*) customMapStyleJsonFilePath;
/**
* 自定义地图样式开关,影响所有BMKMapView对象
*@param enable 自定义地图样式是否生效
*/
+ (void)enableCustomMapStyle:(BOOL) enable;
/**
* 2.10.0起废弃,空实现,逻辑由地图SDK控制
*
*当应用即将后台时调用,停止一切调用opengl相关的操作。
*/
+(void)willBackGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
/**
* 2.10.0起废弃,空实现,逻辑由地图SDK控制
*
*当应用恢复前台状态时调用。
*/
+(void)didForeGround __deprecated_msg("废弃方法(空实现),逻辑由地图SDK控制");
/**
*当mapview即将被显式的时候调用,恢复之前存储的mapview状态。
*/
-(void)viewWillAppear;
/**
*当mapview即将被隐藏的时候调用,存储当前mapview的状态。
*/
-(void)viewWillDisappear;
/**
*强制刷新mapview
*/
- (void)mapForceRefresh;
/**
*放大一级比例尺
*@return 是否成功
*/
- (BOOL)zoomIn;
/**
*缩小一级比例尺
*@return 是否成功
*/
- (BOOL)zoomOut;
/**
*根据当前地图View的窗口大小调整传入的region,返回适合当前地图窗口显示的region,调整过程会保证中心点不改变
*@param region 待调整的经纬度范围
*@return 调整后适合当前地图窗口显示的经纬度范围
*/
- (BMKCoordinateRegion)regionThatFits:(BMKCoordinateRegion)region;
/**
*设定当前地图的显示范围
*@param region 要设定的地图范围,用经纬度的方式表示
*@param animated 是否采用动画效果
*/
- (void)setRegion:(BMKCoordinateRegion)region animated:(BOOL)animated;
/**
*设定地图中心点坐标
*@param coordinate 要设定的地图中心点坐标,用经纬度表示
*@param animated 是否采用动画效果
*/
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
/**
*获得地图当前可视区域截图
*@return 返回view范围内的截取的UIImage
*/
-(UIImage*) takeSnapshot;
/**
*获得地图区域区域截图
*@return 返回指定区域的截取的UIImage
*/
-(UIImage*) takeSnapshot:(CGRect)rect;
/**
*设置罗盘的图片
*@param image 设置的图片
*/
- (void)setCompassImage:(UIImage *)image;
/**
*设定当前地图的显示范围,采用直角坐标系表示
*@param mapRect 要设定的地图范围,用直角坐标系表示
*@param animate 是否采用动画效果
*/
- (void)setVisibleMapRect:(BMKMapRect)mapRect animated:(BOOL)animate;
/**
*根据当前地图View的窗口大小调整传入的mapRect,返回适合当前地图窗口显示的mapRect,调整过程会保证中心点不改变
*@param mapRect 待调整的地理范围,采用直角坐标系表示
*@return 调整后适合当前地图窗口显示的地理范围,采用直角坐标系
*/
- (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect;
/**
*设定地图的显示范围,并使mapRect四周保留insets指定的边界区域
*@param mapRect 要设定的地图范围,用直角坐标系表示
*@param insets 指定的四周边界大小
*@param animate 是否采用动画效果
*/
- (void)setVisibleMapRect:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animate;
/**
*根据当前地图View的窗口大小调整传入的mapRect,返回适合当前地图窗口显示的mapRect,并且在该mapRect四周保留insets指定的边界区域
*@param mapRect 待调整的地理范围,采用直角坐标系表示
×@param insets mapRect四周要预留的边界大小
*@return 调整后适合当前地图窗口显示的地理范围,采用直角坐标系
*/
- (BMKMapRect)mapRectThatFits:(BMKMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
/**
*将经纬度坐标转换为View坐标
*@param coordinate 待转换的经纬度坐标
*@param view 指定相对的View
*@return 转换后的View坐标
*/
- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
/**
*将View坐标转换成经纬度坐标
*@param point 待转换的View坐标
*@param view point坐标所在的view
*@return 转换后的经纬度坐标
*/
- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
/**
*将经纬度矩形区域转换为View矩形区域
*@param region 待转换的经纬度矩形
*@param view 指定相对的View
*@return 转换后的View矩形区域
*/
- (CGRect)convertRegion:(BMKCoordinateRegion)region toRectToView:(UIView *)view;
/**
*将View矩形区域转换成经纬度矩形区域
*@param rect 待转换的View矩形区域
*@param view rect坐标所在的view
*@return 转换后的经纬度矩形区域
*/
- (BMKCoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
/**
*将直角地理坐标矩形区域转换为View矩形区域
*@param mapRect 待转换的直角地理坐标矩形
*@param view 指定相对的View
*@return 转换后的View矩形区域
*/
- (CGRect)convertMapRect:(BMKMapRect)mapRect toRectToView:(UIView *)view;
/**
*将View矩形区域转换成直角地理坐标矩形区域
*@param rect 待转换的View矩形区域
*@param view rect坐标所在的view
*@return 转换后的直角地理坐标矩形区域
*/
- (BMKMapRect)convertRect:(CGRect)rect toMapRectFromView:(UIView *)view;
/**
*将BMKMapPoint转换为opengles可以直接使用的坐标
@param mapPoint BMKMapPoint坐标
@return opengles 直接支持的坐标
*/
- (CGPoint)glPointForMapPoint:(BMKMapPoint)mapPoint;
/**
*批量将BMKMapPoint转换为opengles可以直接使用的坐标
@param mapPoints BMKMapPoint坐标数据指针
@param count 个数,count不能大于数组长度
@return opengles 直接支持的坐标数据指针(需要调用者手动释放)
*/
- (CGPoint *)glPointsForMapPoints:(BMKMapPoint *)mapPoints count:(NSUInteger)count;
/**
* 设置地图中心点在地图中的屏幕坐标位置
* @param ptInScreen 要设定的地图中心点位置,为屏幕坐标,设置的中心点不能超过屏幕范围,否则无效
*/
- (void)setMapCenterToScreenPt:(CGPoint)ptInScreen;
/**
* 获取地图状态
*@return 返回地图状态信息
*/
- (BMKMapStatus*)getMapStatus;
/**
* 设置地图状态
* @param [in] mapStatus 地图状态信息
*/
- (void)setMapStatus:(BMKMapStatus*)mapStatus;
/**
* 设置地图状态
* @param [in] mapStatus 地图状态信息
* @param [in] bAnimation 是否需要动画效果,true:需要做动画
*/
- (void)setMapStatus:(BMKMapStatus*)mapStatus withAnimation:(BOOL)bAnimation;
/**
* 设置地图状态
* @param [in] mapStatus 地图状态信息
* @param [in] bAnimation 是否需要动画效果,true:需要做动画
* @param [in] ulDuration 指定动画时间,单位:ms
*/
- (void)setMapStatus:(BMKMapStatus*)mapStatus withAnimation:(BOOL)bAnimation withAnimationTime:(int)ulDuration;
/**
* 判断当前图区是否支持百度热力图(百度自有数据)
* @return 支持返回YES,否则返回NO
*/
- (BOOL)isSurpportBaiduHeatMap;
@end
@interface BMKMapView (IndoorMapAPI)
/// 设定地图是否显示室内图(包含室内图标注),默认不显示
@property (nonatomic, assign) BOOL baseIndoorMapEnabled;
/// 设定室内图标注是否显示,默认YES,仅当显示室内图(baseIndoorMapEnabled为YES)时生效
@property (nonatomic, assign) BOOL showIndoorMapPoi;
/**
* 设置室内图楼层
* @param strFloor 楼层
* @param strID 室内图ID
* @return 切换结果
*/
- (BMKSwitchIndoorFloorError)switchBaseIndoorMapFloor:(NSString*)strFloor withID:(NSString*)strID;
/**
* 获取当前聚焦的室内图信息
* @return 当前聚焦的室内图信息。没有聚焦的室内图,返回nil
*/
- (BMKBaseIndoorMapInfo*)getFocusedBaseIndoorMapInfo;
@end
@interface BMKMapView (LocationViewAPI)
/// 设定是否显示定位图层
@property (nonatomic) BOOL showsUserLocation;
/// 设定定位模式,取值为:BMKUserTrackingMode
@property (nonatomic) BMKUserTrackingMode userTrackingMode;
/// 返回定位坐标点是否在当前地图可视区域内
@property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;
/**
*动态定制我的位置样式
* @param [in] locationViewDisplayParam 样式参数
*/
- (void)updateLocationViewWithParam:(BMKLocationViewDisplayParam*)locationViewDisplayParam;
/**
*动态更新我的位置数据
* @param [in] userLocation 定位数据
*/
-(void)updateLocationData:(BMKUserLocation*)userLocation;
@end
@interface BMKMapView (AnnotationAPI)
/// 当前地图View的已经添加的标注数组
@property (nonatomic, readonly) NSArray *annotations;
//设定是否总让选中的annotaion置于最前面
@property (nonatomic, assign) BOOL isSelectedAnnotationViewFront;
/**
*向地图窗口添加标注,需要实现BMKMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View
*@param annotation 要添加的标注
*/
- (void)addAnnotation:(id <BMKAnnotation>)annotation;
/**
*向地图窗口添加一组标注,需要实现BMKMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View
*@param annotations 要添加的标注数组
*/
- (void)addAnnotations:(NSArray *)annotations;
/**
*移除标注
*@param annotation 要移除的标注
*/
- (void)removeAnnotation:(id <BMKAnnotation>)annotation;
/**
*移除一组标注
*@param annotation 要移除的标注数组
*/
- (void)removeAnnotations:(NSArray *)annotations;
/**
*查找指定标注对应的View,如果该标注尚未显示,返回nil
*@param annotation 指定的标注
*@return 指定标注对应的View
*/
- (BMKAnnotationView *)viewForAnnotation:(id <BMKAnnotation>)annotation;
/**
*根据指定标识查找一个可被复用的标注View,一般在delegate中使用,用此函数来代替新申请一个View
*@param identifier 指定标识
*@return 返回可被复用的标注View
*/
- (BMKAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
/**
*选中指定的标注,本版暂不支持animate效果
*@param annotation 指定的标注
*@param animated 本版暂不支持
*/
- (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
/**
*取消指定的标注的选中状态,本版暂不支持animate效果
*@param annotation 指定的标注
*@param animated 本版暂不支持
*/
- (void)deselectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;
/**
*设置地图使显示区域显示所有annotations,如果数组中只有一个则直接设置地图中心为annotation的位置
*@param annotations 指定的标注
*@param animated 是否启动动画
*/
- (void)showAnnotations:(NSArray *)annotations animated:(BOOL)animated;
/**
*获取矩形区域内的所有annotations
*@param bounds 矩形区域(经纬度)
*@return 该矩形区域内的所有annotations
*/
- (NSArray *)annotationsInCoordinateBounds:(BMKCoordinateBounds) bounds;
@end
///地图View类(和Overlay操作相关的接口)
@interface BMKMapView (OverlaysAPI)
/**
*向地图窗口添加Overlay,需要实现BMKMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View
*@param overlay 要添加的overlay
*/
- (void)addOverlay:(id <BMKOverlay>)overlay;
/**
*向地图窗口添加一组Overlay,需要实现BMKMapViewDelegate的-mapView:viewForOverlay:函数来生成标注对应的View
*@param overlays 要添加的overlay数组
*/
- (void)addOverlays:(NSArray *)overlays;
/**
*移除Overlay
*@param overlay 要移除的overlay
*/
- (void)removeOverlay:(id <BMKOverlay>)overlay;
/**
*移除一组Overlay
*@param overlays 要移除的overlay数组
*/
- (void)removeOverlays:(NSArray *)overlays;
/**
*在指定的索引处添加一个Overlay
*@param overlay 要添加的overlay
*@param index 指定的索引
*/
- (void)insertOverlay:(id <BMKOverlay>)overlay atIndex:(NSUInteger)index;
/**
*在交换指定索引处的Overlay
*@param index1 索引1
*@param index2 索引2
*/
- (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
/**
*在指定的Overlay之上插入一个overlay
*@param overlay 带添加的Overlay
*@param sibling 用于指定相对位置的Overlay
*/
- (void)insertOverlay:(id <BMKOverlay>)overlay aboveOverlay:(id <BMKOverlay>)sibling;
/**
*在指定的Overlay之下插入一个overlay
*@param overlay 带添加的Overlay
*@param sibling 用于指定相对位置的Overlay
*/
- (void)insertOverlay:(id <BMKOverlay>)overlay belowOverlay:(id <BMKOverlay>)sibling;
/// 当前mapView中已经添加的Overlay数组
@property (nonatomic, readonly) NSArray *overlays;
/**
*查找指定overlay对应的View,如果该View尚未创建,返回nil
*@param overlay 指定的overlay
*@return 指定overlay对应的View
*/
- (BMKOverlayView *)viewForOverlay:(id <BMKOverlay>)overlay;
@end
@interface BMKMapView (HeatMapAPI)
/**
*添加热力图
* @param [BMKHeatMap*] heatMap 热力图绘制和显示数据
*/
- (void)addHeatMap:(BMKHeatMap*)heatMap;
/**
*移除热力图
*/
- (void)removeHeatMap;
@end
/// MapView的DelegatemapView通过此类来通知用户对应的事件
@protocol BMKMapViewDelegate <NSObject>
@optional
/**
*地图初始化完毕时会调用此接口
*@param mapview 地图View
*/
- (void)mapViewDidFinishLoading:(BMKMapView *)mapView;
/**
*地图渲染完毕后会调用此接口
*@param mapview 地图View
*/
- (void)mapViewDidFinishRendering:(BMKMapView *)mapView;
/**
*地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口
*@param mapview 地图View
*@param status 此时地图的状态
*/
- (void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus*)status;
/**
*地图区域即将改变时会调用此接口
*@param mapview 地图View
*@param animated 是否动画
*/
- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
/**
*地图区域改变完成后会调用此接口
*@param mapview 地图View
*@param animated 是否动画
*/
- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
/**
*根据anntation生成对应的View
*@param mapView 地图View
*@param annotation 指定的标注
*@return 生成的标注View
*/
- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation;
/**
*当mapView新添加annotation views时,调用此接口
*@param mapView 地图View
*@param views 新添加的annotation views
*/
- (void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views;
/**
*当选中一个annotation views时,调用此接口
*@param mapView 地图View
*@param views 选中的annotation views
*/
- (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view;
/**
*当取消选中一个annotation views时,调用此接口
*@param mapView 地图View
*@param views 取消选中的annotation views
*/
- (void)mapView:(BMKMapView *)mapView didDeselectAnnotationView:(BMKAnnotationView *)view;
/**
*拖动annotation view时,若view的状态发生变化,会调用此函数。ios3.2以后支持
*@param mapView 地图View
*@param view annotation view
*@param newState 新状态
*@param oldState 旧状态
*/
- (void)mapView:(BMKMapView *)mapView annotationView:(BMKAnnotationView *)view didChangeDragState:(BMKAnnotationViewDragState)newState
fromOldState:(BMKAnnotationViewDragState)oldState;
/**
*当点击annotation view弹出的泡泡时,调用此接口
*@param mapView 地图View
*@param view 泡泡所属的annotation view
*/
- (void)mapView:(BMKMapView *)mapView annotationViewForBubble:(BMKAnnotationView *)view;
/**
*根据overlay生成对应的View
*@param mapView 地图View
*@param overlay 指定的overlay
*@return 生成的覆盖物View
*/
- (BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id <BMKOverlay>)overlay;
/**
*当mapView新添加overlay views时,调用此接口
*@param mapView 地图View
*@param overlayViews 新添加的overlay views
*/
- (void)mapView:(BMKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews;
/**
*点中覆盖物后会回调此接口,目前只支持点中BMKPolylineView时回调
*@param mapview 地图View
*@param overlayView 覆盖物view信息
*/
- (void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView;
/**
*点中底图标注后会回调此接口
*@param mapview 地图View
*@param mapPoi 标注点信息
*/
- (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi*)mapPoi;
/**
*点中底图空白处会回调此接口
*@param mapview 地图View
*@param coordinate 空白处坐标点的经纬度
*/
- (void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate;
/**
*双击地图时会回调此接口
*@param mapview 地图View
*@param coordinate 返回双击处坐标点的经纬度
*/
- (void)mapview:(BMKMapView *)mapView onDoubleClick:(CLLocationCoordinate2D)coordinate;
/**
*长按地图时会回调此接口
*@param mapview 地图View
*@param coordinate 返回长按事件坐标点的经纬度
*/
- (void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate;
/**
*3DTouch 按地图时会回调此接口(仅在支持3D Touch,且fouchTouchEnabled属性为YES时,会回调此接口)
*@param mapview 地图View
*@param coordinate 触摸点的经纬度
*@param force 触摸该点的力度(参考UITouch的force属性)
*@param maximumPossibleForce 当前输入机制下的最大可能力度(参考UITouch的maximumPossibleForce属性)
*/
- (void)mapview:(BMKMapView *)mapView onForceTouch:(CLLocationCoordinate2D)coordinate force:(CGFloat)force maximumPossibleForce:(CGFloat)maximumPossibleForce;
/**
*地图状态改变完成后会调用此接口
*@param mapview 地图View
*/
- (void)mapStatusDidChanged:(BMKMapView *)mapView;
/**
*地图进入/移出室内图会调用此接口
*@param mapview 地图View
*@param flag YES:进入室内图; NO:移出室内图
*@param info 室内图信息
*/
- (void)mapview:(BMKMapView *)mapView baseIndoorMapWithIn:(BOOL)flag baseIndoorMapInfo:(BMKBaseIndoorMapInfo *)info;
@end
@@ -0,0 +1,35 @@
/*
* BMKMultiPoint.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#import <BaiduMapAPI_Base/BMKTypes.h>
#import "BMKShape.h"
/// 该类定义多个点,是个由多个点组成的虚基类, 不能直接实例化对象, 要使用其子类BMKPolyline,BMKPolygon来实例化
@interface BMKMultiPoint : BMKShape {
@package
BMKMapPoint *_points;
NSUInteger _pointCount;
BMKMapRect _boundingRect;
}
/// 坐标点数组
@property (nonatomic, readonly) BMKMapPoint *points;
/// 坐标点的个数
@property (nonatomic, readonly) NSUInteger pointCount;
/**
*将内部的直角坐标数据转换为经纬度坐标点数据,并拷贝到指定的数组中
*@param coords 经纬度坐标数组,转换后的坐标将存储到该数组中,该数组长度必须大于等于要拷贝的坐标点的个数(range.length
*@param range 指定要拷贝的数据段
*/
- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range;
@end
@@ -0,0 +1,114 @@
/*
* BMKOfflineMap.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#import "BMKOfflineMapType.h"
@protocol BMKOfflineMapDelegate;
///离线地图事件类型
enum {
TYPE_OFFLINE_UPDATE = 0, ///<下载或更新
TYPE_OFFLINE_ZIPCNT = 1, ///<检测到的压缩包个数
TYPE_OFFLINE_UNZIP = 2, ///<当前解压的离线包
TYPE_OFFLINE_ERRZIP = 3, ///<错误的离线包
TYPE_OFFLINE_NEWVER = 4, ///<有新版本
TYPE_OFFLINE_UNZIPFINISH = 5, ///<扫描完毕
TYPE_OFFLINE_ADD = 6 ///<新增离线包
};
///离线地图服务
@interface BMKOfflineMap : NSObject
@property (nonatomic, weak) id<BMKOfflineMapDelegate> delegate;
/**
*自2.9.0起废弃,不支持扫描导入离线包
*扫描离线地图压缩包,异步函数
*@return 成功返回YES,否则返回NO
*/
- (BOOL)scan:(BOOL)deleteFailedr __deprecated_msg("废弃方法(空实现),自2.9.0起废弃,不支持扫描导入离线包");
/**
*启动下载指定城市id的离线地图
*@param cityID 指定的城市id
*@return 成功返回YES,否则返回NO
*/
- (BOOL)start:(int)cityID;
/**
*启动更新指定城市id的离线地图
*@param cityID 指定的城市id
*@return 成功返回YES,否则返回NO
*/
- (BOOL)update:(int)cityID;
/**
*暂停下载指定城市id的离线地图
*@param cityID 指定的城市id
*@return 成功返回YES,否则返回NO
*/
- (BOOL)pause:(int)cityID;
/**
*删除下载指定城市id的离线地图
*@param cityID 指定的城市id
*@return 成功返回YES,否则返回NO
*/
- (BOOL)remove:(int)cityID;
/**
*返回热门城市列表
*@return 热门城市列表,用户需要显示释放该数组,数组元素为BMKOLSearchRecord
*/
- (NSArray*)getHotCityList;
/**
*返回所有支持离线地图的城市列表
*@return 支持离线地图的城市列表,用户需要显示释放该数组,数组元素为BMKOLSearchRecord
*/
- (NSArray*)getOfflineCityList;
/**
*根据城市名搜索该城市离线地图记录
*@param cityName 城市名
*@return 该城市离线地图记录,用户需要显示释放该数组,数组元素为BMKOLSearchRecord
*/
- (NSArray*)searchCity:(NSString*)cityName;
/**
*返回各城市离线地图更新信息
*@return 各城市离线地图更新信息,用户需要显示释放该数组,数组元素为BMKOLUpdateElement
*/
- (NSArray*)getAllUpdateInfo;
/**
*返回指定城市id离线地图更新信息
*@param cityID 指定的城市id
*@return 指定城市id离线地图更新信息
*/
- (BMKOLUpdateElement*)getUpdateInfo:(int)cityID;
@end
///离线地图delegate,用于获取通知
@protocol BMKOfflineMapDelegate<NSObject>
/**
*返回通知结果
*@param type 事件类型: TYPE_OFFLINE_UPDATE,TYPE_OFFLINE_ZIPCNT,TYPE_OFFLINE_UNZIP, TYPE_OFFLINE_ERRZIP, TYPE_VER_UPDATE, TYPE_OFFLINE_UNZIPFINISH, TYPE_OFFLINE_ADD
*@param state 事件状态,当type为TYPE_OFFLINE_UPDATE时,表示正在下载或更新城市id为state的离线包,当type为TYPE_OFFLINE_ZIPCNT时,表示检测到state个离线压缩包,当type为TYPE_OFFLINE_ADD时,表示新安装的离线地图数目,当type为TYPE_OFFLINE_UNZIP时,表示正在解压第state个离线包,当type为TYPE_OFFLINE_ERRZIP时,表示有state个错误包,当type为TYPE_VER_UPDATE时,表示id为state的城市离线包有更新,当type为TYPE_OFFLINE_UNZIPFINISH时,表示扫瞄完成,成功导入state个离线包
*/
- (void)onGetOfflineMapState:(int)type withState:(int)state;
@end
@@ -0,0 +1,66 @@
/*
* BMKOffineMapType.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
///离线地图搜索城市记录结构
@interface BMKOLSearchRecord : NSObject
{
NSString* _cityName;
int _size;
int _cityID;
int _cityType;
NSArray* _childCities;
}
///城市名称
@property (nonatomic, strong) NSString* cityName;
///数据包总大小
@property (nonatomic) int size;
///城市ID
@property (nonatomic) int cityID;
///城市类型 0:全国;1:省份;2:城市;如果是省份,可以通过childCities得到子城市列表
@property (nonatomic) int cityType;
///子城市列表
@property (nonatomic, strong) NSArray* childCities;
@end
///离线地图更新信息
@interface BMKOLUpdateElement : NSObject
{
NSString* _cityName;
int _cityID;
int _size;
int _serversize;
BOOL _update;
int _ratio;
int _status;
CLLocationCoordinate2D _pt;
}
///城市名称
@property (nonatomic, strong) NSString* cityName;
///城市ID
@property (nonatomic) int cityID;
///已下载数据大小,单位:字节
@property (nonatomic) int size;
///服务端数据大小,当update为YES时有效,单位:字节
@property (nonatomic) int serversize;
///下载比率,100为下载完成,下载完成后会自动导入,status为4时离线包导入完成
@property (nonatomic) int ratio;
///下载状态, -1:未定义 1:正在下载 2:等待下载 3:已暂停 4:完成 5:校验失败 6:网络异常 7:读写异常 8:Wifi网络异常 9:离线包数据格式异常,需重新下载离线包 10:离线包导入中
@property (nonatomic) int status;
///更新状态,离线包是否有更新(有更新需重新下载)
@property (nonatomic) BOOL update;
///城市中心点
@property (nonatomic) CLLocationCoordinate2D pt;
@end
@@ -0,0 +1,32 @@
/*
* BMKOverlay.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKAnnotation.h"
#import <BaiduMapAPI_Base/BMKTypes.h>
/// 该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
@protocol BMKOverlay <BMKAnnotation>
@required
/// 返回区域中心坐标.
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
/// 返回区域外接矩形
@property (nonatomic, readonly) BMKMapRect boundingMapRect;
@optional
/**
*判断指定的矩形是否与本Overlay相交,用于更精确的控制overlay view的显示.
*默认使用BMKMapRectIntersectsRect([overlay boundingRect], mapRect)代替.
*@param mapRect 指定的BMKMapRect
*@return 如果相交返回YES,否则返回NO
*/
- (BOOL)intersectsMapRect:(BMKMapRect)mapRect;
@end
@@ -0,0 +1,34 @@
/*
* BMKOverlayGLBasicView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKOverlayView.h"
/// 该类定义了一个用opengl绘制的OverlayView的基类,如果需要用gdi进行绘制请继承于BMKOverlayPathView类
@interface BMKOverlayGLBasicView : BMKOverlayView {
}
/// 填充颜色
/// 注:请使用 - (UIColor *)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; 初始化UIColor,使用[UIColor ***Color]初始化时,个别case转换成RGB后会有问题
@property (strong, nonatomic) UIColor *fillColor;
/// 画笔颜色
/// 注:请使用 - (UIColor *)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; 初始化UIColor,使用[UIColor ***Color]初始化时,个别case转换成RGB后会有问题
@property (strong, nonatomic) UIColor *strokeColor;
/// 画笔宽度,默认为0
@property (nonatomic) CGFloat lineWidth;
/// path对象
@property CGPathRef path;
/// 是否为虚线样式,默认NO
@property (nonatomic) BOOL lineDash;
/// 是否纹理图片平铺绘制,默认NO
@property (assign, nonatomic) BOOL tileTexture;
/// 纹理图片是否缩放(tileTexture为YES时生效),默认NO
@property (assign, nonatomic) BOOL keepScale;
@end
@@ -0,0 +1,88 @@
/*
* BMKOverlayPathView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKOverlayView.h"
/// 该类定义了一个基本的OverlayView
@interface BMKOverlayPathView : BMKOverlayView {
@package
UIColor *_fillColor;
UIColor *_strokeColor;
CGFloat _lineWidth;
CGLineJoin _lineJoin;
CGLineCap _lineCap;
CGFloat _miterLimit;
CGFloat _lineDashPhase;
NSArray *_lineDashPattern;
CGPathRef _path;
}
/// 填充颜色
@property (strong) UIColor *fillColor;
/// 画笔颜色
@property (strong) UIColor *strokeColor;
/// 画笔宽度,默认为0
@property CGFloat lineWidth;
/// LineJoin,默认为kCGLineJoinRound
@property CGLineJoin lineJoin;
/// LineCap,默认为kCGLineCapRound
@property CGLineCap lineCap;
/// miterLimit,在样式为kCGLineJoinMiter时有效,默认为10
@property CGFloat miterLimit;
/// lineDashPhase, 默认为0
@property CGFloat lineDashPhase;
/// lineDashPattern,一个NSNumbers的数组,默认为nil
@property (copy) NSArray *lineDashPattern;
/**
*生成要绘制的path,子类需要重写此函数,并且对path属性赋值:self.path = newPath;
*/
- (void)createPath;
/// path对象
@property CGPathRef path;
/**
*刷新path,调用该函数将会使已经缓存的path失效,将会重新调用createPath来生成新的path对象
*/
- (void)invalidatePath;
/**
*应用画笔属性
*@param context CGContext对象
*@param zoomScale 当前的zoomScale
*/
- (void)applyStrokePropertiesToContext:(CGContextRef)context
atZoomScale:(BMKZoomScale)zoomScale;
/**
*应用画刷属性
*@param context CGContext对象
*@param zoomScale 当前的zoomScale
*/
- (void)applyFillPropertiesToContext:(CGContextRef)context
atZoomScale:(BMKZoomScale)zoomScale;
/**
*绘制path
*@param path 要绘制的CGPath
*@param context CGContext对象
*/
- (void)strokePath:(CGPathRef)path inContext:(CGContextRef)context;
/**
*填充path
*@param path 要绘制的CGPath
*@param context CGContext对象
*/
- (void)fillPath:(CGPathRef)path inContext:(CGContextRef)context;
@end
@@ -0,0 +1,207 @@
/*
* BMKOverlayView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKOverlay.h"
/// 该类是地图覆盖物View的基类,提供绘制overlay的接口但本身并无实现,所有地图覆盖物View需要继承自此类
@interface BMKOverlayView : UIView
{
@package
id <BMKOverlay> _overlay;
BMKMapRect _boundingMapRect;
CGAffineTransform _mapTransform;
id _geometryDelegate;
id _canDrawCache;
BOOL keepScale;
CFTimeInterval _lastTile;
CFRunLoopTimerRef _scheduledScaleTimer;
struct {
unsigned int keepAlive:1;
unsigned int levelCrossFade:1;
unsigned int drawingDisabled:1;
unsigned int usesTiledLayer:1;
} _flags;
//@private
// int geometrylayerID;
}
/// 设置该overlay的GeometryDelegate
- (void)setOverlayGeometryDelegate:(id)delegate;
/**
*初始化并返回一个overlay view
*@param overlay 关联的overlay对象
*@return 初始化成功则返回overlay view,否则返回nil
*/
- (id)initWithOverlay:(id <BMKOverlay>)overlay;
///关联的overlay对象
@property (nonatomic, readonly) id <BMKOverlay> overlay;
/**
*将直角坐标转为overlay view坐标
*@param mapPoint 直角坐标
*@return 对应的view坐标
*/
- (CGPoint)pointForMapPoint:(BMKMapPoint)mapPoint;
/**
*将overlay view坐标转为直角坐标
*@param point view坐标
*@return 对应的直角坐标
*/
- (BMKMapPoint)mapPointForPoint:(CGPoint)point;
/**
*将二维地图投影矩形转为overlay view矩形
*@param mapRect 二维地图投影矩形
*@return 对应的view矩形
*/
- (CGRect)rectForMapRect:(BMKMapRect)mapRect;
/**
*将overlay view区域转为二维地图投影区域
*@param rect 指定的view矩形
*@return 对应的二维地图投影矩形
*/
- (BMKMapRect)mapRectForRect:(CGRect)rect;
/**
*判断ovlerlay view是否准备绘制内容
*默认返回YES,如果用户设为NO,当需要绘制内容时要显示调用setNeedsDisplayInMapRect:zoomScale:方法
*@param mapRect 需要更新的地图矩形区域
*@param zoomScale 当前的缩放因子
*@return 如果view准备好绘制内容,返回YES,否则返回NO
*/
- (BOOL)canDrawMapRect:(BMKMapRect)mapRect zoomScale:(BMKZoomScale)zoomScale;
/**
*绘制overlay view内容
*该方法默认不做任何事,子类需要重载该方法来绘制view的内容
*@param mapRect 需要更新的地图矩形区域
*@param zoomScale 当前的缩放因子
*@param context 使用的graphics context
*/
- (void)drawMapRect:(BMKMapRect)mapRect zoomScale:(BMKZoomScale)zoomScale inContext:(CGContextRef)context;
/**
*使view在给定矩形的区域无效,系统将重绘该区域
*@param mapRect 需要更新的区域
*/
- (void)setNeedsDisplayInMapRect:(BMKMapRect)mapRect;
/**
*使用OpenGLES 绘制线
@param points 直角坐标点
@param pointCount 点个数
@param strokeColor 线颜色
@param lineWidth OpenGLES支持线宽尺寸
@param looped 是否闭合, 如polyline会设置NO, polygon会设置YES.
*/
- (void)renderLinesWithPoints:(BMKMapPoint *)points pointCount:(NSUInteger)pointCount strokeColor:(UIColor *)strokeColor lineWidth:(CGFloat)lineWidth looped:(BOOL)looped;
/**
*使用OpenGLES 绘制线
@param points 直角坐标点
@param pointCount 点个数
@param strokeColor 线颜色
@param lineWidth OpenGLES支持线宽尺寸
@param looped 是否闭合, 如polyline会设置NO, polygon会设置YES.
@param lineDash 是否虚线样式
*/
- (void)renderLinesWithPoints:(BMKMapPoint *)points pointCount:(NSUInteger)pointCount strokeColor:(UIColor *)strokeColor lineWidth:(CGFloat)lineWidth looped:(BOOL)looped lineDash:(BOOL)lineDash;
/**
*使用OpenGLES 按指定纹理绘制线
@param points 直角坐标点
@param pointCount 点个数
@param lineWidth OpenGLES支持线宽尺寸
@param textureID 纹理ID,使用- (void)loadStrokeTextureImage:(UIImage *)textureImage;加载
@param looped 是否闭合, 如polyline会设置NO, polygon会设置YES.
*/
- (void)renderTexturedLinesWithPoints:(BMKMapPoint *)points pointCount:(NSUInteger)pointCount lineWidth:(CGFloat)lineWidth textureID:(GLuint)textureID looped:(BOOL)looped;
/**
*使用OpenGLES 按指定纹理绘制线
@param points 直角坐标点
@param pointCount 点个数
@param lineWidth OpenGLES支持线宽尺寸
@param textureID 纹理ID,使用- (void)loadStrokeTextureImage:(UIImage *)textureImage;加载
@param looped 是否闭合, 如polyline会设置NO, polygon会设置YES.
@param tileTexture 是否纹理图片平铺绘制
@param keepScale 纹理图片是否缩放(tileTexture为YES时生效)
*/
- (void)renderTexturedLinesWithPoints:(BMKMapPoint *)points pointCount:(NSUInteger)pointCount lineWidth:(CGFloat)lineWidth textureID:(GLuint)textureID strokeColor:(UIColor *)strokeColor looped:(BOOL)looped tileTexture:(BOOL) tileTexture keepScale:(BOOL) keepScale;
/**
*使用OpenGLES 分段纹理绘制线
@param partPt 分段直角坐标点
@param lineWidth OpenGLES支持线宽尺寸
@param textureIndexs 分段纹理索引,使用- (void)loadStrokeTextureImage:(UIImage *)textureImage;加载
@param isFoucs 是否使用分段纹理绘制
*/
-(void)renderTexturedLinesWithPartPoints:(NSArray*)partPt lineWidth:(CGFloat)lineWidth textureIndexs:(NSArray*)textureIndexs isFocus:(BOOL) isFoucs;
/**
*使用OpenGLES 分段纹理绘制线/分段颜色绘制线
@param partPt 分段直角坐标点
@param lineWidth OpenGLES支持线宽尺寸
@param textureIndexs 分段纹理索引,使用- (BOOL)loadStrokeTextureImages:(UIImage *)textureImage;加载
@param isFoucs 是否使用分段纹理绘制
@param tileTexture 是否纹理图片平铺绘制
@param keepScale 纹理图片是否缩放(tileTexture为YES时生效)
*/
-(void)renderTexturedLinesWithPartPoints:(NSArray*)partPt lineWidth:(CGFloat)lineWidth textureIndexs:(NSArray*)textureIndexs isFocus:(BOOL) isFoucs tileTexture:(BOOL) tileTexture keepScale:(BOOL) keepScale;
/**
*使用OpenGLES 绘制区域
@param points 直角坐标点
@param pointCount 点个数
@param fillColor 填充颜色
@param usingTriangleFan YES对应GL_TRIANGLE_FAN, NO对应GL_TRIANGLES
*/
- (void)renderRegionWithPoints:(BMKMapPoint *)points pointCount:(NSUInteger)pointCount fillColor:(UIColor *)fillColor usingTriangleFan:(BOOL)usingTriangleFan;
/**
*使用OpenGLES 绘制区域(支持凹多边形)
@param points 直角坐标点
@param pointCount 点个数
@param fillColor 填充颜色
@param usingTriangleFan YES对应GL_TRIANGLE_FAN, NO对应GL_TRIANGLES
*/
- (void)renderATRegionWithPoint:(BMKMapPoint *)points pointCount:(NSUInteger)pointCount fillColor:(UIColor *)fillColor usingTriangleFan:(BOOL)usingTriangleFan;
/**
*绘制函数(子类需要重载来实现)
*/
- (void)glRender;
///关联的纹理对象ID
@property (nonatomic, readonly) GLuint strokeTextureID;
/**
*加载纹理图片
@param textureImage 图片对象,opengl要求图片宽高必须是2的n次幂,如果图片对象为nil,则清空原有纹理
@return openGL纹理ID, 若纹理加载失败返回0
*/
- (GLuint)loadStrokeTextureImage:(UIImage *)textureImage;
/**
*加载分段纹理绘制 所需的纹理图片
@param textureImages 必须UIImage数组,opengl要求图片宽高必须是2的n次幂,否则,返回NO,无法分段纹理绘制
@return 是否成功
*/
- (BOOL)loadStrokeTextureImages:(NSArray *)textureImages;
/// 使用分段颜色绘制时,必须设置(内容必须为UIColor)
/// 注:请使用 - (UIColor *)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; 初始化UIColor。使用[UIColor ***Color]初始化时,个别case转换成RGB后会有问题
@property (nonatomic, strong) NSArray *colors;
@end
@@ -0,0 +1,31 @@
/*
* BMKPinAnnotationView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKAnnotationView.h"
enum {
BMKPinAnnotationColorRed = 0,
BMKPinAnnotationColorGreen,
BMKPinAnnotationColorPurple
};
typedef NSUInteger BMKPinAnnotationColor;
///提供类似大头针效果的annotation view
@interface BMKPinAnnotationView : BMKAnnotationView
{
@private
BMKPinAnnotationColor _pinColor;
BOOL _animatesDrop;
}
///大头针的颜色,有BMKPinAnnotationColorRed, BMKPinAnnotationColorGreen, BMKPinAnnotationColorPurple三种
@property (nonatomic) BMKPinAnnotationColor pinColor;
///动画效果
@property (nonatomic) BOOL animatesDrop;
@end
@@ -0,0 +1,22 @@
/*
* BMKPointAnnotation.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#import "BMKShape.h"
#import <CoreLocation/CLLocation.h>
///表示一个点的annotation
@interface BMKPointAnnotation : BMKShape {
@package
CLLocationCoordinate2D _coordinate;
}
///该点的坐标
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@end
@@ -0,0 +1,48 @@
/*
* BMKPolygon.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#import "BMKMultiPoint.h"
#import "BMKOverlay.h"
/// 此类用于定义一个多边形区域
@interface BMKPolygon : BMKMultiPoint <BMKOverlay>
/**
*根据多个点生成多边形
*@param points 直角坐标点数组,这些点将被拷贝到生成的多边形对象中
*@param count 点的个数
*@return 新生成的多边形对象
*/
+ (BMKPolygon *)polygonWithPoints:(BMKMapPoint *)points count:(NSUInteger)count;
/**
*根据多个点生成多边形
*@param coords 经纬度坐标点数组,这些点将被拷贝到生成的多边形对象中
*@param count 点的个数
*@return 新生成的多边形对象
*/
+ (BMKPolygon *)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
/**
*重新设置多边形顶点
*@param points 指定的直角坐标点数组
*@param count 坐标点的个数
*@return 是否设置成功
*/
- (BOOL)setPolygonWithPoints:(BMKMapPoint *)points count:(NSInteger) count;
/**
*重新设置多边形顶点
*@param coords 指定的经纬度坐标点数组
*@param count 坐标点的个数
*@return 是否设置成功
*/
- (BOOL)setPolygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSInteger) count;
@end
@@ -0,0 +1,27 @@
/*
* BMKPolygonView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKPolygon.h"
#import "BMKOverlayGLBasicView.h"
/// 此类用于定义一个多边形View
@interface BMKPolygonView : BMKOverlayGLBasicView
/**
*根据指定的多边形生成一个多边形View
*@param polygon 指定的多边形数据对象
*@return 新生成的多边形View
*/
- (id)initWithPolygon:(BMKPolygon *)polygon;
/// 该View对应的多边形数据
@property (nonatomic, readonly) BMKPolygon *polygon;
@end
@@ -0,0 +1,97 @@
/*
* BMKPolyline.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import "BMKMultiPoint.h"
#import "BMKOverlay.h"
/// 此类用于定义一段折线
@interface BMKPolyline : BMKMultiPoint <BMKOverlay>
/**
*根据指定坐标点生成一段折线
*@param points 指定的直角坐标点数组
*@param count 坐标点的个数
*@return 新生成的折线对象
*/
+ (BMKPolyline *)polylineWithPoints:(BMKMapPoint *)points count:(NSUInteger)count;
/**
*根据指定坐标点生成一段折线
*@param coords 指定的经纬度坐标点数组
*@param count 坐标点的个数
*@return 新生成的折线对象
*/
+ (BMKPolyline *)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
/**
*重新设置折线坐标点
*@param points 指定的直角坐标点数组
*@param count 坐标点的个数
*@return 是否设置成功
*/
- (BOOL)setPolylineWithPoints:(BMKMapPoint *)points count:(NSInteger) count;
/**
*重新设置折线坐标点
*@param coords 指定的经纬度坐标点数组
*@param count 坐标点的个数
*@return 是否设置成功
*/
- (BOOL)setPolylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSInteger) count;
#pragma mark - 以下方法和属性只适用于分段纹理绘制和分段颜色绘制
///纹理索引数组(颜色索引数组)
@property (nonatomic, strong) NSArray *textureIndex;
/**
*分段纹理绘制/分段颜色绘制,根据指定坐标点生成一段折线
*
*分段纹理绘制:其对应的BMKPolylineView必须使用 - (BOOL)loadStrokeTextureImages:(NSArray *)textureImages; 加载纹理图片;否则使用默认的灰色纹理绘制
*分段颜色绘制:其对应的BMKPolylineView必须设置colors属性
*
*@param points 指定的直角坐标点数组
*@param count 坐标点的个数
*@param textureIndex 纹理索引数组(颜色索引数组),成员为NSNumber,且为非负数,负数按0处理
*@return 新生成的折线对象
*/
+ (BMKPolyline *)polylineWithPoints:(BMKMapPoint *)points count:(NSUInteger)count textureIndex:(NSArray*) textureIndex;
/**
*根据指定坐标点生成一段折线
*
*分段纹理绘制:其对应的BMKPolylineView必须使用 - (BOOL)loadStrokeTextureImages:(NSArray *)textureImages; 加载纹理图片;否则使用默认的灰色纹理绘制
*分段颜色绘制:其对应的BMKPolylineView必须设置colors属性
*
*@param coords 指定的经纬度坐标点数组
*@param count 坐标点的个数
*@param textureIndex 纹理索引数组(颜色索引数组),成员为NSNumber,且为非负数,负数按0处理
*@return 新生成的折线对象
*/
+ (BMKPolyline *)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count textureIndex:(NSArray*) textureIndex;
/**
*重新设置折线坐标点 和 纹理索引
*@param points 指定的直角坐标点数组
*@param count 坐标点的个数
*@param textureIndex 纹理索引数组(颜色索引数组),成员为NSNumber,且为非负数,负数按0处理
*@return 是否设置成功
*/
- (BOOL)setPolylineWithPoints:(BMKMapPoint *)points count:(NSInteger) count textureIndex:(NSArray*) textureIndex;
/**
*重新设置折线坐标点
*@param coords 指定的经纬度坐标点数组
*@param count 坐标点的个数
*@param textureIndex 纹理索引数组(颜色索引数组),成员为NSNumber,且为非负数,负数按0处理
*@return 是否设置成功
*/
- (BOOL)setPolylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSInteger) count textureIndex:(NSArray*) textureIndex;
@end
@@ -0,0 +1,33 @@
/*
* BMKPolylineView.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <UIKit/UIKit.h>
#import "BMKPolyline.h"
#import "BMKOverlayGLBasicView.h"
/// 此类用于定义一个折线View
@interface BMKPolylineView : BMKOverlayGLBasicView
/**
*根据指定的折线生成一个折线View
*@param polyline 指定的折线数据对象
*@return 新生成的折线View
*/
- (id)initWithPolyline:(BMKPolyline *)polyline;
/// 该View对应的折线数据对象
@property (nonatomic, readonly) BMKPolyline *polyline;
#pragma mark - 以下方法和属性只适用于分段纹理绘制/分段颜色绘制
/// 是否分段纹理/分段颜色绘制(突出显示),默认YES,YES:使用分段纹理绘制 NO:使用默认的灰色纹理绘制
@property (nonatomic, assign) BOOL isFocus;
@end
@@ -0,0 +1,21 @@
/*
* BMKShape.h
* BMapKit
*
* Copyright 2011 Baidu Inc. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#import"BMKAnnotation.h"
/// 该类为一个抽象类,定义了基于BMKAnnotation的BMKShape类的基本属性和行为,不能直接使用,必须子类化之后才能使用
@interface BMKShape : NSObject <BMKAnnotation> {
}
/// 要显示的标题
@property (copy) NSString *title;
/// 要显示的副标题
@property (copy) NSString *subtitle;
@end
@@ -0,0 +1,84 @@
//
// BMKTileLayer.h
// MapComponent
//
// Created by wzy on 15/8/7.
// Copyright © 2015年 baidu. All rights reserved.
//
#ifndef BMKTileLayer_h
#define BMKTileLayer_h
#import "BMKOverlay.h"
/**
@brief 该类是覆盖在球面墨卡托投影上的图片tiles的数据源,是抽象类,不能直接使用该类添加瓦片图,需要使用其子类(BMKURLTileLayer或BMKSyncTileLayer
*瓦片图片是jpeg或者png格式,size为256x256
*/
@interface BMKTileLayer : NSObject <BMKOverlay>
/// tileLayer的可见最小Zoom值,默认3
@property (nonatomic, assign) NSInteger minZoom;
/// tileLayer的可见最大Zoom值,默认21,且不能小于minZoom
@property (nonatomic, assign) NSInteger maxZoom;
/// tileOverlay的可渲染区域,默认世界范围
@property (nonatomic) BMKMapRect visibleMapRect;
@end
/**
@brief 通过提供url模板的方法,提供数据源。不应该继承该类,且必须通过 initWithURLTemplate: 来初始化
*瓦片图片是jpeg或者png格式,size为256x256
*/
@interface BMKURLTileLayer : BMKTileLayer
/// 同initWithURLTemplate:中的URLTemplate
@property (readonly) NSString *URLTemplate;
/*!
@brief 根据指定的URLTemplate生成tileOverlay
@param URLTemplate是一个包含"{x}","{y}","{z}"的字符串,"{x}","{y}"表示tile的坐标,"{z}"表示当tile显示的级别。"{x}","{y}","{z}"会被tile的坐标值所替换,并生成用来加载tile图片数据的URL 。例如: http://server/path?x={x}&y={y}&z={z}。
@return 以指定的URLTemplate字符串生成tileOverlay
*/
- (id)initWithURLTemplate:(NSString *)URLTemplate;
/**
@brief 清除当前瓦片图层缓存图片
*/
- (BOOL)cleanTileDataCache;
@end
/**
@brief 通过同步方法获取瓦片数据,是一个抽象类,需要通过继承该类,并重载 tileForX:y:zoom: 方法
*瓦片图片是jpeg或者png格式,size为256x256
*/
@interface BMKSyncTileLayer : BMKTileLayer
/**
@brief 通过同步方法获取瓦片数据,子类必须实现该方法
这个方法会在多个线程中调用,需要考虑线程安全
@param (x, y, zoom)瓦片坐标
@return (x, y, zoom)所对应瓦片的UIImage对象
*/
- (UIImage *)tileForX:(NSInteger)x y:(NSInteger)y zoom:(NSInteger)zoom;
@end
/**
@brief 通过异步方法获取瓦片数据,是一个抽象类,需要通过继承该类,并重载 loadTileForX:y:zoom:result: 方法
*瓦片图片是jpeg或者png格式,size为256x256
*/
@interface BMKAsyncTileLayer : BMKTileLayer
/**
@brief 通过异步方法获取瓦片数据,子类必须实现该方法
@param (x, y, zoom)瓦片坐标
@return result 用来传入瓦片数据或加载瓦片失败的error访问的回调block
*/
- (void)loadTileForX:(NSInteger)x y:(NSInteger)y zoom:(NSInteger)zoom result:(void (^)(UIImage *tileImage, NSError *error))result;
@end
#endif /* BMKTileLayer_h */
@@ -0,0 +1,30 @@
//
// BMKTileLayerView.h
// MapComponent
//
// Created by wzy on 15/8/7.
// Copyright © 2015年 baidu. All rights reserved.
//
#ifndef BMKTileLayerView_h
#define BMKTileLayerView_h
#import "BMKOverlayView.h"
#import "BMKTileLayer.h"
/// 该类用于定义一个BMKTileLayerView
@interface BMKTileLayerView : BMKOverlayView
/**
*@brief 根据指定的tileLayer生成将tiles显示在地图上的View
*@param tileLayer 制定了覆盖图片,以及图片的覆盖区域
*@return 以tileLayer新生成View
*/
- (id)initWithTileLayer:(BMKTileLayer*) tileLayer;
/// 该View对应的tileLayer数据对象
@property (nonatomic, readonly) BMKTileLayer *tileLayer;
@end
#endif /* BMKTileLayerView_h */