Map Doc  1.0
iOS-引擎SDK-开放平台
MBMapView.h
浏览该文件的文档.
1 //
2 // MBMapView.h
3 // Navigation
4 //
5 // Created by delon on 12-12-26.
6 //
7 //
8 
9 #import <UIKit/UIKit.h>
10 #import <CoreLocation/CoreLocation.h>
11 
12 #import "MBEngine.h"
13 #import "MBAnnotation.h"
14 #import "MBNaviBaseTypes.h"
15 
16 typedef NS_ENUM(NSInteger, MBOptionalGesture) {
20 };
21 
22 typedef NS_ENUM(NSInteger, MBRenderConfig) {
28 };
29 
33 typedef NS_ENUM(NSInteger, MBAnimationType) {
34  MBAnimationType_linear, //暂不支持
35  MBAnimationType_flyOver //当前只支持直升机风格
36 };
37 
41 typedef NS_ENUM(NSInteger, MBLevelCase) {
42  MBLevelCase_maxIndoor, //最大室内图
43  MBLevelCase_maxMap, //最大普通地图
44  MBLevelCase_maxCountryMap, //最大全国地图
45  MBLevelCase_maxWorldMap, //最大世界地图
46  MBLevelCase_highest //最小普通地图
47 };
48 
52 typedef NS_ENUM(NSInteger, MBSatelliteImageSource) {
59 };
60 
64 typedef NS_ENUM(NSInteger, MBMapDataMode) {
68 };
69 
73 typedef NS_ENUM(NSInteger, MBUrlType) {
76 
77 };
78 
82 typedef NS_ENUM(NSInteger, MBRenderQuality) {
86 };
87 
91 typedef NS_ENUM(NSInteger, MBCameraSetting) {
100 };
101 
105 typedef NS_ENUM(NSInteger, MBMapMode) {
108 };
109 
113 typedef NS_OPTIONS(NSUInteger, MBPOIType) {
114  MBPOIType_NONE = 0,
115 
116  MBPOIType_railwayStation = 0x1,
117  MBPOIType_airport = 0x2,
118  MBPOIType_dock = 0x4,
119  MBPOIType_subwayStation = 0x8,
120 
121  MBPOIType_community = 0x10,
122  MBPOIType_school = 0x20,
123  MBPOIType_hospital = 0x40,
124  MBPOIType_park = 0x80,
125  MBPOIType_hotel = 0x100,
126  MBPOIType_seeingSite = 0x200,
127  MBPOIType_toilet = 0x400,
128 
129  MBPOIType_gasStation = 0x800,
130  MBPOIType_parkingLot = 0x1000,
131  MBPOIType_trafficLight = 0x2000,
132 
136  MBPOIType_bank = 0x8000,
137  MBPOIType_chinaPost = 0x10000,
138 
139  MBPOIType_McDonald = 0x20000,
140  MBPOIType_KFC = 0x40000,
141 
142  MBPOIType_subwayExit = 0x80000,
143 
144  MBPOIType_others = 0x100000,
145 
146  MBPOIType_ALL = 0xFFFFFFFF
147 };
148 
149 @class MBOverlay, MBMapState;
150 
151 @protocol MBMapViewDelegate;
152 
153 @interface MBMapView : UIView
157 @property (nonatomic, readonly, assign) MBSdkAuthError authErrorType;
158 
162 @property (nonatomic, assign) MBPoint worldCenter;
163 
167 @property (nonatomic, assign) MBNdsPoint centerNds;
168 
174 @property (nonatomic, assign) MBRect boundArea;
175 
182 @property (nonatomic, assign) float zoomLevel;
183 
187 @property (nonatomic, assign) float scale;
188 
192 @property (nonatomic, assign) float elevation;
193 
197 @property (nonatomic, assign) float heading;
198 
203 @property (nonatomic, assign) float viewShift;
204 
208 @property (nonatomic, assign) MBPoint centerOffset;
209 
215 @property (nonatomic, assign) MBRect viewport;
216 
220 @property(nonatomic,assign) float fovy;
221 
225 @property (nonatomic, readonly, assign) MBRect worldRect;
226 @property (nonatomic, readonly, assign) MBRect worldRectNds;
227 
231 @property (nonatomic, readonly, assign) MBPoint shiftXY;
232 
238 @property (nonatomic, assign) BOOL nightMode;
239 
243 @property (nonatomic, readonly, copy) NSArray *annotations;
244 
248 @property (nonatomic, readonly, copy) NSArray *overlays;
249 
255 @property (nonatomic, assign) BOOL suspendDisplay;
256 
262 @property (nonatomic, weak) id<MBMapViewDelegate> delegate;
263 
267 @property (nonatomic, copy) NSString *styleClass;
268 
272 - (CGFloat)minScale;
273 
277 - (CGFloat)maxScale;
278 
285 - (void)reloadMapData;
286 
291 - (void)setClipRect:(MBRect)clipRect;
292 
299 @property (nonatomic, assign) MBDataPreference dataPreference;
300 
308 - (MBPoint)world2Screen:(MBPoint)pt;
309 
319 - (MBPoint)screen2World:(MBPoint)pt;
320 
330 - (MBNdsPoint)screen2WorldNds:(MBPoint)pt;
331 - (MBPoint)world2ScreenNds:(MBNdsPoint)pt;
332 
340 - (void)loadStyleSheet:(NSString *)filename;
341 - (void)drawView;
342 
348 - (void)setSatelliteImageSource:(MBSatelliteImageSource)dataSource;
349 
357 - (MBRect)worldRect2Screen:(MBRect)rc;
358 
366 - (MBRect)screenRect2World:(MBRect)rc;
367 
374 - (BOOL)isPointVisible:(MBPoint)pos;
375 
382 - (BOOL)isRectVisible:(MBRect)rect;
383 - (BOOL)isRectVisibleNds:(MBRect)rect;
384 - (float)unitWorld2Screen:(float)worldUnit;
385 - (float)unitWorld2ScreenNds:(float)worldUnit;
386 - (float)unitScreen2World:(float)screenUnit;
387 - (float)unitScreen2WorldNds:(float)screenUnit;
391 - (NSString *)getImagePostfix;
400 - (void)fitWorldArea:(MBRect)area;
401 
410 - (void)fitWorldArea:(MBRect)area rect:(CGRect)rect;
411 
421 - (float)zoomLevel2Scale:(float)zoomLevel;
422 
435 - (NSInteger)meter2Pixel:(int)meter;
436 
449 - (float)getTraditionalMapScale;
450 
456 - (void)addAnnotation:(MBAnnotation *)annotation;
457 
463 - (void)removeAnnotation:(MBAnnotation *)annotation;
464 
470 - (void)removeAnnotations:(NSArray *)annotations;
471 
478 - (void)selectAnnotation:(MBAnnotation *)annotation;
479 
486 - (void)addOverlay:(MBOverlay *)overlay;
487 
494 - (void)insertOverlayAtIndex:(MBOverlay *)overlay index:(NSInteger)index;
495 
501 - (void)removeOverlay:(MBOverlay *)overlay;
502 
509 - (void)removeOverlays:(NSArray *)overlays;
510 
516 - (void)bringOverlayToTop:(MBOverlay *)overlay;
517 
523 - (void)sendOverlayToBack:(MBOverlay *)overlay;
524 
532 - (void)exchangeOverylayIndices:(MBOverlay *)l r:(MBOverlay *)r;
533 
540 - (void)setZoomLevel:(CGFloat)zoomLevel animated:(BOOL)animated;
541 
548 - (void)setScale:(CGFloat)scale animated:(BOOL)animated;
549 
557 - (void)setHeading:(CGFloat)heading animated:(BOOL)animated;
558 
562 - (void)beginAnimations;
563 
567 - (void)cancelAnimations;
568 
575 - (void)commitAnimations:(int)duration type:(MBAnimationType)type;
576 
582 - (void)startZoom:(BOOL)toZoomIn;
583 
587 - (void)endZoom;
588 
594 - (BOOL)isInAnimation;
595 
603 - (void)setWorldCenter:(MBPoint)worldCenter animated:(BOOL)animated;
604 
613 - (void)setViewShiftX:(float)rx y:(float)ry;
614 
618 - (void)compactCache;
619 
623 - (void)clearCache;
624 - (void)switchToBackground;
625 - (void)switchToForeground;
626 
630 @property (nonatomic, assign) BOOL enableBackground;
631 
635 @property (nonatomic, assign) BOOL enableBasicMap;
636 
640 @property (nonatomic, assign) BOOL enableSatelliteMap;
641 
645 @property (nonatomic, assign) BOOL enableTrafficEvent;
646 
652 @property (nonatomic, assign) BOOL enableBuilding;
653 
658 @property (nonatomic, assign) BOOL enableTmc;
659 
663 @property (nonatomic, assign) BOOL enableUpdateTmc;
664 
668 @property (nonatomic, assign) float dpiFactor;
669 
673 @property (nonatomic, assign) MBRenderQuality renderQuality;
674 
678 @property (nonatomic, strong) MBMapState *mapState;
679 
683 @property (nonatomic, assign) MBRangeF zoomLevelRange;
684 
688 @property (nonatomic, assign) int tmcRefreshInterval;
689 
693 - (void)setTiServerUrl:(NSString *)url;
694 
708 - (void)setConfigType:(MBRenderConfig)type values:(int*)values num:(NSInteger)num;
709 - (void)getConfigType:(MBRenderConfig)type values:(int*)values num:(NSInteger)num;
710 
723 - (void)setConfigType:(MBRenderConfig)type enable:(BOOL)enable;
724 - (BOOL)getConfigTypeEnable:(MBRenderConfig)type;
725 
732 - (void)setDataUrlPrefix:(MBUrlType)type urlPrefix:(NSString *)url;
733 
739 - (UIImage *)screenshot;
740 
744 @property (nonatomic, assign) BOOL enableUserRasterMap;
745 
751 - (BOOL)isBuildingOpaque;
752 
756 @property (nonatomic, assign) float highestBuildingZoom;
757 
761 @property (nonatomic, assign) BOOL highlightTmc;
762 
770 - (float)getZoomLevelOf:(MBLevelCase)levelCase;
771 
779 + (MBNdsPoint)ndsPointFromMBPoint:(MBPoint)pos;
780 
788 + (MBPoint)ndsPointToMBPoint:(MBNdsPoint)pos;
789 
797 + (MBNdsPoint)ndsPointFrom:(CLLocationCoordinate2D)location;
798 
806 + (CLLocationCoordinate2D)ndsPointToXY:(MBNdsPoint)pos;
807 
818 + (MBRect)getFitRect:(MBPoint *)points num:(NSInteger)poiNum;
819 
828 - (void)optionalGesture:(MBOptionalGesture)gesture enable:(BOOL)enable;
829 
839 - (BOOL)isOptionalGestureEnabled:(MBOptionalGesture)gesture;
840 - (NSInteger)detachAllOverlays;
841 - (void)detachOverlay:(MBOverlay *)overlay;
842 - (void)detachAnnotation:(MBAnnotation *)annotation;
843 - (NSInteger)detachAllAnnotations;
844 - (UIImage *)screenshotWithRect:(MBRect)rect dpiFactor:(float)dpi;
845 
846 #pragma mark -- UIE Project Only
847 - (BOOL)onTouchDown:(int)touchCount touchIds:(ssize_t*) touchIds pos:(const MBPoint*) positions;
848 - (void)onTouchMove:(int)touchCount touchIds:(ssize_t*)touchIds pos:(const MBPoint*)positions;
849 - (void)onTouchUp:(int)touchCount touchIds:(ssize_t*)touchIds pos:(const MBPoint*)positions;
850 - (void)onTouchCancelled:(int)touchCount touchIds:(ssize_t*)touchIds pos:(const MBPoint*)positions;
851 - (void)onTap:(const MBPoint*) pos;
852 - (void)resetTouch;
853 - (void)onTouchClicked:(const MBPoint*)pos;
854 - (void)onTouchDoubleClicked:(const MBPoint*)pos;
855 
856 @end
Definition: MBMapView.h:153
Definition: MBNaviCoreBase.h:42
void cancelAnimations()
MBPoint worldCenter
Definition: MBMapView.h:162
Definition: MBMapView.h:92
MBRect worldRect
Definition: MBMapView.h:225
float heading
Definition: MBMapView.h:197
MBRect boundArea
Definition: MBMapView.h:174
Definition: MBMapView.h:85
BOOL highlightTmc
Definition: MBMapView.h:761
void drawView()
Definition: MBMapView.h:17
MBSdkAuthError
Definition: MBEngine.h:62
Definition: MBMapView.h:84
Definition: MBMapView.h:43
BOOL enableUpdateTmc
Definition: MBMapView.h:663
BOOL enableUserRasterMap
Definition: MBMapView.h:744
Definition: MBMapView.h:75
Definition: MBMapState.h:18
NSInteger detachAllAnnotations()
MBDataPreference dataPreference
Definition: MBMapView.h:299
float highestBuildingZoom
Definition: MBMapView.h:756
Definition: MBMapView.h:94
BOOL enableTrafficEvent
Definition: MBMapView.h:645
void switchToBackground()
Definition: MBMapView.h:99
Definition: MBOverlay.h:26
Definition: MBMapView.h:98
MBOptionalGesture
Definition: MBMapView.h:16
id< MBMapViewDelegate > delegate
Definition: MBMapView.h:262
BOOL nightMode
Definition: MBMapView.h:238
float getTraditionalMapScale()
float fovy
Definition: MBMapView.h:220
Definition: MBMapView.h:58
MBMapDataMode
Definition: MBMapView.h:64
CGFloat maxScale()
Definition: MBMapView.h:67
float zoomLevel
Definition: MBMapView.h:182
MBRenderConfig
Definition: MBMapView.h:22
Definition: MBMapView.h:35
MBLevelCase
Definition: MBMapView.h:41
float dpiFactor
Definition: MBMapView.h:668
CGFloat minScale()
MBSatelliteImageSource
Definition: MBMapView.h:52
int tmcRefreshInterval
Definition: MBMapView.h:688
BOOL enableTmc
Definition: MBMapView.h:658
Definition: MBAnnotation.h:79
MBNdsPoint centerNds
Definition: MBMapView.h:167
Definition: MBNaviCoreBase.h:77
MBSdkAuthError authErrorType
Definition: MBMapView.h:157
MBMapMode
Definition: MBMapView.h:105
Definition: MBMapView.h:65
typedef NS_OPTIONS(NSUInteger, MBPOIType)
Definition: MBMapView.h:113
MBRect viewport
Definition: MBMapView.h:215
NSString * getImagePostfix()
MBAnimationType
Definition: MBMapView.h:33
Definition: MBMapView.h:44
Definition: MBMapView.h:57
float viewShift
Definition: MBMapView.h:203
Definition: MBMapView.h:95
Definition: MBMapView.h:18
void clearCache()
Definition: MBMapView.h:56
Definition: MBMapView.h:54
NSString * styleClass
Definition: MBMapView.h:267
MBMapState * mapState
Definition: MBMapView.h:678
Definition: MBMapView.h:34
MBPoint centerOffset
Definition: MBMapView.h:208
MBDataPreference
Definition: MBNaviBaseTypes.h:288
Definition: MBMapView.h:45
Definition: MBMapView.h:42
BOOL isInAnimation()
void beginAnimations()
Definition: MBMapView.h:55
Definition: MBMapView.h:26
void endZoom()
void compactCache()
MBCameraSetting
Definition: MBMapView.h:91
MBRangeF zoomLevelRange
Definition: MBMapView.h:683
float scale
Definition: MBMapView.h:187
void switchToForeground()
float elevation
Definition: MBMapView.h:192
BOOL suspendDisplay
Definition: MBMapView.h:255
Definition: MBMapView.h:96
MBRenderQuality
Definition: MBMapView.h:82
Definition: MBMapView.h:53
Definition: MBNaviCoreBase.h:67
Definition: MBMapView.h:19
Definition: MBMapView.h:93
Definition: MBMapView.h:23
Definition: MBMapView.h:46
UIImage * screenshot()
Definition: MBMapView.h:25
MBUrlType
Definition: MBMapView.h:73
void reloadMapData()
MBPoint shiftXY
Definition: MBMapView.h:231
NSArray * overlays
Definition: MBMapView.h:248
BOOL enableSatelliteMap
Definition: MBMapView.h:640
Definition: MBMapView.h:74
BOOL enableBackground
Definition: MBMapView.h:630
NSInteger detachAllOverlays()
MBRect worldRectNds
Definition: MBMapView.h:226
Definition: MBMapView.h:106
Definition: MBMapView.h:24
Definition: MBMapView.h:83
Definition: MBMapView.h:66
void resetTouch()
Definition: MBNaviCoreBase.h:31
BOOL enableBasicMap
Definition: MBMapView.h:635
MBRenderQuality renderQuality
Definition: MBMapView.h:673
Definition: MBMapView.h:27
NSArray * annotations
Definition: MBMapView.h:243
BOOL isBuildingOpaque()
Definition: MBMapView.h:107
BOOL enableBuilding
Definition: MBMapView.h:652
Definition: MBMapView.h:97