Commits

Lorenzo Amato  committed 110bd79 Merge

Merged in tptodorov/gwt-openlayers (pull request #17)

  • Participants
  • Parent commits bc9464b, 952ad58

Comments (0)

Files changed (6)

File gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/Map.java

     public void zoomToExtent(Bounds bounds) {
         MapImpl.zoomToExtent(getJSObject(), bounds.getJSObject());
     }
-    
+
     /**
      * APIMethod: zoomToExtent
      * Zoom to the passed in bounds, recenter.
      * @param bounds
-     * @param closest Find the zoom level that most closely fits the 
-     * specified bounds. Note that this may result in a zoom that does 
+     * @param closest Find the zoom level that most closely fits the
+     * specified bounds. Note that this may result in a zoom that does
      * not exactly contain the entire extent. Default is false.
      */
     public void zoomToExtent(Bounds bounds, boolean closest) {
                 lonlat.getJSObject()));
     }
 
+    /**
+     * APIMethod: getLayerPxFromLonLat
+     *
+     * Parameters:
+     * @param lonlat {<OpenLayers.LonLat>} lonlat
+     *
+     * @return {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
+     *                      <OpenLayers.LonLat>, translated into layer pixels
+     *                      by the current base layer
+     */
+    public Pixel getLayerPxFromLonLat(LonLat lonlat) {
+    	return new Pixel(MapImpl.getLayerPxFromLonLat(getJSObject(),
+    			lonlat.getJSObject()));
+    }
+
+    /**
+     * Method: getLonLatFromLayerPx
+     *
+     * Parameters:
+     * @param px - {<OpenLayers.Pixel>}
+     *
+     * @return {<OpenLayers.LonLat>}
+     */
+    public LonLat getLonLatFromLayerPx(Pixel px) {
+    	return new LonLat(MapImpl.getLonLatFromLayerPx(getJSObject(),
+    			px.getJSObject()));
+    }
+
     public String getProjection() {
         return MapImpl.getProjection(getJSObject());
     }

File gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/MapImpl.java

     public static native JSObject getControlsByClass(JSObject map, String className)/*-{
         return map.getControlsByClass(className)[0];
     }-*/;
-	
+
 	public static native JSObject getLayers(JSObject map)/*-{
 		return (map.layers === undefined) ? null : map.layers;
 	}-*/;
     public static native void removeLayer(JSObject map, JSObject layer, boolean setNewBaseLayer)/*-{
         map.removeLayer(layer, setNewBaseLayer);
     }-*/;
-	
+
 	public static native void removeControl(JSObject map, JSObject control)/*-{
 		map.removeControl(control);
 	}-*/;
 	public static native void setLayerIndex(JSObject map, JSObject layer, int index)/*-{
 		map.setLayerIndex(layer, index);
 	}-*/;
-	
+
     public static native void setLayerZIndex(JSObject map, JSObject layer, int zIdx)/*-{
         map.setLayerZIndex(layer, zIdx);
     }-*/;
 	public static native void zoomToExtent(JSObject map, JSObject bounds)/*-{
 		map.zoomToExtent(bounds);
 	}-*/;
-    
+
     public static native void zoomToExtent(JSObject map, JSObject bounds, boolean closest)/*-{
 		map.zoomToExtent(bounds, closest);
 	}-*/;
 	public static native JSObject getPixelFromLonLat(JSObject map, JSObject lonlat)/*-{
 		return map.getPixelFromLonLat(lonlat);
 	}-*/;
+
+	public static native JSObject getLayerPxFromLonLat(JSObject map, JSObject lonlat)/*-{
+		return map.getLayerPxFromLonLat(lonlat);
+	}-*/;
+
+	public static native JSObject getLonLatFromLayerPx(JSObject map, JSObject px)/*-{
+		return map.getLonLatFromLayerPx(px);
+	}-*/;
+
 	public static native String getProjection(JSObject map)/*-{
 		return map.getProjection();
 	}-*/;
 	public static native void zoomTo(JSObject map, int zoomLevel)/*-{
 		map.zoomTo(zoomLevel);
 	}-*/;
-	
+
     public static native void zoomToScale(JSObject map, float scale, boolean closest)/*-{
         map.zoomToScale(scale, closest);
     }-*/;
 	public static native void panTo(JSObject map, JSObject lonlat)/*-{
 		map.panTo(lonlat);
 	}-*/;
