Commits

Anonymous committed 43b643b Merge

Merging

Comments (0)

Files changed (16)

gwt-openlayers-client/pom.xml

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.gwtopenmaps.openlayers</groupId>
-		<artifactId>gwt-openlayers</artifactId>
-		<version>0.9-SNAPSHOT</version>
-	</parent>
-	<artifactId>gwt-openlayers-client</artifactId>
-	<name>${project.artifactId}</name>
-	<dependencies>
-		<dependency>
-			<groupId>com.google.gwt</groupId>
-			<artifactId>gwt-user</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-		</dependency>
-	</dependencies>
-	<build>
-		<resources>
-			<resource>
-				<filtering>false</filtering>
-				<directory>${basedir}/src/main/java</directory>
-				<includes>
-					<include>**/*.java</include>
-					<include>**/*.xml</include>
-					<include>**/*.js</include>
-				</includes>
-			</resource>
-		</resources>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.5</source>
-					<target>1.5</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<version>2.4.3</version>
-				<configuration>
-					<excludes>
-						<!-- todo rename *Test.java to *GwtTest.java in the project -->
-						<exclude>**/*Test.java</exclude>
-						<exclude>**/*TestCase.java</exclude>
-					</excludes>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.0.2</version>
-				<configuration>
-					<source>${maven.compiler.source}</source>
-					<target>${maven.compiler.target}</target>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.gwtopenmaps.openlayers</groupId>
+        <artifactId>gwt-openlayers</artifactId>
+        <version>0.9-SNAPSHOT</version>
+    </parent>
+    <artifactId>gwt-openlayers-client</artifactId>
+    <name>${project.artifactId}</name>
+    <dependencies>
+        <dependency>
+            <groupId>com.google.gwt</groupId>
+            <artifactId>gwt-user</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <resources>
+            <resource>
+                <filtering>false</filtering>
+                <directory>${basedir}/src/main/java</directory>
+                <includes>
+                    <include>**/*.java</include>
+                    <include>**/*.xml</include>
+                    <include>**/*.js</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.4.3</version>
+                <configuration>
+                    <excludes>
+                        <!-- todo rename *Test.java to *GwtTest.java in the project -->
+                        <exclude>**/*Test.java</exclude>
+                        <exclude>**/*TestCase.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>${maven.compiler.source}</source>
+                    <target>${maven.compiler.target}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/control/SelectFeature.java

 import org.gwtopenmaps.openlayers.client.event.FeatureUnhighlightedListener;
 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
 import org.gwtopenmaps.openlayers.client.layer.Vector;
+import org.gwtopenmaps.openlayers.client.util.JObjectArray;
 import org.gwtopenmaps.openlayers.client.util.JSObject;
 
 
 
     /**
      *
+     * @param layers
+     */
+    public SelectFeature(Vector[] layers)
+    {
+        this(SelectFeatureImpl.create2((new JObjectArray(layers)).getJSObject()));
+    }
+
+    /**
+     *
      * @param layer
      */
     public SelectFeature(Vector layer, SelectFeatureOptions options)
     }
 
     /**
+     *
+     * @param layers
+     */
+    public SelectFeature(Vector[] layers, SelectFeatureOptions options)
+    {
+        this(SelectFeatureImpl.create2((new JObjectArray(layers)).getJSObject(), options.getJSObject()));
+    }
+
+    /**
      * Select a feature when hovering over it with the mouse (mouse in) and
      * deselect it on mouse out.
      *
     {
         SelectFeatureImpl.setHover(getJSObject(), hover);
     }
+    
+    /**
+     * Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.
+     * @param feature The feature to unselect
+     */
+    public void unSelect(VectorFeature feature)
+    {
+        SelectFeatureImpl.unselect(this.getJSObject(), feature.getJSObject());
+    }
 
     /**
      *

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/control/SelectFeatureImpl.java

         return new $wnd.OpenLayers.Control.SelectFeature(layer);
     }-*/;
 
+    public static native JSObject create2(JSObject layers) /*-{
+        return new $wnd.OpenLayers.Control.SelectFeature($wnd.gwt_openlayers_util.convertToArray(layers));
+    }-*/;
 
     public static native JSObject create(JSObject layer, JSObject options) /*-{
         return new $wnd.OpenLayers.Control.SelectFeature(layer, options);
     }-*/;
 
+    public static native JSObject create2(JSObject layers, JSObject options) /*-{
+        return new $wnd.OpenLayers.Control.SelectFeature($wnd.gwt_openlayers_util.convertToArray(layers), options);
+    }-*/;
+
     public static native void setClickOut(JSObject self, boolean clickout) /*-{
         self.clickout = clickout;
     }-*/;

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/geometry/Point.java

         PointImpl.transform(getJSObject(), source.getJSObject(),
             dest.getJSObject());
     }
+
+    /**
+     * Rotate a point around another.
+     *
+     * @param angle Rotation angle in degrees (measured counterclockwise from
+     *  the positive x-axis).
+     * @param origin Center point for the rotation.
+     */
+    public void rotate(float angle, Point origin)
+    {
+        PointImpl.rotate(getJSObject(), angle, origin.getJSObject());
+    }
+
+    /**
+     * @return The centroid of the point
+     */
+    public Point getCentroid()
+    {
+        return new Point(PointImpl.getCentroid(getJSObject()));
+    }
 }

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/geometry/PointImpl.java

         self.transform(source, dest);
     }-*/;
 
-}
+    public static native void rotate(JSObject self, float angle, JSObject origin) /*-{
+        self.rotate(angle, origin);
+    }-*/;
+
+    public static native JSObject getCentroid(JSObject self) /*-{
+    return self.getCentroid();
+    }-*/;
+}

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/PagingStrategyImpl.java

 {
 
     public static native JSObject create() /*-{
-        return $wnd.OpenLayers.Strategy.Paging();
+        return new $wnd.OpenLayers.Strategy.Paging();
     }-*/;
 
     public static native boolean activate(JSObject self) /*-{

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/RefreshStrategy.java

     {
         RefreshStrategyImpl.refresh(this.getJSObject());
     }
+
+    /**
+     * Force a refresh on the layer, default is false.
+     * @param force True to enable force, false to disable (default)
+     */
+    public void setForce(boolean force)
+    {
+        this.getJSObject().setProperty("force", force);
+    }
 }

gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/RefreshStrategyImpl.java

 {
 
     public static native JSObject create() /*-{
-        return $wnd.OpenLayers.Strategy.Refresh();
+        return new $wnd.OpenLayers.Strategy.Refresh();
     }-*/;
 
     public static native boolean activate(JSObject self) /*-{

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/GwtOpenLayersShowcase.java

 import org.gwtopenmaps.demo.openlayers.client.examples.basictms.BasicTmsExample;
 import org.gwtopenmaps.demo.openlayers.client.examples.custommouseposition.CustomMousePositionExample;
 import org.gwtopenmaps.demo.openlayers.client.examples.graticule.GraticuleExample;
+import org.gwtopenmaps.demo.openlayers.client.examples.location.LocationExample;
+import org.gwtopenmaps.demo.openlayers.client.examples.measure.MeasureExample;
+import org.gwtopenmaps.demo.openlayers.client.examples.vector.VectorExample;
 import org.gwtopenmaps.demo.openlayers.client.examples.wmsfeatureinfo.WmsFeatureInfoExample;
 import org.gwtopenmaps.demo.openlayers.client.examples.wmswfs.WmsWfsExample;
 import org.gwtopenmaps.demo.openlayers.client.examples.wmswfsedit.WmsWfsEditExample;
       examples.add(new ExampleBean(name, "Demonstrates the use of WMS base layer with a WFS overlay that can be edited.", new String[]{"WMS", "WFS", "WFS-T", "WFST", "WFS T", "save", "overlay", "edit", "modify"}, new WmsWfsEditExample(name, I18N.wmsWfsEditExampleSource())));
 
       name = "Basic TMS example";
-      examples.add(new ExampleBean(name, "Demonstrates the use of a TMS layer.", new String[]{"TMS", "basic"}, new BasicTmsExample(name, I18N.noSourceFound())));
+      examples.add(new ExampleBean(name, "Demonstrates the use of a TMS layer.", new String[]{"TMS", "basic"}, new BasicTmsExample(name, I18N.tmsExampleSource())));
 
       name = "Custom mouse position";
-      examples.add(new ExampleBean(name, "Demonstrates how to add a custom mouse position control to the map.", new String[]{"mouse", "position"}, new CustomMousePositionExample(name, I18N.noSourceFound())));
+      examples.add(new ExampleBean(name, "Demonstrates how to add a custom mouse position control to the map.", new String[]{"mouse", "position"}, new CustomMousePositionExample(name, I18N.customMousePostionExampleSource())));
 
       name = "Graticule";
-      examples.add(new ExampleBean(name, "Demonstrates how to add a graticule raster to the map.", new String[]{"graticule", "raster", "control"}, new GraticuleExample(name, I18N.noSourceFound())));
+      examples.add(new ExampleBean(name, "Demonstrates how to add a graticule raster to the map.", new String[]{"graticule", "raster", "control"}, new GraticuleExample(name, I18N.graticuleExampleSource())));
 
       name = "WMS get featuretype example";
-      examples.add(new ExampleBean(name, "Demonstrates how to get feature information from a WMS layer.", new String[]{"WMS", "feature", "featuretype", "get"}, new WmsFeatureInfoExample(name, I18N.noSourceFound())));
-      
+      examples.add(new ExampleBean(name, "Demonstrates how to get feature information from a WMS layer.", new String[]{"WMS", "feature", "featuretype", "get"}, new WmsFeatureInfoExample(name, I18N.wmsFeatureInfoExampleSource())));
+
+      name = "Clickable vector example";
+      examples.add(new ExampleBean(name, "Demonstrates how to add Vector data to the map and make it clickable. Using this you can for example create markers.", new String[]{"marker", "feature", "clickable", "vector", "line"}, new VectorExample(name, I18N.vectorExampleSource())));
+
+      name = "Measure control example";
+      examples.add(new ExampleBean(name, "Demonstrates how to add a measure control.", new String[]{"measure", "control"}, new MeasureExample(name, I18N.measureExampleSource())));
+
+      name = "GPS location example";
+      examples.add(new ExampleBean(name, "Demonstrates how to display the users current location on the map", new String[]{"gps", "location", "osm"}, new LocationExample(name, I18N.gpsExampleSource())));
+
       Collections.sort(examples);
    }
 

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/examples/location/LocationExample.java

+package org.gwtopenmaps.demo.openlayers.client.examples.location;
+
+import org.gwtopenmaps.demo.openlayers.client.InfoPanel;
+import org.gwtopenmaps.demo.openlayers.client.examples.AbstractExample;
+import org.gwtopenmaps.openlayers.client.LonLat;
+import org.gwtopenmaps.openlayers.client.Map;
+import org.gwtopenmaps.openlayers.client.MapOptions;
+import org.gwtopenmaps.openlayers.client.MapWidget;
+import org.gwtopenmaps.openlayers.client.Projection;
+import org.gwtopenmaps.openlayers.client.Style;
+import org.gwtopenmaps.openlayers.client.control.LayerSwitcher;
+import org.gwtopenmaps.openlayers.client.control.OverviewMap;
+import org.gwtopenmaps.openlayers.client.control.ScaleLine;
+import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
+import org.gwtopenmaps.openlayers.client.geometry.Point;
+import org.gwtopenmaps.openlayers.client.layer.OSM;
+import org.gwtopenmaps.openlayers.client.layer.Vector;
+
+import com.google.gwt.core.client.Callback;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.geolocation.client.Geolocation;
+import com.google.gwt.geolocation.client.Position;
+import com.google.gwt.geolocation.client.PositionError;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.HTML;
+
+public class LocationExample extends AbstractExample
+{
+    private static final Projection DEFAULT_PROJECTION = new Projection("EPSG:4326");
+
+    /**
+     * Constructor.
+     *
+     * @param title The title of the example
+     * @param source The source of the example.
+     */
+    public LocationExample(String title, String source)
+    {
+        super(title, source);
+    }
+
+    @Override
+    public void buildPanel()
+    {
+        // create some MapOptions
+        MapOptions defaultMapOptions = new MapOptions();
+        defaultMapOptions.setNumZoomLevels(16);
+
+        // Create a MapWidget and add 2 OSM layers
+        MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);
+        OSM osm_1 = OSM.Mapnik("Mapnik");
+        OSM osm_2 = OSM.CycleMap("CycleMap");
+        osm_1.setIsBaseLayer(true);
+        osm_2.setIsBaseLayer(true);
+        final Map map = mapWidget.getMap();
+        map.addLayer(osm_1);
+        map.addLayer(osm_2);
+
+        // Lets add some default controls to the map
+        map.addControl(new LayerSwitcher()); // + sign in the upperright corner to display the layer switcher
+        map.addControl(new OverviewMap()); // + sign in the lowerright to display the overviewmap
+        map.addControl(new ScaleLine()); // Display the scaleline
+
+        // Center and zoom to a location
+        LonLat lonLat = new LonLat(6.95, 50.94);
+        lonLat.transform(DEFAULT_PROJECTION.getProjectionCode(), map.getProjection()); // transform lonlat to OSM coordinate system
+        map.setCenter(lonLat, 18);
+
+        // Create a marker layer to the current location marker
+        final Vector markerLayer = new Vector("Marker layer");
+        map.addLayer(markerLayer);
+
+        contentPanel.add(new HTML("<p>This example shows how to display a marker on the users current location.</p>" +
+        		"<p>This actually just uses the GWT GeoLocation class and displays a marker on the returned location."));
+        contentPanel.add(new InfoPanel("<p>Don't forget to add the following line to your html file if you want to use OSM :</p>"
+                + "<p><b>&lt;script src=\"http://www.openstreetmap.org/openlayers/OpenStreetMap.js\"&gt;&lt;/script&gt;</b></p>"));
+        contentPanel.add(mapWidget);
+        Button locationButton = new Button("Go to current location", new ClickHandler()
+        {
+            public void onClick(ClickEvent event)
+            {
+                // Start GeoLocation stuff (note that the GeoLocation is just plain GWT stuff)
+                Geolocation geoLocation = Geolocation.getIfSupported();
+                if (geoLocation == null)
+                {
+                    Window.alert("No GeoLocation supprt available in this browser :-(");
+                }
+                else
+                {
+                    final Geolocation.PositionOptions geoOptions = new Geolocation.PositionOptions();
+                    geoOptions.setHighAccuracyEnabled(true);
+
+                    geoLocation.watchPosition(new Callback<Position, PositionError>()
+                    {
+                        public void onFailure(final PositionError reason)
+                        {
+                            Window.alert("Something went wrong fetching the geolocation:\n" + reason);
+                        }
+
+                        public void onSuccess(final Position result)
+                        {
+                            // put the received result in an openlayers LonLat
+                            // object
+                            final LonLat lonLat = new LonLat(result.getCoordinates().getLongitude(), result.getCoordinates().getLatitude());
+                            lonLat.transform(DEFAULT_PROJECTION.getProjectionCode(), map.getProjection()); // transform lonlat to OSM coordinate system
+                            // Center the map on the received location
+                            map.setCenter(lonLat);
+
+                            // lets create a vector point on the location
+                            Style pointStyle = new Style();
+                            pointStyle.setFillColor("red");
+                            pointStyle.setStrokeColor("green");
+                            pointStyle.setStrokeWidth(2);
+                            pointStyle.setFillOpacity(0.9);
+
+                            final Point point = new Point(result.getCoordinates().getLongitude(), result.getCoordinates().getLatitude());
+                            point.transform(DEFAULT_PROJECTION, new Projection(map.getProjection())); // transform point to OSM coordinate system
+                            final VectorFeature pointFeature = new VectorFeature(point, pointStyle);
+                            markerLayer.destroyFeatures();
+                            markerLayer.addFeature(pointFeature);
+                        }
+                    }, geoOptions);
+                }
+            }
+        });
+        contentPanel.add(locationButton);
+
+        initWidget(contentPanel);
+
+        mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); // force the map to fall behind popups
+    }
+}

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/examples/measure/MeasureExample.java

