adfgfgafg

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Locus </title>
     <style type="text/css">
        html
        {
            height: 100%;
        }
        body
        {
            height: 100%;
            margin: 0px;
            padding: 0px;
        }
        #map_canvas
        {
            height: 100%;
        }
         </style>
    <script type="text/javascript" src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA&hl=zh-CN""></script>
    
    <script type="text/javascript">
        var map;
        var radius = 100;
        var mycircle;
        function initialize() {
            map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(39.88023492849342, 110.225830078125), 5);
            map.addControl(new GMapTypeControl());
            map.addControl(new GLargeMapControl());
            map.enableScrollWheelZoom();


            // DrawCircle(new GLatLng(39.88023492849342, 110.225830078125),100);
            GEvent.addListener(map, "click", function (e, point) {
                DrawCircle(point, radius);
                labelMarker(point);
            });


            GEvent.addListener(mycircle, "dblclick", function () {
                alert("adsfasdfasd");
            });


            
            


           


        }
        var circle;
        function DrawCircle(latlng, radius) {
            var d2r = Math.PI / 180;
            var r2d = 180 / Math.PI;
            var Clat = (radius / 3963) * r2d;
            var Clng = Clat / Math.cos(latlng.lat() * d2r);
            var Cpoints = [];
            for (var i = 0; i < 33; i++) {
                var theta = Math.PI * (i / 16);
                Cy = latlng.lat() + (Clat * Math.sin(theta));
                Cx = latlng.lng() + (Clng * Math.cos(theta));
                var P = new GPoint(Cx, Cy);
                Cpoints.push(P);
            }
           circle = new GPolygon(Cpoints, "#0000ff", 1, 0.5, "#0000ff", 0.5);
           map.addOverlay(circle);
           GEvent.addListener(circle, "click", function () {
               map.removeOverlay(mycircle);
               map.removeOverlay(marker);


           });
           GEvent.addListener(circle, "mousedown", function () {
               alert("dasfasdfasd");
           });
           
        }
        
        var marker;
        function labelMarker(point){
        google.maps.LabelMarker = function(latlng, options)
        {
        this.latlng = latlng;
        this.labelText = options.labelText || '';
        this.labelClass = options.labelClass || 'writeb';
        this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
        options.icon = options.icon || getTextIcon();
        google.maps.Marker.apply(this, arguments);
        }
     
        google.maps.LabelMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
     
        google.maps.LabelMarker.prototype.initialize = function(map)
        {
        google.maps.Marker.prototype.initialize.call(this, map);
             
        var label = document.createElement('div');
        label.className = this.labelClass;
        label.innerHTML = this.labelText;
        label.style.position = 'absolute';
        label.style.width = '7px';
        label.style.color="Red";
        map.getPane(G_MAP_MARKER_PANE).appendChild(label);
         
        this.map = map;
        this.label = label;
        }
        google.maps.LabelMarker.prototype.redraw = function(force)
        {
        google.maps.Marker.prototype.redraw.call(this, map);
         
        if(!force)
        {
        return;
        }
        var point = this.map.fromLatLngToDivPixel(this.latlng);
        var z = google.maps.Overlay.getZIndex(this.latlng.lat());
         
        this.label.style.left = (point.x + this.labelOffset.width) + 'px';
        this.label.style.top = (point.y + this.labelOffset.height) + 'px';
        this.label.style.zIndex = z + 1;
        }
     
        google.maps.LabelMarker.prototype.remove = function()
        {
        this.label.parentNode.removeChild(this.label);
        this.label = null;
        google.maps.Marker.prototype.remove.call(this);
        }
        var n= "半径: "+radius;//在这里接收要显示的信息,文字要用双引号""
        function getTextIcon()
        {
        var icon = new google.maps.Icon();
        icon.image = "";
        icon.iconSize = new GSize(70,70 );
        icon.iconAnchor = new GPoint(0, 40);
        icon.infoWindowAnchor = new GPoint(5, 1);
        return icon;
        }
        marker = new google.maps.LabelMarker(point, { labelText:n});//在这加入n
        map.addOverlay(marker);
                         
        }
      
              
         


    </script>
</head>
<body οnlοad="initialize()" οnunlοad="GUnload()">
    <div id="map_canvas" style="width: 90%; height: 90%;    ">
    </div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值