-	
+
 	public static native void pan(JSObject map, int dx, int dy) /*-{
 		map.pan(dx, dy);
 	}-*/;
 	public static native void setBaseLayer(JSObject map, JSObject newBaseLayer)/*-{
  		map.setBaseLayer(newBaseLayer);
 	}-*/;
-	
+
     public static native void disableBrowserContextMenu(JSObject map, BrowserMenuListener listener)/*-{
         map.div.oncontextmenu = function noContextMenu(e) {
         var eventObj = @org.gwtopenmaps.openlayers.client.event.MouseEvent::narrowToMouseEvent(Lorg/gwtopenmaps/openlayers/client/util/JSObject;)(e);
         listener.@org.gwtopenmaps.openlayers.client.Map.BrowserMenuListener::onMouseClick(Lorg/gwtopenmaps/openlayers/client/event/MouseEvent;)(eventObj);
-        
+
         return false; //cancel the right click of browser
-        }; 
+        };
     }-*/;
-    
-    
+
+
     public static native double getZoomForResolution(JSObject map, double resolution, boolean closest)/*-{
         return map.getZoomForResolution(resolution, closest);
     }-*/;

File gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/layer/OSM.java

         return new OSM(OSMImpl.Mapnik(name, options.getJSObject()));
     }
 
-    public static OSM Osmarender(String name)
-    {
-        return new OSM(OSMImpl.Osmarender(name));
-    }
-
-    public static OSM Osmarender(String name, OSMOptions options)
-    {
-        return new OSM(OSMImpl.Osmarender(name, options.getJSObject()));
-    }
-
     public static OSM CycleMap(String name)
     {
         return new OSM(OSMImpl.CycleMap(name));

File gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/layer/OSMImpl.java

         for (i = 0; i < urls.length; i++) {
         wmsURLs[i] = urls[i];
         }
-        
+
         return new $wnd.OpenLayers.Layer.OSM(name, wmsURLs, params);
     }-*/;
 
        return new $wnd.OpenLayers.Layer.OSM.Mapnik(name, params);
     }-*/;
 
-    public static native JSObject Osmarender(String name)
-    /*-{
-       return new $wnd.OpenLayers.Layer.OSM.Osmarender(name);
-    }-*/;
-
-    public static native JSObject Osmarender(String name, JSObject params)
-    /*-{
-       return new $wnd.OpenLayers.Layer.OSM.Osmarender(name, params);
-    }-*/;
-
     public static native JSObject CycleMap(String name)
     /*-{
        return new $wnd.OpenLayers.Layer.OSM.CycleMap(name);

File gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/popup/Popup.java

 
 import org.gwtopenmaps.openlayers.client.LonLat;
 import org.gwtopenmaps.openlayers.client.OpenLayersObjectWrapper;
+import org.gwtopenmaps.openlayers.client.Pixel;
 import org.gwtopenmaps.openlayers.client.Size;
 import org.gwtopenmaps.openlayers.client.util.JSObject;
 
         this.getJSObject().setProperty("lonlat", lt.getJSObject());
     }
 
+    public LonLat getLonLat()
+    {
+    	return LonLat.narrowToLonLat(this.getJSObject().getProperty("lonlat"));
+    }
+
     /**
      * Method: show Makes the popup visible.
      */
     }
 
     /**
+     * Method: moveTo
+     *
+     * @param px - {<OpenLayers.Pixel>} the top and left position of the popup div.
+     */
+    public void moveTo(Pixel px) {
+        PopupImpl.moveTo(getJSObject(), px.getJSObject());
+    }
+
+    /**
+     * Method: panIntoView
+     * Pans the map such that the popup is totaly viewable (if necessary)
+     */
+    public void panIntoView() {
+    	PopupImpl.panIntoView(getJSObject());
+    }
+
+    /**
      * APIMethod: updateSize
      * Auto size the popup so that it precisely fits its contents (as
      * determined by this.contentDiv.innerHTML). Popup size will, of

File gwt-openlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/popup/PopupImpl.java

         p.updatePosition();
     }-*/;
 
+    public static native void moveTo(JSObject p, JSObject px) /*-{
+        p.moveTo(px);
+    }-*/;
+
+    public static native void panIntoView(JSObject p) /*-{
+        p.panIntoView();
+    }-*/;
+
     public static native void updateSize(JSObject p) /*-{
         p.updateSize();
     }-*/;