+package org.gwtopenmaps.demo.openlayers.client.examples.measure;
+
+import org.gwtopenmaps.demo.openlayers.client.examples.AbstractExample;
+import org.gwtopenmaps.openlayers.client.LonLat;
+import org.gwtopenmaps.openlayers.client.Map;
+import org.gwtopenmaps.openlayers.client.MapOptions;
+import org.gwtopenmaps.openlayers.client.MapWidget;
+import org.gwtopenmaps.openlayers.client.OpenLayers;
+import org.gwtopenmaps.openlayers.client.Projection;
+import org.gwtopenmaps.openlayers.client.control.LayerSwitcher;
+import org.gwtopenmaps.openlayers.client.control.Measure;
+import org.gwtopenmaps.openlayers.client.control.MeasureOptions;
+import org.gwtopenmaps.openlayers.client.control.OverviewMap;
+import org.gwtopenmaps.openlayers.client.control.ScaleLine;
+import org.gwtopenmaps.openlayers.client.event.MeasureEvent;
+import org.gwtopenmaps.openlayers.client.event.MeasureListener;
+import org.gwtopenmaps.openlayers.client.handler.PathHandler;
+import org.gwtopenmaps.openlayers.client.layer.TransitionEffect;
+import org.gwtopenmaps.openlayers.client.layer.WMS;
+import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
+import org.gwtopenmaps.openlayers.client.layer.WMSParams;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.HTML;
+
+public class MeasureExample extends AbstractExample
+{
+   /**
+    * Constructor.
+    * @param title The title of the example
+    * @param source The source of the example.
+    */
+   public MeasureExample(String title, String source)
+   {
+      super(title, source);
+   }
+
+   @Override
+   public void buildPanel()
+   {
+       OpenLayers.setProxyHost("olproxy?targetURL=");
+
+      //create some MapOptions
+      MapOptions defaultMapOptions = new MapOptions();
+      defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format
+      defaultMapOptions.setNumZoomLevels(16);
+
+      //Create a MapWidget
+      MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);
+      //Create a WMS layer as base layer
+      WMSParams wmsParams = new WMSParams();
+      wmsParams.setFormat("image/png");
+      wmsParams.setLayers("basic");
+      wmsParams.setStyles("");
+
+      WMSOptions wmsLayerParams = new WMSOptions();
+      wmsLayerParams.setUntiled();
+      wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
+
+      String wmsUrl = "http://labs.metacarta.com/wms/vmap0";
+
+      WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);
+
+      //Add the WMS to the map
+      Map map = mapWidget.getMap();
+      map.addLayer(wmsLayer);
+
+      //Add a measure control to the map
+      MeasureOptions measOpts = new MeasureOptions();
+      measOpts.setPersist(true);
+      measOpts.setGeodesic(true); //earth is not a cylinder
+      Measure measure = new Measure(new PathHandler(), measOpts);
+      map.addControl(measure);
+
+      measure.addMeasureListener(new MeasureListener()
+      {
+         public void onMeasure(MeasureEvent eventObject)
+         {
+            Window.alert("Measured distance is " + eventObject.getMeasure() + " " + eventObject.getUnits() );
+         }
+      });
+      measure.activate();
+
+      //Lets add some default controls to the map
+      map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
+      map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap
+      map.addControl(new ScaleLine()); //Display the scaleline
+
+      //Center and zoom to a location
+      map.setCenter(new LonLat(146.7, -41.8), 6);
+
+      contentPanel.add(new HTML("<p>This example shows how to add a Measure Control to the map.</p><p>Click on the map to add measure points, end a measurement using double click.</p><p>Note that you could add buttons to enable/disable the measure control on command.</p>"));
+      contentPanel.add(mapWidget);
+
+      initWidget(contentPanel);
+
+      mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
+   }
+}

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/examples/vector/VectorExample.java

