baidu_map.lview 2.07 KB
<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author: chenlingfeng7543
$Date: 2018/6/26 11:15
$Revision: 1.0 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <style type="text/css"><![CDATA[
            body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
        ]]></style>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&amp;ak=KMBR5EAyR6x0YV9DG8YYaKQWVuv2AyNh"></script>

            <div id="allmap" style="width: 100%;height:100%;overflow: hidden;margin:0;font-family:&apos;微软雅黑&apos;"></div>

            <script ><![CDATA[
                // 百度地图API功能
                var map = new BMap.Map("allmap");
            var  longitude = '${/parameter/@longitude}';//经度
            var latitude= '${/parameter/@latitude}';//纬度
            if (latitude &&longitude){
                var point = new BMap.Point(longitude, latitude);
                map.centerAndZoom(point, 15);
                var marker = new BMap.Marker(point);  // 创建标注
                map.addOverlay(marker);               // 将标注添加到地图中
                //marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
                var top_left_control = new BMap.ScaleControl({
                    anchor: BMAP_ANCHOR_TOP_LEFT
                }); // 左上角,添加比例尺
                var top_left_navigation = new BMap.NavigationControl(); //左上角,添加默认缩放平移控件
                //var top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL});
                map.addControl(top_left_control);
                map.addControl(top_left_navigation);
                map.addControl(new BMap.MapTypeControl());
                map.enableScrollWheelZoom(); //启用滚轮放大缩小
              //  map.setDefaultCursor("crosshair");//修改鼠标样式
            }

            ]]></script>

    </a:view>
</a:screen>