001    package com.google.gwt.maps.client.overlays;
002    
003    import com.google.gwt.core.client.JavaScriptObject;
004    import com.google.gwt.maps.client.base.LatLng;
005    import com.google.gwt.maps.client.base.Point;
006    
007    /**
008     * This object is made available to the OverlayView from within the draw method. It is not guaranteed to be initialized until draw is called.
009     * <br><br>
010     * See <a href="https://developers.google.com/maps/documentation/javascript/reference#MapCanvasProjection">MapCanvasProjection API Doc</a> 
011     */
012    public class MapCanvasProjection extends JavaScriptObject {
013    
014      /**
015       * returns from another object only
016       */
017      protected MapCanvasProjection() {}
018      
019      /**
020       * returns from another object only
021       */
022      public final static MapCanvasProjection newInstance() {
023        return JavaScriptObject.createObject().cast();
024      }
025      
026      /**
027       * Computes the geographical coordinates from pixel coordinates in the map's container.
028       * @param pixel
029       */
030      public final native LatLng fromContainerPixelToLatLng(Point pixel) /*-{
031        return this.fromContainerPixelToLatLng(pixel);
032      }-*/; 
033      
034      /**
035       * Computes the geographical coordinates from pixel coordinates in the div that holds the draggable map.
036       * @param pixel
037       */
038      public final native LatLng fromDivPixelToLatLng(Point pixel) /*-{
039        this.fromDivPixelToLatLng(pixel);
040      }-*/;
041      
042      /**
043       * Computes the pixel coordinates of the given geographical location in the DOM element the map's outer container.
044       * @param latlng
045       */
046      public final native Point fromLatLngToContainerPixel(LatLng latlng) /*-{
047        this.fromLatLngToContainerPixel(latlng);
048      }-*/;
049      
050      /**
051       * Computes the pixel coordinates of the given geographical location in the DOM element that holds the draggable map.
052       * @param latlng
053       */
054      public final native void fromLatLngToDivPixel(LatLng latlng) /*-{
055        this.fromLatLngToDivPixel(latlng);
056      }-*/;
057      
058      /**
059       * The width of the world in pixels in the current zoom level. For projections with a heading angle of either 90 or 270 degress, this corresponds to the pixel span in the Y-axis.
060       */
061      public final native int getWorldWidth() /*-{
062        return this.getWorldWidth();
063      }-*/;
064      
065    }