+package org.gwtopenmaps.demo.openlayers.client.examples.vector;
+
+import org.gwtopenmaps.demo.openlayers.client.examples.AbstractExample;
+import org.gwtopenmaps.openlayers.client.LonLat;
+import org.gwtopenmaps.openlayers.client.Map;
+import org.gwtopenmaps.openlayers.client.MapOptions;
+import org.gwtopenmaps.openlayers.client.MapWidget;
+import org.gwtopenmaps.openlayers.client.OpenLayers;
+import org.gwtopenmaps.openlayers.client.Projection;
+import org.gwtopenmaps.openlayers.client.Style;
+import org.gwtopenmaps.openlayers.client.control.LayerSwitcher;
+import org.gwtopenmaps.openlayers.client.control.OverviewMap;
+import org.gwtopenmaps.openlayers.client.control.ScaleLine;
+import org.gwtopenmaps.openlayers.client.control.SelectFeature;
+import org.gwtopenmaps.openlayers.client.event.VectorFeatureSelectedListener;
+import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
+import org.gwtopenmaps.openlayers.client.geometry.LineString;
+import org.gwtopenmaps.openlayers.client.geometry.Point;
+import org.gwtopenmaps.openlayers.client.layer.TransitionEffect;
+import org.gwtopenmaps.openlayers.client.layer.Vector;
+import org.gwtopenmaps.openlayers.client.layer.WMS;
+import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
+import org.gwtopenmaps.openlayers.client.layer.WMSParams;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.HTML;
+
+public class VectorExample extends AbstractExample
+{
+   /**
+    * Constructor.
+    * @param title The title of the example
+    * @param source The source of the example.
+    */
+   public VectorExample(String title, String source)
+   {
+      super(title, source);
+   }
+
+   @Override
+   public void buildPanel()
+   {
+       OpenLayers.setProxyHost("olproxy?targetURL=");
+
+      //create some MapOptions
+      MapOptions defaultMapOptions = new MapOptions();
+      defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format
+      defaultMapOptions.setNumZoomLevels(16);
+
+      //Create a MapWidget
+      MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);
+      //Create a WMS layer as base layer
+      WMSParams wmsParams = new WMSParams();
+      wmsParams.setFormat("image/png");
+      wmsParams.setLayers("basic");
+      wmsParams.setStyles("");
+
+      WMSOptions wmsLayerParams = new WMSOptions();
+      wmsLayerParams.setUntiled();
+      wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
+
+      String wmsUrl = "http://labs.metacarta.com/wms/vmap0";
+
+      WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);
+
+      //Add the WMS to the map
+      Map map = mapWidget.getMap();
+      map.addLayer(wmsLayer);
+
+      //Add a clickable vectors to the map
+
+      //create a layer to add the vectors to
+      final Vector vectorLayer = new Vector("Vectorlayer");
+      map.addLayer(vectorLayer);
+
+      //SelectFeature control to capture clicks on the vectors
+      SelectFeature selectFeature = new SelectFeature(vectorLayer);
+      selectFeature.setAutoActivate(true);
+      map.addControl(selectFeature);
+
+      //Define a style for the vectors
+      Style pointStyle = new Style();
+      pointStyle.setFillColor("red");
+      pointStyle.setStrokeColor("green");
+      pointStyle.setStrokeWidth(2);
+      pointStyle.setFillOpacity(0.9);
+      /* or if you want to use an image
+      pointStyle.setExternalGraphic("http://photo-dictionary.com/photofiles/list/3020/4043yellow_marker.jpg");
+      pointStyle.setGraphicSize(50, 50);
+      */
+
+      //Add a point
+      Point point = new Point(146.7, -41.8);
+      VectorFeature pointFeature = new VectorFeature(point, pointStyle);
+      vectorLayer.addFeature(pointFeature);
+
+      //Add a line
+      Point[] linePoints = {new Point(145, -40), new Point(147, 42)};
+      LineString ls = new LineString(linePoints);
+      vectorLayer.addFeature(new VectorFeature(ls, pointStyle));
+
+      //capture clicks on the vectorlayer
+      vectorLayer.addVectorFeatureSelectedListener(new VectorFeatureSelectedListener()
+      {
+
+        public void onFeatureSelected(FeatureSelectedEvent eventObject)
+        {
+            Window.alert("clicked on a vector");
+        }
+      });
+
+      //Lets add some default controls to the map
+      map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
+      map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap
+      map.addControl(new ScaleLine()); //Display the scaleline
+
+      //Center and zoom to a location
+      map.setCenter(new LonLat(146.7, -41.8), 6);
+
+      contentPanel.add(new HTML("<p>This example shows how to add a Vector marker, and a line to the map.</p><p>Note that you can also use the Marker class to add markers, but it is advised to use this method instead."));
+      contentPanel.add(mapWidget);
+
+      initWidget(contentPanel);
+
+      mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
+   }
+}

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/i18n/I18NMessages.java

    String basicGoogleV2ExampleSource();
    String wmsWfsExampleSource();
    String wmsWfsEditExampleSource();
+   String tmsExampleSource();
+   String customMousePostionExampleSource();
+   String graticuleExampleSource();
+   String wmsFeatureInfoExampleSource();
+   String vectorExampleSource();
+   String measureExampleSource();
+   String gpsExampleSource();
 }

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/i18n/I18NMessages.properties

 filterByKeywords = Filter by keywords...
 tags = Tags: {0}
 viewSource = View source
