日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android高德marker添加点击,高德地图上添加marker,给每一个marker添加点击事件。...

發布時間:2024/9/27 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android高德marker添加点击,高德地图上添加marker,给每一个marker添加点击事件。... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

高德地圖上添加marker,給每一個marker添加點擊事件。

高德地圖上添加marker,給每一個marker添加點擊事件。javascript

var watch = []

$.ajax({

type: 'GET',

dataType: 'jsonp',

url:

url +

'你的url地址',

error: function() {

alert('獲取監控點信息失敗')

},

success: function(data) {

var json = data.QueryUDCAMERAINFOResponse

json = json.UDCAMERAINFOSet.UDCAMERA

$.each(json, function(index, item) {

if (json[index].LATITUDE && json[index].LONGITUDE) {

// console.log(json[index])

watch.push(json[index])

// console.log(watch)

}

})

watchMap(watch)

}

})

function watchMap(list) {

var watchList = []

// 添加多個地圖點標記

for (let i = 0; i < list.length; i++) {

var temp = new AMap.Marker({

position: new AMap.LngLat(list[i].LONGITUDE, list[i].LATITUDE), // 經緯度對象,也能夠是經緯度構成的一維數組[116.39, 39.9]

title: list[i].NAME,

map: map,

icon: 'imgs/sxt.png',

clickable: true

})

watchList.push(temp)

// 給每一個點標記注冊點擊事件

AMap.event.addListener(temp, 'click', function(e) {

$('#watch').hide(300)

//獲得的數據

for (let j = 0; j < list.length; j++) {

if (this.B.title == list[j].NAME) {

// 點擊攝像頭標記,切換中心坐標

map.setCenter([list[i].LONGITUDE, list[i].LATITUDE])

var str =

'

  • 設備信息

  • 位置:??' +

    list[j].NAME +

    '

  • 緯度:??' +

    list[i].LATITUDE +

    '

  • 精度:??' +

    list[i].LONGITUDE +

    '

  • 運行狀態:??正常
  • '>點擊查看

  • '>資產臺帳

×'

// 更改彈窗口

$('#watch').html(str)

$('#watch')

.css({

left: '50%',

top: '50%'

})

.show(300)

$('#closeWatch').click(function() {

$('#watch').hide(300)

})

$('#openMp4').click(function() {

$('.playerMp4')

.css({

height: $(window).height()

})

.show(300)

$('.radio_top_title').html(list[j].NAME)

$('#watch').hide(300)

})

}

}

})

}

// 將建立的點標記添加到已有的地圖實例:

map.add(watchList)

// 利用styles屬性修改點聚合的圖標樣式

var styles = [

{

url: 'https://a.amap.com/jsapi_demos/static/images/blue.png',

size: new AMap.Size(32, 32),

offset: new AMap.Pixel(-16, -30)

},

{

url: 'https://a.amap.com/jsapi_demos/static/images/green.png',

size: new AMap.Size(36, 36),

offset: new AMap.Pixel(-18, -18)

},

{

url: 'https://a.amap.com/jsapi_demos/static/images/orange.png',

size: new AMap.Size(48, 48),

offset: new AMap.Pixel(-24, -45)

}

]

//添加聚合組件

map.plugin(['AMap.MarkerClusterer'], function() {

cluster = new AMap.MarkerClusterer(

map, // 地圖實例

watchList, // 海量點組成的數組

{

styles: styles

}

)

})

總結

以上是生活随笔為你收集整理的android高德marker添加点击,高德地图上添加marker,给每一个marker添加点击事件。...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。