[OpenLayers-Users] Map controls properties

Paul Spencer pagameba at gmail.com
Thu Jun 26 15:34:00 EDT 2008


can you not just make 'query' a global variable and reference directly?

var query;

window.onload = function() {
   query = ...
}

function toggleQuery() {
   if (this.value == 'query') {
     query.activate();
   } else {
     query.deactivate();
   }
}

On 26-Jun-08, at 2:20 PM, Ian wrote:

> I'm working off of http://openlayers.org/dev/examples/custom-control.html 
>  and I'd like to send the bbox result to a WMS query for multiple  
> feature selection. I'm using a radio list to let the user switch  
> between zoom and multiple feature query drag box behavior, which  
> activates/deactivates the custom control:
>
> var query = new OpenLayers.Control();
>                 OpenLayers.Util.extend(query, {
>                     draw: function () {
>                         // this Handler.Box will intercept the shift- 
> mousedown
>                         // before Control.MouseDefault gets to see it
>                         this.box = new OpenLayers.Handler.Box(query,
>                             {"done": this.notice},
>                             {keyMask: OpenLayers.Handler.MOD_SHIFT});
>                         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));
>                         alert(ll.lon.toFixed(4) + ", " +
>                               ll.lat.toFixed(4) + ", " +
>                               ur.lon.toFixed(4) + ", " +
>                               ur.lat.toFixed(4));
>                     }
>                 });
>
> function toggleControl (control) {
>   if (control.value == 'query') {
>     map.controls. ? .activate();
>   } else {
>     map.controls. ? .deactivate();
>   }
> }
>
> I looked in the source but didn't see any property such as  
> 'name','value',etc that I could reference in the toggleControl  
> function.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list