-noSourceFound = No source was found for this example :-(
+noSourceFound = No sourcecode was found for this example :-(
 
 #====================================================================================================================================================
 #Source codes for all examples
 #====================================================================================================================================================
 #Basic OSM
 #====================================================================================================================================================
-basicOsmExampleSource = private static final Projection DEFAULT_PROJECTION = new Projection("EPSG:4326");\n\ 
+basicOsmExampleSource = private static final Projection DEFAULT_PROJECTION = new Projection("EPSG:4326");\n\
 //create some MapOptions\n\
 MapOptions defaultMapOptions = new MapOptions();\n\
 defaultMapOptions.setNumZoomLevels(16);\n\
 \n\
 initWidget(contentPanel);\n\
 \n\
-mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups\n\
+mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
 
+#====================================================================================================================================================
+#TMS example
+#====================================================================================================================================================
+tmsExampleSource =  /**\n\
+* \n\
+* @return TMS URL for OSM cyclemap\n\
+*/\n\
+private static native JSObject getMyUrl()\n\
+/*-&#123;\n\
+&nbsp;&nbsp;&nbsp;function get_my_url(bounds) &#123;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var res = this.map.getResolution();\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var z = this.map.getZoom();\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var limit = 100000000;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var i = 0;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var dir_x = x;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var dir_y = y;\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (i = z; i > 9; i--) &#123;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dir_x = (Math.floor(dir_x / 2.0));\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dir_y = (Math.floor(dir_y / 2.0));\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var path = "9_" + dir_x + "_" + dir_y + "/jpg";\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (y < 0 || y >= limit) &#123;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "http://imageatlas.digitalglobe.com/ia-webapp/img/noImage.gif"\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; else &#123;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;limit = Math.pow(2, z);\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x = ((x % limit) + limit) % limit;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y = ((y % limit) + limit) % limit;\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var url = "http://a.tile.opencyclemap.org/cycle/" + z + "/" + x + "/" + y + ".png";\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;\n\
+&nbsp;&nbsp;&nbsp;&#125;\n\
+\n\
+&nbsp;&nbsp;&nbsp;return get_my_url;\n\
+&#125;-*/;\n\
+\n\
+@Override\n\
+public void buildPanel()\n\
+&#123;\n\
+&nbsp;&nbsp;&nbsp;//create some MapOptions\n\
+&nbsp;&nbsp;&nbsp;MapOptions defaultMapOptions = new MapOptions();\n\
+&nbsp;&nbsp;&nbsp;defaultMapOptions.setNumZoomLevels(21);\n\
+&nbsp;&nbsp;&nbsp;//specify bounds, projection, resolution, maxextent for TMS\n\
+&nbsp;&nbsp;&nbsp;defaultMapOptions.setProjection("EPSG:900913");\n\
+&nbsp;&nbsp;&nbsp;defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326"));\n\
+&nbsp;&nbsp;&nbsp;defaultMapOptions.setUnits("m");\n\
+&nbsp;&nbsp;&nbsp;defaultMapOptions.setMaxResolution(156543.0339f);\n\
+&nbsp;&nbsp;&nbsp;defaultMapOptions.setMaxExtent(new Bounds(-20037508, -20037508, 20037508, 20037508.34));\n\
+\n\
+&nbsp;&nbsp;&nbsp;//Create a MapWidget\n\
+&nbsp;&nbsp;&nbsp;MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+\n\
+&nbsp;&nbsp;&nbsp;//Create TMS layer\n\
+&nbsp;&nbsp;&nbsp;TMSOptions tmsOptions = new TMSOptions();\n\
+&nbsp;&nbsp;&nbsp;tmsOptions.setDisplayOutsideMaxExtent(false);\n\
+&nbsp;&nbsp;&nbsp;tmsOptions.setIsBaseLayer(true);\n\
+&nbsp;&nbsp;&nbsp;tmsOptions.setType("jpg");\n\
+&nbsp;&nbsp;&nbsp;tmsOptions.setGetURL(getMyUrl());\n\
+\n\
+&nbsp;&nbsp;&nbsp;TMS tms = new TMS("TMS", "", tmsOptions);\n\
+\n\
+&nbsp;&nbsp;&nbsp;//And add them to the map\n\
+&nbsp;&nbsp;&nbsp;Map map = mapWidget.getMap();\n\
+&nbsp;&nbsp;&nbsp;map.addLayer(tms);\n\
+\n\
+&nbsp;&nbsp;&nbsp;//Lets add some default controls to the map\n\
+&nbsp;&nbsp;&nbsp;map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher\n\
+&nbsp;&nbsp;&nbsp;map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap\n\
+&nbsp;&nbsp;&nbsp;map.addControl(new ScaleLine()); //Display the scaleline\n\
+\n\
+&nbsp;&nbsp;&nbsp;//Center and zoom to a location\n\
+&nbsp;&nbsp;&nbsp;LonLat lonLat = new LonLat(6.95, 50.94);\n\
+&nbsp;&nbsp;&nbsp;lonLat.transform(DEFAULT_PROJECTION.getProjectionCode() , map.getProjection()); //transform lonlat to OSM coordinate system\n\
+&nbsp;&nbsp;&nbsp;map.setCenter(lonLat, 12);\n\
+\n\
+&nbsp;&nbsp;&nbsp;contentPanel.add(new HTML("<p>This example shows how to add a TMS layer to GWT-OL.</p>"));\n\
+&nbsp;&nbsp;&nbsp;contentPanel.add(mapWidget);\n\
+\n\
+&nbsp;&nbsp;&nbsp;map.zoomToMaxExtent();\n\
+\n\
+&#125;
+
+#====================================================================================================================================================
+#Custom mouse position example
+#====================================================================================================================================================
+customMousePostionExampleSource = //create some MapOptions\n\
+MapOptions defaultMapOptions = new MapOptions();\n\
+defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format\n\
+defaultMapOptions.setNumZoomLevels(16);\n\
+\n\
+//Create a MapWidget\n\
+MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+//Create a WMS layer as base layer\n\
+WMSParams wmsParams = new WMSParams();\n\
+wmsParams.setFormat("image/png");\n\
+wmsParams.setLayers("basic");\n\
+wmsParams.setStyles("");\n\
+\n\
+WMSOptions wmsLayerParams = new WMSOptions();\n\
+wmsLayerParams.setUntiled();\n\
+wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);\n\
+\n\
+String wmsUrl = "http://labs.metacarta.com/wms/vmap0";\n\
+WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);\n\
+\n\
+//Add the WMS to the map\n\
+Map map = mapWidget.getMap();\n\
+map.addLayer(wmsLayer);\n\
+\n\
+//Adds the custom mouse position to the map\n\
+MousePositionOutput mpOut = new MousePositionOutput()\n\
+&#123;\n\
+&nbsp;&nbsp;&nbsp;public String format(LonLat lonLat, Map map)\n\
+&nbsp;&nbsp;&nbsp;&#123;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String out = "";\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out += "<b>This is the longitude </b> ";\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out += lonLat.lon();\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out += "<b>, and this the latitude</b> ";\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out += lonLat.lat();\n\
+&nbsp;&nbsp;&nbsp;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return out;\n\
+&nbsp;&nbsp;&nbsp;&#125;\n\
+\n\
+&#125;;\n\
+\n\
+MousePositionOptions mpOptions = new MousePositionOptions();\n\
+mpOptions.setFormatOutput(mpOut); // rename to setFormatOutput\n\
+\n\
+map.addControl(new MousePosition(mpOptions));\n\
+\n\
+//Lets add some default controls to the map\n\
+map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher\n\
+map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap\n\
+map.addControl(new ScaleLine()); //Display the scaleline\n\
+\n\
+//Center and zoom to a location\n\
+map.setCenter(new LonLat(146.7, -41.8), 6);
+
+#====================================================================================================================================================
+#Graticule example
+#====================================================================================================================================================
+graticuleExampleSource = //create some MapOptions\n\
+MapOptions defaultMapOptions = new MapOptions();\n\
+defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format\n\
+defaultMapOptions.setNumZoomLevels(16);\n\
+\n\
+//Create a MapWidget\n\
+MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+//Create a WMS layer as base layer\n\
+WMSParams wmsParams = new WMSParams();\n\
+wmsParams.setFormat("image/png");\n\
+wmsParams.setLayers("basic");\n\
+wmsParams.setStyles("");\n\
+\n\
+WMSOptions wmsLayerParams = new WMSOptions();\n\
+wmsLayerParams.setUntiled();\n\
+wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);\n\
+\n\
+String wmsUrl = "http://labs.metacarta.com/wms/vmap0";\n\
+\n\
+WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);\n\
+\n\
+//Add the WMS to the map\n\
+Map map = mapWidget.getMap();\n\
+map.addLayer(wmsLayer);\n\
+\n\
+//Adds the graticule control\n\
+LineSymbolizerOptions lineOptions = new LineSymbolizerOptions();\n\
+lineOptions.setStrokeColor("#ccccff");\n\
+lineOptions.setStrokeOpacity(0.5);\n\
+lineOptions.setStrokeWidth(1);\n\
+\n\
+LineSymbolizer line = new LineSymbolizer(lineOptions);\n\
+\n\
+TextSymbolizerOptions textOptions = new TextSymbolizerOptions();\n\
+textOptions.setFontSize("9px");\n\
+\n\
+TextSymbolizer text = new TextSymbolizer(textOptions);\n\
+\n\
+final GraticuleOptions grtOptions = new GraticuleOptions();\n\
+\n\
+grtOptions.setTargetSize(200);\n\
+grtOptions.setLabelled(true);\n\
+grtOptions.setLineSymbolyzer(line);\n\
+grtOptions.setLabelSymbolizer(text);\n\
+Graticule graticule = new Graticule(grtOptions);\n\
+\n\
+graticule.setAutoActivate(true);\n\
+\n\
+map.addControl(graticule);\n\
+\n\
+//Lets add some default controls to the map\n\
+map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher\n\
+map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap\n\
+map.addControl(new ScaleLine()); //Display the scaleline\n\
+\n\
+//Center and zoom to a location\n\
+map.setCenter(new LonLat(146.7, -41.8), 6);
+
+#====================================================================================================================================================
+#WMS get feature info example
+#====================================================================================================================================================
+wmsFeatureInfoExampleSource = //create some MapOptions\n\
+MapOptions defaultMapOptions = new MapOptions();\n\
+defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format\n\
+defaultMapOptions.setNumZoomLevels(16);\n\
+\n\
+//Create a MapWidget\n\
+MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+//Create a WMS layer as base layer\n\
+WMSParams wmsParams = new WMSParams();\n\
+wmsParams.setFormat("image/png");\n\
+wmsParams.setLayers("topp:tasmania_state_boundaries");\n\
+wmsParams.setStyles("");\n\
+\n\
+WMSOptions wmsLayerParams = new WMSOptions();\n\
+wmsLayerParams.setUntiled();\n\
+wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);\n\
+\n\
+String wmsUrl = "http://demo.opengeo.org/geoserver/wms";\n\
+\n\
+WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);\n\
+\n\
+//Add the WMS to the map\n\
+Map map = mapWidget.getMap();\n\
+map.addLayer(wmsLayer);\n\
+\n\
+//Adds the WMSGetFeatureInfo control\n\
+WMSGetFeatureInfoOptions wmsGetFeatureInfoOptions = new WMSGetFeatureInfoOptions();\n\
+wmsGetFeatureInfoOptions.setMaxFeaturess(50);\n\
+wmsGetFeatureInfoOptions.setLayers(new WMS[] &#123;wmsLayer&#125;);\n\
+wmsGetFeatureInfoOptions.setDrillDown(true);\n\
+//to request a GML string instead of HTML : wmsGetFeatureInfoOptions.setInfoFormat(GetFeatureInfoFormat.GML.toString());\n\
+\n\
+WMSGetFeatureInfo wmsGetFeatureInfo = new WMSGetFeatureInfo(wmsGetFeatureInfoOptions);\n\
+\n\
+wmsGetFeatureInfo.addGetFeatureListener(new GetFeatureInfoListener()\n\
+&#123;\n\
+&nbsp;&nbsp;&nbsp;public void onGetFeatureInfo(GetFeatureInfoEvent eventObject)\n\
+&nbsp;&nbsp;&nbsp;&#123;\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//if you did a wmsGetFeatureInfoOptions.setInfoFormat(GetFeatureInfoFormat.GML.toString()) you can do a VectorFeature[] features = eventObject.getFeatures(); here\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DialogBoxWithCloseButton db = new DialogBoxWithCloseButton();\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTML html = new HTML(eventObject.getText());\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db.setWidget(html);\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;db.center();\n\
+&nbsp;&nbsp;&nbsp;&#125;\n\
+&#125;);\n\
+map.addControl(wmsGetFeatureInfo);\n\
+wmsGetFeatureInfo.activate();\n\
+//Lets add some default controls to the map\n\
+map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher\n\
+map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap\n\
+map.addControl(new ScaleLine()); //Display the scaleline\n\
+\n\
+//Center and zoom to a location\n\
+map.setCenter(new LonLat(146.7, -41.8), 6);
+
+#====================================================================================================================================================
+#Vector example
+#====================================================================================================================================================
+vectorExampleSource = //create some MapOptions\n\
+MapOptions defaultMapOptions = new MapOptions();\n\
+defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format\n\
+defaultMapOptions.setNumZoomLevels(16);\n\
+\n\
+//Create a MapWidget\n\
+MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+//Create a WMS layer as base layer\n\
+WMSParams wmsParams = new WMSParams();\n\
+wmsParams.setFormat("image/png");\n\
+wmsParams.setLayers("basic");\n\
+wmsParams.setStyles("");\n\
+\n\
+WMSOptions wmsLayerParams = new WMSOptions();\n\
+wmsLayerParams.setUntiled();\n\
+wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);\n\
+\n\
+String wmsUrl = "http://labs.metacarta.com/wms/vmap0";\n\
+\n\
+WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);\n\
+\n\
+//Add the WMS to the map\n\
+Map map = mapWidget.getMap();\n\
+map.addLayer(wmsLayer);\n\
+\n\
+//Add a clickable marker to the map, the marker is actually a Vector\n\
+\n\
+//create a layer to add the marker to\n\
+final Vector vectorLayer = new Vector("Markerlayer");\n\
+map.addLayer(vectorLayer);\n\
+\n\
+//SelectFeature control to capture clicks on the marker\n\
+SelectFeature selectFeature = new SelectFeature(vectorLayer);\n\
+selectFeature.setAutoActivate(true);\n\
+map.addControl(selectFeature);\n\
+\n\
+//Define a style for the marker\n\
+Style pointStyle = new Style();\n\
+pointStyle.setFillColor("red");\n\
+pointStyle.setStrokeColor("green");\n\
+pointStyle.setStrokeWidth(2);\n\
+pointStyle.setFillOpacity(0.9);\n\
+/* or if you want to use an image\n\
+pointStyle.setExternalGraphic("http://photo-dictionary.com/photofiles/list/3020/4043yellow_marker.jpg");\n\
+pointStyle.setGraphicSize(50, 50);\n\
+*/\n\
+\n\
+//Add a point\n\
+Point point = new Point(146.7, -41.8);\n\
+VectorFeature pointFeature = new VectorFeature(point, pointStyle);\n\
+vectorLayer.addFeature(pointFeature);\n\
+\n\
+//Add a line\n\
+Point[] linePoints = {new Point(145, -40), new Point(147, 42)};\n\
+LineString ls = new LineString(linePoints);\n\
+vectorLayer.addFeature(new VectorFeature(ls, pointStyle));\n\
+\n\
+//capture clicks on the vectorlayer\n\
+vectorLayer.addVectorFeatureSelectedListener(new VectorFeatureSelectedListener()\n\
+{\n\
+\n\
+public void onFeatureSelected(FeatureSelectedEvent eventObject)\n\
+{\n\
+Window.alert("clicked on a vector");\n\
+}\n\
+});\n\
+\n\
+//Lets add some default controls to the map\n\
+map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher\n\
+map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap\n\
+map.addControl(new ScaleLine()); //Display the scaleline\n\
+\n\
+//Center and zoom to a location\n\
+map.setCenter(new LonLat(146.7, -41.8), 6);
+
+#====================================================================================================================================================
+#Measure example
+#====================================================================================================================================================
+measureExampleSource = //create some MapOptions\n\
+MapOptions defaultMapOptions = new MapOptions();\n\
+defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326")); //causes the mouse popup to display coordinates in this format\n\
+defaultMapOptions.setNumZoomLevels(16);\n\
+\n\
+//Create a MapWidget\n\
+MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+//Create a WMS layer as base layer\n\
+WMSParams wmsParams = new WMSParams();\n\
+wmsParams.setFormat("image/png");\n\
+wmsParams.setLayers("basic");\n\
+wmsParams.setStyles("");\n\
+\n\
+WMSOptions wmsLayerParams = new WMSOptions();\n\
+wmsLayerParams.setUntiled();\n\
+wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);\n\
+\n\
+String wmsUrl = "http://labs.metacarta.com/wms/vmap0";\n\
+\n\
+WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);\n\
+\n\
+//Add the WMS to the map\n\
+Map map = mapWidget.getMap();\n\
+map.addLayer(wmsLayer);\n\
+\n\
+//Add a measure control to the map\n\
+MeasureOptions measOpts = new MeasureOptions();\n\
+measOpts.setPersist(true);\n\
+measOpts.setGeodesic(true); //earth is not a cylinder\n\
+Measure measure = new Measure(new PathHandler(), measOpts);\n\
+map.addControl(measure);\n\
+\n\
+measure.addMeasureListener(new MeasureListener()\n\
+&#123\n\
+&nbsp;&nbsp;&nbsp;public void onMeasure(MeasureEvent eventObject)\n\
+&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Window.alert("Measured distance is " + eventObject.getMeasure() + " " + eventObject.getUnits() );\n\
+&nbsp;&nbsp;&nbsp;&#125\n\
+&#125);\n\
+measure.activate();\n\
+//Lets add some default controls to the map\n\
+map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher\n\
+map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap\n\
+map.addControl(new ScaleLine()); //Display the scaleline\n\
+\n\
+//Center and zoom to a location\n\
+map.setCenter(new LonLat(146.7, -41.8), 6);
+
+#====================================================================================================================================================
+#Gps example
+#====================================================================================================================================================
+gpsExampleSource = create some MapOptions\n\
+MapOptions defaultMapOptions = new MapOptions();\n\
+defaultMapOptions.setNumZoomLevels(16);\n\
+\n\
+// Create a MapWidget and add 2 OSM layers\n\
+MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);\n\
+OSM osm_1 = OSM.Mapnik("Mapnik");\n\
+OSM osm_2 = OSM.CycleMap("CycleMap");\n\
+osm_1.setIsBaseLayer(true);\n\
+osm_2.setIsBaseLayer(true);\n\
+final Map map = mapWidget.getMap();\n\
+map.addLayer(osm_1);\n\
+map.addLayer(osm_2);\n\
+\n\
+// Lets add some default controls to the map\n\
+map.addControl(new LayerSwitcher()); // + sign in the upperright corner to display the layer switcher\n\
+map.addControl(new OverviewMap()); // + sign in the lowerright to display the overviewmap\n\
+map.addControl(new ScaleLine()); // Display the scaleline\n\
+\n\
+// Center and zoom to a location\n\
+LonLat lonLat = new LonLat(6.95, 50.94);\n\
+lonLat.transform(DEFAULT_PROJECTION.getProjectionCode(), map.getProjection()); // transform lonlat to OSM coordinate system\n\
+map.setCenter(lonLat, 18);\n\
+\n\
+// Create a marker layer to the current location marker\n\
+final Vector markerLayer = new Vector("Marker layer");\n\
+map.addLayer(markerLayer);\n\
+\n\
+contentPanel.add(new HTML("<p>This example shows how to display a marker on the users current GPS location.</p>" +\n\
+"<p>This actually just uses the GWT GeoLocation class and displays a marker on the returned location."));\n\
+contentPanel.add(new InfoPanel("<p>Don''t forget to add the following line to your html file if you want to use OSM :</p>"\n\
++ "<p><b>&lt;script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"&gt;&lt;/script&gt;</b></p>"));\n\
+contentPanel.add(mapWidget);\n\
+Button gpsButton = new Button("Go to current GPS location", new ClickHandler()\n\
+&#123\n\
+&nbsp;&nbsp;&nbsp;public void onClick(ClickEvent event)\n\
+&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Start GeoLocation stuff (note that the GeoLocation is just plain GWT stuff)\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Geolocation geoLocation = Geolocation.getIfSupported();\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (geoLocation == null)\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Window.alert("No GPS supprt available in this browser :-(");\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;final Geolocation.PositionOptions geoOptions = new Geolocation.PositionOptions();\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geoOptions.setHighAccuracyEnabled(true);\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geoLocation.watchPosition(new Callback<Position, PositionError>()\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void onFailure(final PositionError reason)\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Window.alert("Something went wrong fetching the geolocation:\n" + reason);\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void onSuccess(final Position result)\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// put the received result in an openlayers LonLat\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// object\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;final LonLat lonLat = new LonLat(result.getCoordinates().getLongitude(), result.getCoordinates().getLatitude());\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lonLat.transform(DEFAULT_PROJECTION.getProjectionCode(), map.getProjection()); // transform lonlat to OSM coordinate system\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Center the map on the received location\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.setCenter(lonLat);\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// lets create a vector point on the location\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Style pointStyle = new Style();\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pointStyle.setFillColor("red");\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pointStyle.setStrokeColor("green");\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pointStyle.setStrokeWidth(2);\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pointStyle.setFillOpacity(0.9);\n\
+\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;final Point point = new Point(result.getCoordinates().getLongitude(), result.getCoordinates().getLatitude());\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point.transform(DEFAULT_PROJECTION, new Projection(map.getProjection())); // transform point to OSM coordinate system\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;final VectorFeature pointFeature = new VectorFeature(point, pointStyle);\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;markerLayer.destroyFeatures();\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;markerLayer.addFeature(pointFeature);\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125, geoOptions);\n\
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125\n\
+&nbsp;&nbsp;&nbsp;&#125\n\
+&#125);\n\
+contentPanel.add(gpsButton);

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/server/GwtOpenLayersProxyServlet.java

-package org.gwtopenmaps.demo.openlayers.server;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-
-/**
- * This is a transparent HTTP proxy written in Java that is similar to the proxy in
- * the OpenLayers examples, which is written in Python. These proxies are used
- * to circumvent browser restrictions on cross-domain requests with Javascript.
- * <p>
- * To use the proxy you need to 1) configure the proxy servlet in your web.xml
- * and 2) use OpenLayers.setProxyHost to set the url-path to the proxy. If the
- * proxy is configured to listen to the url-pattern '/gwtOpenLayersProxy/*' then
- * the proxy host should be set to 'gwtOpenLayersProxy?targetURL='.
- * </p>
- * Initial code for this proxy is based upon <a href=
- * "http://trac.openlayers.org/changeset/8099/sandbox?format=diff&new=8099">the
- * following code</a><br />
- * see also <a href=
- * "http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html"
- * title="this networking tutorial">this networking tutorial</a>
- * <p>
- *
- * @author gwtol/John Doe
- */
-public class GwtOpenLayersProxyServlet extends HttpServlet
-{
-    private static final long serialVersionUID = -5577804552108661723L;
-
-    @Override
-    /*
-     * (non-Javadoc)
-     * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-     */
-    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
-    {
-        processRequest(request, response);
-    }
-
-    @Override
-    /*
-     * (non-Javadoc)
-     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-     */
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
-    {
-        processRequest(request, response);
-    }
-
-    /**
-     *
-     * @param request req
-     * @param response res
-     * @throws ServletException se
-     * @throws IOException ioe
-     */
-    private void processRequest(HttpServletRequest request,
-        HttpServletResponse response) throws ServletException, IOException
-    {
-        HttpURLConnection connection = null;
-        InputStream istream = null; // input to proxy
-        OutputStream ostream = null; // output from proxy
-        InputStream connectionIstream = null; // output for the target is input for the connection
-        OutputStream connectionOstream = null; // input for the target is output for the connection
-
-        String remoteHost = request.getRemoteHost(); // get host address of client - for checking allowedHosts
-        boolean allowedHost = isAllowedHost(remoteHost); // The allowedHosts are the hosts that are allowed to use the Open Proxy.
-
-        try
-        {
-            // easy way to ignore case of param?
-            if ((request.getParameter("targetURL") != null) && (request.getParameter("targetURL") != "") && allowedHost)
-            {
-                // HTTPUrlConnection looks at http.proxyHost and http.proxyPort system properties.
-                // Make sure these properties are set these if you are behind a proxy.
-
-                // step 1: initialize
-                String requestMethod = request.getMethod();
-
-                URL targetURL = new URL(request.getParameter("targetURL"));
-                connection = (HttpURLConnection) targetURL.openConnection();
-                connection.setRequestMethod(requestMethod);
-                transferHTTPRequestHeaders(connection, request);
-
-                // step 2: proxy requests
-                if (requestMethod.equals("GET"))
-                {
-                    // default for setDoInput is true
-                    connectionIstream = connection.getInputStream();
-                }
-
-                if (requestMethod.equals("POST"))
-                {
-                    transferHTTPRequestHeadersForPOST(connection, request);
-
-                    int clength = request.getContentLength(); // clength is for checking if there is a POST body. Is that sufficient?
-
-                    if (clength > 0)
-                    {
-                        istream = request.getInputStream();
-                        connection.setDoOutput(true); // for POST we need to write to connection
-                        connection.setRequestProperty("Content-Length", Integer.toString(clength)); // only valid for POST request
-                        connectionOstream = connection.getOutputStream();
-
-                        // copy the request body to remote outputStream
-                        copy(istream, connectionOstream);
-                    }
-
-                    connectionIstream = connection.getInputStream();
-                }
-
-                // step 3: return output
-                // can output be the same for GET/POST? or different return headers?
-                // servlet may return 3 things: status code, response headers, response body
-                // status code and headers have to be set before response body
-                response.setContentType(connection.getContentType());
-                ostream = response.getOutputStream();
-                copy(connectionIstream, ostream);
-            }
-            // if not targetURL send page that targetURL is required param
-        }
-        catch (Exception e)
-        {
-            response.setStatus(500); // what will user get? default page for response code
-
-            // WMS/WFS have specific responses to errors
-            // response.getWriter();//will writing custom result help
-            e.printStackTrace();
-        }
-        finally
-        {
-            if (istream != null)
-            {
-                istream.close();
-            }
-
-            if (ostream != null)
-            {
-                ostream.close();
-            }
-
-            if (connectionIstream != null)
-            {
-                connectionIstream.close();
-            }
-
-            if (connectionOstream != null)
-            {
-                connectionOstream.close();
-            }
-        }
-
-    }
-
-    /**
-     *
-     * @param istream is
-     * @param ostream os
-     * @throws Exception ex
-     */
-    private void copy(InputStream istream, OutputStream ostream) throws Exception
-    {
-        int bufferSize = 4 * 4 * 1024; // same buffer size as in Jetty utils (2*8192)
-        byte[] buffer = new byte[bufferSize];
-        int read;
-
-        while ((read = istream.read(buffer)) != -1)
-        {
-            ostream.write(buffer, 0, read);
-        }
-    }
-
-    /**
-     *
-     * @param connection con
-     * @param request req
-     */
-    private void transferHTTPRequestHeaders(HttpURLConnection connection, HttpServletRequest request)
-    {
-        // TODO make sure all headers are copied to target, see for HTTP headers http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-        // Do request.getProperties to get request properties
-        if (request.getHeader("Accept") != null)
-        {
-            connection.setRequestProperty("Accept", request.getHeader("Accept"));
-        }
-
-        if (request.getHeader("Accept-Charset") != null)
-        {
-            connection.setRequestProperty("Accept-Charset", request.getHeader("Accept-Charset"));
-        }
-
-        /*
-        if (request.getHeader("Accept-Encoding") != null)
-        {
-            // TODO browsers accept gzipped, should proxy accept gzip and how to handle it?
-            // connection.setRequestProperty("Accept-Encoding", request.getHeader("Accept-Encoding"));
-        }*/
-
-        if (request.getHeader("Authorization") != null)
-        {
-            connection.setRequestProperty("Authorization", request.getHeader("Authorization"));
-        }
-
-        /*
-        if (request.getHeader("Connection") != null)
-        {
-            // TODO HTTP/1.1 proxies MUST parse the Connection header field before a message is forwarded and, for each connection-token in this field, remove any header field(s) from the message with the same name as the connection-token.
-            // connection.setRequestProperty("Connection", request.getHeader("Connection"));
-        }*/
-
-        // set de-facto standard proxy headers (x-forwarded-for, others?s)
-        if (request.getHeader("X-Forwarded-For") != null)
-        {
-            connection.setRequestProperty("X-Forwarded-For", request.getHeader("X-Forwarded-For")); // TODO append IP proxy
-        }
-        else
-        {
-            connection.setRequestProperty("X-Forwarded-For", request.getRemoteAddr()); // TODO append IP proxy
-        }
-    }
-
-    /**
-     *
-     * @param connection con
-     * @param request req
-     */
-    private void transferHTTPRequestHeadersForPOST(HttpURLConnection connection, HttpServletRequest request)
-    {
-        if (request.getHeader("Content-Type") != null)
-        {
-            connection.setRequestProperty("Content-Type", request.getContentType());
-        }
-        else
-        {
-            // throw exception?
-        }
-    }
-
-    /**
-     *
-     * @param remoteHost rem
-     * @return true
-     */
-    private boolean isAllowedHost(String remoteHost)
-    {
-        // TODO checking of host
-        return true;
-    }
-}

gwt-openlayers-showcase/war/WEB-INF/web.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <web-app id="WebApp_ID" version="2.4"
-	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-	<display-name>gwtol</display-name>
+         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+    <display-name>gwtol</display-name>
+    
     <servlet>
         <servlet-name>olproxy</servlet-name>
-        <servlet-class>org.gwtopenmaps.demo.openlayers.server.GwtOpenLayersProxyServlet</servlet-class>
+        <servlet-class>org.gwtopenmaps.openlayers.server.GwtOpenLayersProxyServlet</servlet-class>
     </servlet>
     <servlet-mapping>
         <servlet-name>olproxy</servlet-name>
-        <url-pattern>olproxy</url-pattern>
+        <url-pattern>/olproxy/*</url-pattern>
     </servlet-mapping>
 </web-app>