[OpenLayers-Users] about Navigation and Box Control

shane_china xiaying4415139 at 163.com
Sun Aug 16 01:33:36 EDT 2009


Use ZoomBox control is so easy, just like the common control.

var ctl = new OpenLayers.Control.ZoomBox();
map.addControl(ctl);

Please notice that, there are controls who exclude each other, navigation
and zoombox are one of the example. So you should to use Button group for
just active one of these exclusive controls.
That means active navigation, deactive zoombox, active zoombox deactive
navigation.

If you are new openlayers user and want more help, you can add my QQ
642106069, be fine.



莹莹 李 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-tp3435061p3452557.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list