您好,欢迎访问三七文档
APIAPIa)MapAPIMap(container:String|HTMLElement[,opts:MapOptions])Map.centerAndZoom()方法对地图进行初始化。未进行初enableDragging()disableDragging()enableScrollWheelZoom()EnddisableKeyboard()enableInertialDragging()disableInertialDragging()enableContinuousnone(自1.1(自1.11/55nonenonenonedisableScrollWheelZoom()enableDoubleClickZoom()disableDoubleClickZoom()nonenonenonenonenonenoneenableKeyboard()nonePgUp、PgDn、HomeAPIZoom()disableContinuousZoom()enablePinchToZoom()disablePinchToZoom()none(自1.1(自1.1(自1.1(自1.1nonenonegetBounds()BoundsPointNumberMapgetMapType()TypesgetSize()SizegetCenter()getDistance(start:Point,end:Point)(自1.1(自1.1getViewport(view:ArrayPoint[,viewportOptions:ViewportOptions])Viewportcenterzoom(自1.1getZoom()NumberStringtoString()2/55APIcenterAndZoom(center:Point,zoom:Number)nonexyBMAP_PERSPECTIVE_MAPcenterAndZoomnonenonezoomIn()3/55varmap=newBMap.Map(“container”,{mapType:BMAP_PERSPECTIVE_MAP});map.setCurrentCity(“北京市”);map.centerAndZoom(newBMap.Point(116.404,39.915),18);BMAP_NORMAL_MAP,则在调setMapType(自1.1panTo(center:Point)nonepanBy(x:Number,y:Number)nonenonenonereset()setCenter(center:Point)setCurrentCity(city:String)nonesetMapType(mapType:MapTypes)setViewport(view:ArrayPoint|Viewport[,ViewportOptions])viewportOptions:nonenone(自1.1(自1.1zoomTo(zoom:Number)APIzoomOut()noneaddControl(control:Control)removeControl(control:Control)noneControl.initialize()方法,并将控件的容器元素添加到nonegetContainer()HTMLElementaddContextMenu(menu:ContextMenu)removeContextMenu(menu:ContextMenu)nonenoneaddOverlay(overlay:Overlay)removeOverlay(overlay:Overlay)clearOverlays()openInfoWindow(infoWnd:InfoWindow,point:Point)closeInfoWindow()nonePixel(自1.1PointInfoWindow|Nul(自1.1null。4/55nonenonenonenonepointToOverlayPixel(point:Point)overlayPixelToPoint(pixel:Pixel)getInfoWindow()APIlgetOverlays()ArrayOverlay(自1.1(自1.1HTML{floatPane,markerMouseTarget,floatShadow,labelPane,markerPane,mapPane}(自1.1getPanes()ObjectaddTileLayer(tileLayer:TileLayer)removeTileLayer(tilelayer:TileLayer)getTileLayer(mapType:String)nonenoneTileLayerpixelToPoint(pixel:Pixel)pointToPixel(point:Point)PointPixelclickevent{type,target,clickclickdblclick(自1.1dblclickrightclickevent{type,pixel,point}event{type,target,target,5/55point,pixel,overlay}point,pixel,overlay}Map.removeOverlay()方法移除单个覆盖物时Map.clearOverlays()方法一次性移除全部覆point,pixel,overlay}event{type,target}event{type,target,point,pixel,overlay}event{type,target}event{type,target}event{type,target}event{type,target}event{type,target}event{type,target}event{type,target}event{type,target}event{type,target}event{type,target}event{type,pixel,point}event{type,pixel,point}event{type,pixel,point}event{type,target}event{type,target}target,target,target,6/55APIrightclickrightclickrightdblclick(自1.1rightdblclickmaptypechangemousemovemovestartmovingmoveendzoomstartzoomendaddoverlayaddcontrolremovecontrolremoveoverlayclearoverlaysdragstartdraggingdragendaddtilelayerremovetevent{type,target,(自1.1(自1.1(自1.1Map.addOverlay()方法向地图中添加单个覆盖Map.addControl()方法向地图中添加单个控件Map.removeControl()方法移除单个控件时会APIilelayerevent{type,target,Map.centerAndZoom()方法时会触发此事件。这loadpixel,point,zoom}event{type,size}target,resizeb)MapOptionsMapzoomLevelMinzoomLevelMaxmapTypeNumberNumberMapTypesBMAP_NORMAL_MAP(自1.1c)ViewportcenterPoint(自1.1(自1.1zoomNumberd)ViewportOptionsmap.getViewportmap.setViewportenableAnimationmarginstrue。Boolean(自1.1ArrayNum7/55APIbermargins:[30,20,0,20](自1.1zoomFactorNumbermap.setViewportzoomFactor(自1.1delayNumber(自1.1e)MapTypesBMAP_NORMAL_MAP(自1.1(自1.1BMAP_PERSPECTIVE_MAPa)PointPoint(lng:Number,lat:Number)lnglatNumberNumberequals(other:Point)Booleantrue。8/55APItoString()Stringb)PixelPixel(x:Number,y:Number)xyNumberNumberxyequals(other:Pixel)toString()BooleanStringxytrue。c)Boundsx、yBounds(minX:Number,minY:Number,maxX:Number,maxY:Number)minXminYmaxXmaxYNumberNumberNumberNumberxyxy9/55APIBooleanBooleanBooleanBoundsnonePointBooleanStringtrue。true。equals(other:Bounds)containsPoint(point:Point)containsBounds(bounds:Bounds)intersects(other:Bounds)extend(point:Point)getCenter()isEmpty()true。true。toString()d)SizewidthheightNumberNumberequals(other:Size)toString()BooleanStringtrue。a)ControlNavigation10/55APIControlMap.addControl()方法可将控件添加到地图上。Control()defaultAnchordefaultOffsetenumControlAnchorSizeMap.addControl()方法添加控件时将调initialize(map:Map)HTMLElementDOMDOMmap.getContainer()方法可获得地图容器元素。setAnchor(anchor:enumControlAnchor)noneenumgetAnchor()ControlAnchorsetOffset(offset:Size)getOffset()show()hide()isVisible()toString()noneSizenonenoneBooleanStringb)ControlOptionsNavigationControl11/55offsetenumControlAnchorSizee)ControlAnchorBMAP_ANCHOR_TOP_LEFTBMAP_ANCHOR_TOP_RIGHTBMAP_ANCHOR_BOTTOM_LEFTBMAP_ANCHOR_BOTTOM_RIGHTf)OverviewMapControl12/55APIanchoroffsettypeenumControlAnchorSizeenumNavigationControlTypec)ScaleControlOptionsScaleControlanchoroffsetenumControlAnchorSized)CopyrightControlOptionsCopyrightControlanchorAPIOverviewMapControl([opts:OverviewMapControlOptions])changeView()setSize(size:Size)getSize()nonenoneSizeviewchangedviewchangingevent{type,isOpen}eve
本文标题:地图API类参考
链接地址:https://www.777doc.com/doc-1085215 .html