!function(){ var infowindow, map, level = 16, center = {lng: 120.744615, lat: 31.36665}, features = [{"icon":"cir","color":"red","name":"苏州建筑工程集团有限公司","desc":"地址:苏州工业园区娄阳路18号
集团公司电话:0512-65118837
业务联系电话:15906190858(徐总)、18912777510(林总)
企业邮箱:szjgjt@szjgjt.com","lnglat":{"q":31.36642142624713,"r":120.74435455933212,"lng":120.744355,"lat":31.366421},"offset":{"x":-9,"y":-31},"type":"marker"}]; function loadfeatures(){ for(var feature, data, i = 0, len = features.length, j, jl, path; i < len; i++){ data = features[i]; switch(data.type){ case "marker": feature = new amap.marker({ map: map, position: new amap.lnglat(data.lnglat.lng, data.lnglat.lat), zindex: 3, extdata: data, offset: new amap.pixel(data.offset.x, data.offset.y), title: data.name, content: '
' }); break; case "polyline": for(j = 0, jl = data.path.length, path = []; j < jl; j++){ path.push(new amap.lnglat(data.path[j].lng, data.path[j].lat)); } feature = new amap.polyline({ map: map, path: path, extdata: data, zindex: 2, strokeweight: data.strokeweight, strokecolor: data.strokecolor, strokeopacity: data.strokeopacity }); break; case "polygon": for(j = 0, jl = data.path.length, path = []; j < jl; j++){ path.push(new amap.lnglat(data.path[j].lng, data.path[j].lat)); } feature = new amap.polygon({ map: map, path: path, extdata: data, zindex: 1, strokeweight: data.strokeweight, strokecolor: data.strokecolor, strokeopacity: data.strokeopacity, fillcolor: data.fillcolor, fillopacity: data.fillopacity }); break; default: feature = null; } if(feature){ amap.event.addlistener(feature, "click", mapfeatureclick); } } } function mapfeatureclick(e){ if(!infowindow){ infowindow = new amap.infowindow({automove: true,iscustom: false}); } var extdata = e.target.getextdata(); infowindow.setcontent("
" + extdata.name + "
" + extdata.desc + "
"); infowindow.open(map, e.lnglat); } map = new amap.map("mapcontainer", {center: new amap.lnglat(center.lng, center.lat), level: level, scrollwheel:false}); loadfeatures(); map.on('complete', function(){ map.plugin(["amap.toolbar"], function(){ map.addcontrol(new amap.toolbar({ruler: true, direction: true, locate: false})); }); }) }(); // javascript document