Hi Andrew,
If you want to make a custom control into a reusable control, I would
create a javascript file saying
My.Namespacing.Object.ShiftClickDrag = OpenLayers.Util.extend( ... see
example ...);
And then wrap the ShiftClickDrag in a way similar to any other Control
is wrapped in GWT-OL, but in a separate GWT-OL-Extension lib. For the
latter I can only recommend to look at the code in the Mercurial
repository.
Greetings,
Edwin
2009/10/14 Andrew Mason <an...@en...>:
> Dear Edwin,
> I am attempting to implement the functionality displayed
> here http://www.openlayers.org/dev/examples/custom-control.html
> using openlayers-gwt
> The javascript code is 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_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));
> }
> });
>
> map.addLayer(layer);
> map.addControl(control);
>
> But I'm having difficulty identifying how this can be done using
> openlayers-gwt. Have you any advice you can give me on how to achieve this?
>
> Thank you
>
> Andrew Mason
>
> **************************************************
> Web enabled software design & development
> Andrew Mason
> Director
> Environ-IT Ltd.
> t: 0131 208 1402
> t: 01899 880 200
> m: 07919 967494
> e: an...@en...
>
>
>
>
|