| | |
| | | } |
| | | |
| | | moralMap.callJS = function(condition) { |
| | | //$("#searchParam").val(condition); |
| | | //var condition = JSON.parse(condition); |
| | | var new_point = new BMap.Point(condition.longitude, condition.latitude); |
| | | baiduMap.panTo(new_point); |
| | | baiduMap.setCenter(new_point); |
| | | baiduMap.setZoom(condition.type == "mpoint" ? 17 : 18); |
| | | var interval = setInterval(function(){ |
| | | var marker; |
| | | if (condition.type == "mpoint") { |
| | | marker = moralMap.getMpoint(condition.id); |
| | | } else if (condition.type == "device") { |
| | | marker = moralMap.getEquipment(condition.mac); |
| | | } |
| | | if(marker){ |
| | | clearInterval(interval); |
| | | moralMap.openInfoWindow(marker["infoWindow"], new_point); |
| | | } |
| | | }, 50); |
| | | |
| | | if (condition.type == "mpoint") { |
| | | baiduMap.setZoom(17); |
| | | if(moralMap.getMpoint(condition.id)){ |
| | | moralMap.openInfoWindow(moralMap.getMpoint(condition.id)["infoWindow"], new_point); |
| | | }else { |
| | | //$("#searchParam").val(condition.id); |
| | | } |
| | | } else if (condition.type == "device") { |
| | | //baiduMap.centerAndZoom(new_point, 18); |
| | | baiduMap.setZoom(18); |
| | | if(moralMap.getEquipment(condition.mac)){ |
| | | moralMap.openInfoWindow(moralMap.getEquipment(condition.mac)["infoWindow"], new_point); |
| | | } else { |
| | | //var equipment = new moralMap.Equipment(condition); |
| | | //moralMap.openInfoWindow(showInfoWindow, new_point); |
| | | //moralMap.openInfoWindow(equipment["infoWindow"], new_point); |
| | | //moralMap.openInfoWindow(moralMap.getEquipment(condition.mac)["infoWindow"], new_point); |
| | | //moralMap.callJS(condition); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |