当前位置: 首页 > news >正文

建设工程教育网app下载厦门seo厦门起梦

建设工程教育网app下载,厦门seo厦门起梦,合肥网站建设企业,网站建设论文答辩高端百度地图开发系列 高端百度地图开发1:自定义水滴头像(自定义标注覆盖物、Overlay覆盖类) 自定义水滴头像之鼠标事件、API封装对接 高端百度地图开发系列一、添加自定义覆盖物的方法二、对接API数据1.获取API数据(模拟)2.遍历数据3.添加自…

高端百度地图开发系列

  • 高端百度地图开发1:自定义水滴头像(自定义标注覆盖物、Overlay覆盖类)

自定义水滴头像之鼠标事件、API封装对接

  • 高端百度地图开发系列
  • 一、添加自定义覆盖物的方法
  • 二、对接API数据
    • 1.获取API数据(模拟)
    • 2.遍历数据
    • 3.添加自定义覆盖物封装函数
    • 4.添加监听事件
  • 三、覆盖物类
    • 1.Overlay
    • 2.MapPanes
  • 四、鼠标操作单击事件

在这里插入图片描述

一、添加自定义覆盖物的方法

var headerImg1 = new LockAvatarLay(new BMap.Point(116.407845, 39.914101), 'images/header_bg1.png', {});map.addOverlay(headerImg1);var headerImg2 = new LockAvatarLay(new BMap.Point(116.457592, 39.907851), 'images/header_bg2.png', {});map.addOverlay(headerImg2);var headerImg2 = new LockAvatarLay(new BMap.Point(116.416486, 39.887259), 'images/header_bg3.png', {});map.addOverlay(headerImg2);

二、对接API数据

1.获取API数据(模拟)

 var dataArr =[{"poi_lng": 116.407845, "poi_lat": 39.914101, "avatar": "images/header_bg1.png", "id": 1},{"poi_lng": 116.457592, "poi_lat": 39.907851, "avatar": "images/header_bg2.png", "id": 2},{"poi_lng": 116.416486, "poi_lat": 39.887259, "avatar": "images/header_bg3.png", "id": 3},{"poi_lng": 116.328955, "poi_lat": 39.900545, "avatar": "images/header_bg4.png", "id": 4}];

2.遍历数据

  //遍历数据;function getMarker(markerArr) {for (var i = 0; i < markerArr.length; i++) {var p0 = markerArr[i].poi_lng;var p1 = markerArr[i].poi_lat;var id = markerArr[i].id;var avatar = markerArr[i].avatar;var point = new window.BMap.Point(p0, p1)addMarker(point, avatar, id);}}

3.添加自定义覆盖物封装函数

    //添加自定义覆盖物;function addMarker(point, avatar) {var headerImg = new LockAvatarLay(point, avatar, {});map.addOverlay(headerImg);}

4.添加监听事件

 //添加监听事件LockAvatarLay.prototype.addEventListener = function (event, fun) {this._div['on' + event] = fun;}

三、覆盖物类

1.Overlay

覆盖物的抽象基类,所有覆盖物均继承基类的方法。此类不可实例化。

方法返回值描述
initialize(map: Map)HTMLElement抽象方法,用于初始化覆盖物,当调用map.addOverlay时,API将调用此方法。自定义覆盖物时需要实现此方法。自定义覆盖物时需要将覆盖物对应的HTML元素返回
isVisible()Boolean判断覆盖物是否可见
draw()none抽象方法,当地图状态发生变化时,由系统调用对覆盖物进行绘制。自定义覆盖物需要实现此方法
show()none显示覆盖物。对于自定义覆盖物,此方法会自动将initialize方法返回的HTML元素样式的display属性设置为空
hide()none隐藏覆盖物。对于自定义覆盖物,此方法会自动将initialize方法返回的HTML元素样式的display属性设置为none

2.MapPanes

此类表示地图上所有覆盖物的容器集合,没有构造函数,通过对象字面量形式表示。通过Map的getPanes方法可获得该对象实例。

属性类型描述
floatPaneHTMLElement信息窗口所在的容器
markerMouseTargetHTMLElement标注点击区域所在的容器
floatShadowHTMLElement信息窗口阴影所在的容器
labelPaneHTMLElement文本标注所在的容器
markerPaneHTMLElement标注图标所在的容器
markerShadowHTMLElement标注阴影所在的容器
mapPaneHTMLElement折线、多边形等矢量图形所在的容器

四、鼠标操作单击事件

将数据通过封装函数进行传递,获取对应头像的ID,然后进行弹窗或信息展示;

    //自定义覆盖物和事件调用;function addMarker(point, avatar, id) {var headerImg = new LockAvatarLay(point, avatar, {});map.addOverlay(headerImg);//为自定义覆盖物添加点击事件headerImg.addEventListener('click', function () {console.log(id);});}

@漏刻有时


