[OpenLayers-Users] about Navigation and Box Control

shane_china xiaying4415139 at 163.com
Fri Aug 14 03:42:54 EDT 2009


I thought, you want to draw box and zoom. Do you notice that there is ZoomBox
Control in OpenLayers?



莹莹 李 wrote:
> 
> 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/
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/about-Navigation-and-Box-Control-tp3435061p3443556.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list