We are using GWT and OpenLayers in several projects making use of the
JSNI.
Until now we could use simple Openlayers js function such as Zoom. It
was clear to me that to use a zoom using JSNI I have to do :

 private static native void _zoomTo(JavaScriptObject map, int
zoomLevel) /*-{
        map.zoomTo(zoomLevel);
    }-*/;

I could do a lot with this simple methods. But now, as complexity is
increasing I would need to use more complex feature of Openlayers.
For example what would be the smartest way to apply those settings to
my map so I can detect double click and get the event to my gwt
application :

       <script src="../OpenLayers.js"></script>
        <script type="text/javascript">
            OpenLayers.Control.Click = OpenLayers.Class
(OpenLayers.Control, {
                defaultHandlerOptions: {
                    'single': false,
                    'double': true,
                    'pixelTolerance': 0,
                    'stopSingle': false,
                    'stopDouble': false
                },

                initialize: function(options) {
                    this.handlerOptions = OpenLayers.Util.extend(
                        {}, this.defaultHandlerOptions
                    );
                    OpenLayers.Control.prototype.initialize.apply(
                        this, arguments
                    );
                    this.handler = new OpenLayers.Handler.Click(
                        this, {
                            'click': this.trigger
                        }, this.handlerOptions
                    );
                },

                trigger: function(e) {
                    var lonlat = map.getLonLatFromViewPortPx(e.xy);
                    alert("You clicked near " + lonlat.lat + " N, " +
                                              + lonlat.lon + " E");
                }

            });

           var map;

            function init(){
                map = new OpenLayers.Map('map');

                var click = new OpenLayers.Control.Click();
                map.addControl(click);
            }
        </script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to