[OpenLayers-Users] about Navigation and Box Control

莹莹 李 azxc_0000 at yahoo.com.cn
Wed Aug 12 21:58:34 EDT 2009


Hi:
      I have a problem,i can't use Navigation Control(OpenLayers.Control.Navigation()) when i have used Box Control like this :
    var control = new OpenLayers.Control();
                OpenLayers.Util.extend(control, {
                    draw: function () {
                        // this Handler.Box will intercept the shift-mousedown
                        // before Control.MouseDefault gets to see it
                        this.box = new OpenLayers.Handler.Box( control,
                            {"done": this.notice},
                            {keyMask: OpenLayers.Handler.MOD_CTRL});
                        this.box.activate();
                    },

                    notice: function (bounds) {
                        var ll = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom)); 
                        var ur = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right, bounds.top)); 
                        var rowlength = document.all("table1").rows.length;
                        for(var i=1; i<rowlength;i++){
                            document.all("table1").rows[i].cells[1].bgColor = "#ffffff";
                            var x = document.all("table1").rows[i].cells[4].innerText;
                            var y = document.all("table1").rows[i].cells[5].innerText;
                            if(x>ll.lon.toFixed(4)&&x<ur.lon.toFixed(4)&&y>ll.lat.toFixed(4)&&y<ur.lat.toFixed(4)){
                            //    alert("sucess");
                                document.all("table1").rows[i].cells[1].bgColor = "#00FFFF";
                            }
                        }
                        alert(ll.lon.toFixed(4) + ", " + 
                              ll.lat.toFixed(4) + ", " + 
                              ur.lon.toFixed(4) + ", " + 
                              ur.lat.toFixed(4));
                    }
                });
  i want them work together,how can i do ? thanks




      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090813/8403e92b/attachment.html


More information about the Users mailing list