Frank Wynants avatar Frank Wynants committed fcf9d76

Cleaned up the Image layer example

Comments (0)

Files changed (2)

gwt-openlayers-showcase/src/main/java/org/gwtopenmaps/demo/openlayers/client/examples/imagelayer/ImageLayerExample.java

 import org.gwtopenmaps.openlayers.client.layer.GoogleV3Options;
 import org.gwtopenmaps.openlayers.client.layer.Image;
 import org.gwtopenmaps.openlayers.client.layer.ImageOptions;
-import org.gwtopenmaps.openlayers.client.layer.Layer;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.ui.HTML;
         gNormalOptions.setIsBaseLayer(true);
         gNormalOptions.setType(GoogleV3MapType.G_SATELLITE_MAP);
         GoogleV3 gNormal = new GoogleV3("Google sattelite", gNormalOptions);
+
+        //Create the map
+        Map map = mapWidget.getMap();
+        map.addLayer(gNormal);
         
         //Create a image layer
-        
         final Bounds extent = new Bounds(-88.0, 41.4, -87.0, 42.2);
-        extent.transform(DEFAULT_PROJECTION, new Projection("EPSG:900913"));
+        extent.transform(DEFAULT_PROJECTION, new Projection(map.getProjection()));
         ImageOptions imageOptions = new ImageOptions();
         imageOptions.setNumZoomLevels(18);
-        //imageOptions.setDisplayOutsideMaxExtent(true);
         imageOptions.setLayerOpacity(0.8d);
-        imageOptions.setProjection("EPSG:900913");
         Image imageLayer = new Image("CatsLayer", "http://i1.kym-cdn.com/entries/icons/original/000/007/263/photo_cat2.jpg", extent, new Size(108,73), 
               imageOptions);
         imageLayer.setIsBaseLayer(false);
    
-
-        //And add them to the map
-        Map map = mapWidget.getMap();
-        
-        map.addLayers(new Layer[]{gNormal, imageLayer});
-        //map.addLayer(imageLayer);
+        map.addLayer(imageLayer);
 
         //Lets add some default controls to the map
         map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
         initWidget(contentPanel);
 
         mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
-        
-        GWT.log("map projection = " + map.getProjection());
     }
 
     @Override

gwt-openlayers-showcase/src/main/resources/org/gwtopenmaps/demo/openlayers/public/examples/imagelayer/ImageLayerExample.txt

     public ImageLayerExample(ShowcaseExampleStore store) {
         super("Image Layer Example",
               "Demonstrate a single non-tiled image as an overlay layer.",
-              new String[]{"Image", "layer"}, store);
+              new String[]{"Image", "layer", "overlay"}, store);
     }
 
     @Override
         gNormalOptions.setIsBaseLayer(true);
         gNormalOptions.setType(GoogleV3MapType.G_SATELLITE_MAP);
         GoogleV3 gNormal = new GoogleV3("Google sattelite", gNormalOptions);
+
+        //Create the map
+        Map map = mapWidget.getMap();
+        map.addLayer(gNormal);
         
         //Create a image layer
-        
         final Bounds extent = new Bounds(-88.0, 41.4, -87.0, 42.2);
-        extent.transform(DEFAULT_PROJECTION, new Projection("EPSG:900913"));
+        extent.transform(DEFAULT_PROJECTION, new Projection(map.getProjection()));
         ImageOptions imageOptions = new ImageOptions();
         imageOptions.setNumZoomLevels(18);
-        //imageOptions.setDisplayOutsideMaxExtent(true);
         imageOptions.setLayerOpacity(0.8d);
-        imageOptions.setProjection("EPSG:900913");
         Image imageLayer = new Image("CatsLayer", "http://i1.kym-cdn.com/entries/icons/original/000/007/263/photo_cat2.jpg", extent, new Size(108,73), 
               imageOptions);
         imageLayer.setIsBaseLayer(false);
    
-
-        //And add them to the map
-        Map map = mapWidget.getMap();
-        
-        map.addLayers(new Layer[]{gNormal, imageLayer});
-        //map.addLayer(imageLayer);
+        map.addLayer(imageLayer);
 
         //Lets add some default controls to the map
         map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
         initWidget(contentPanel);
 
         mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
-        
-        GWT.log("map projection = " + map.getProjection());
     }
 
     @Override
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.