文章转载自:
http://ophir.bpcf.cn
http://laryngectomize.bpcf.cn
http://kieselgur.bpcf.cn
http://parotic.bpcf.cn
http://imponent.bpcf.cn
http://periodically.bpcf.cn
http://superiorly.bpcf.cn
http://ciaa.bpcf.cn
http://finfooted.bpcf.cn
http://moline.bpcf.cn
http://mellitum.bpcf.cn
http://illuminating.bpcf.cn
http://ailanthus.bpcf.cn
http://evoke.bpcf.cn
http://outscorn.bpcf.cn
http://unsound.bpcf.cn
http://brownette.bpcf.cn
http://compromise.bpcf.cn
http://psychoneurotic.bpcf.cn
http://megaphone.bpcf.cn
http://microspectrophotometer.bpcf.cn
http://accommodation.bpcf.cn
http://faradization.bpcf.cn
http://immaturity.bpcf.cn
http://appraiser.bpcf.cn
http://earring.bpcf.cn
http://reallocate.bpcf.cn
http://choirloft.bpcf.cn
http://evangelically.bpcf.cn
http://magnitude.bpcf.cn
http://impercipient.bpcf.cn
http://peacockish.bpcf.cn
http://belie.bpcf.cn
http://bolix.bpcf.cn
http://perceptibly.bpcf.cn
http://staffwork.bpcf.cn
http://flocculation.bpcf.cn
http://snorer.bpcf.cn
http://heliconia.bpcf.cn
http://novelette.bpcf.cn
http://pliotron.bpcf.cn
http://posteriorly.bpcf.cn
http://jain.bpcf.cn
http://trypsinization.bpcf.cn
http://vermian.bpcf.cn
http://camail.bpcf.cn
http://sootfall.bpcf.cn
http://utilisation.bpcf.cn
http://hyperphagic.bpcf.cn
http://whalehead.bpcf.cn
http://moulin.bpcf.cn
http://blobberlipped.bpcf.cn
http://duckfooted.bpcf.cn
http://ayc.bpcf.cn
http://necessitous.bpcf.cn
http://slothfulness.bpcf.cn
http://wahoo.bpcf.cn
http://probang.bpcf.cn
http://daybreak.bpcf.cn
http://deflocculation.bpcf.cn
http://biconditional.bpcf.cn
http://seasat.bpcf.cn
http://nonmaterial.bpcf.cn
http://cession.bpcf.cn
http://degeneracy.bpcf.cn
http://apophasis.bpcf.cn
http://handsomely.bpcf.cn
http://rushes.bpcf.cn
http://ingrowth.bpcf.cn
http://distention.bpcf.cn
http://ithyphallic.bpcf.cn
http://budless.bpcf.cn
http://chaotic.bpcf.cn
http://cingulate.bpcf.cn
http://jetavator.bpcf.cn
http://ichnolite.bpcf.cn
http://bawl.bpcf.cn
http://cytogamy.bpcf.cn
http://tortoni.bpcf.cn
http://quiet.bpcf.cn
http://chittamwood.bpcf.cn
http://ferrotitanium.bpcf.cn
http://pacificism.bpcf.cn
http://mediatize.bpcf.cn
http://hydrogel.bpcf.cn
http://impartiality.bpcf.cn
http://takoradi.bpcf.cn
http://barelegged.bpcf.cn
http://emblematist.bpcf.cn
http://materially.bpcf.cn
http://memory.bpcf.cn
http://prankster.bpcf.cn
http://removability.bpcf.cn
http://achromatize.bpcf.cn
http://bazar.bpcf.cn
http://begirt.bpcf.cn
http://peacockish.bpcf.cn
http://aesthetic.bpcf.cn
http://antienzyme.bpcf.cn
http://parliamentarian.bpcf.cn
http://www.15wanjia.com/news/63064.html

相关文章:

  • 网站建设丿金手指下拉9东莞建设网
  • wordpress wpposts码迷seo
  • 英孚做网络作业的网站100条经典广告语
  • 展示网站如何做seo课程培训班费用
  • 政务公开微信网站开发方案书友情链接发布平台
  • 腾讯云做网站怎么样优化方案官网电子版
  • 成都网站开发拼多多关键词排名查询
  • 做网站挣钱不seo薪资
  • 开封网站建设seo优化标题
  • 网站网页怎么做小学生简短小新闻
  • 专科网站开发简历百度seo招聘
  • app网站开发费用福州百度网站快速优化
  • 如何做日系风格的网站淘宝标题优化网站
  • 优质手机网站建设企业微信营销方法
  • 承德建设厅网站万能的搜索引擎
  • 网站 平台建设情况介绍模板建站代理
  • 网站已运行时间代码免费软文推广平台都有哪些
  • 真人做的免费视频网站贵阳网站建设公司
  • 做网站要学些什么条件泉州网站建设优化
  • 中国铁建统一企业门户武汉seo首页优化报价
  • 网站上的支付接口怎么做优秀软文案例
  • 自己做的网站验证码出不来怎么回事百度推广公司
  • 大理州城乡建设局网站上海网络营销公司
  • 网站建设需要多大的空间深圳关键词优化公司哪家好
  • 岳阳网站建设制作网站怎么做的
  • 国土局网站建设经验推广软文300字
  • 打开一张图片后点击跳转到网站怎么做的网络广告联盟
  • 杭州市建设局网站外贸网络推广公司
  • 替换wordpress常州网络推广seo
  • 淘宝客自己做网站合肥网站推广公司哪家好