com.google.gwt.maps.client.geom
Class Projection

java.lang.Object
  extended by com.google.gwt.maps.client.geom.Projection
Direct Known Subclasses:
MercatorProjection

public abstract class Projection
extends java.lang.Object

This is the interface for map projections. A map projection instance is passed to the constructor of MapType. This interface is implemented by the class MercatorProjection, which is used by all predefined map types. You can implement this interface if you want to define map types with different map projections.


Field Summary
protected  com.google.gwt.core.client.JavaScriptObject jsoPeer
           
 
Constructor Summary
  Projection()
          Create a new Projection instance and bind it to this implementation.
protected Projection(com.google.gwt.core.client.JavaScriptObject jsoPeer)
          Create a new Projection instance by wrapping an existing GProjection object.
 
Method Summary
abstract  Point fromLatLngToPixel(LatLng latlng, int zoomLevel)
          Returns the map coordinates in pixels for the point at the given geographical coordinates, and the given zoom level.
abstract  LatLng fromPixelToLatLng(Point point, int zoomLevel, boolean unbounded)
          Returns the geographical coordinates for the point at the given map coordinates in pixels, and the given zoom level.
abstract  double getWrapWidth(int zoomLevel)
          Returns to the map the periodicity in x-direction, i.e.
abstract  boolean tileCheckRange(TileIndex index, int zoomLevel, int tileSize)
          Indicates to the map if the tile index is in a valid range for the map type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jsoPeer

protected final com.google.gwt.core.client.JavaScriptObject jsoPeer
Constructor Detail

Projection

public Projection()
Create a new Projection instance and bind it to this implementation.


Projection

protected Projection(com.google.gwt.core.client.JavaScriptObject jsoPeer)
Create a new Projection instance by wrapping an existing GProjection object. Note that this version of the constructor does not call 'bind()' in the Impl class.

Parameters:
jsoPeer - object to wrap.
Method Detail

fromLatLngToPixel

@Exported
public abstract Point fromLatLngToPixel(LatLng latlng,
                                                 int zoomLevel)
Returns the map coordinates in pixels for the point at the given geographical coordinates, and the given zoom level.

Parameters:
latlng - map coordinates to translate.
zoomLevel - zoom level to translate.
Returns:
the map coordinates in pixels for the point at the given geographical coordinates, and the given zoom level.

fromPixelToLatLng

@Exported
public abstract LatLng fromPixelToLatLng(Point point,
                                                  int zoomLevel,
                                                  boolean unbounded)
Returns the geographical coordinates for the point at the given map coordinates in pixels, and the given zoom level. Flag unbounded causes the geographical longitude coordinate not to wrap when beyond the -180 or 180 degrees meridian.

Parameters:
point - the point at the given map coordinates in pixels to translate.
zoomLevel - zoom level to translate.
unbounded - if true, causes the geographical longitude coordinate not to wrap when beyond the -180 or 180 degrees meridian.
Returns:
the geographical coordinates for the point at the given map coordinates.

getWrapWidth

@Exported
public abstract double getWrapWidth(int zoomLevel)
Returns to the map the periodicity in x-direction, i.e. the number of pixels after which the map repeats itself because it wrapped once round the earth. By default, returns Double.POSITIVE_INFINITY, i.e. the map will not repeat itself. This is used by the map to compute the placement of overlays on map views that contain more than one copy of the earth (this usually happens only at low zoom levels).

Parameters:
zoomLevel - the zoom level to use.
Returns:
the periodicity in x-direction, i.e. the number of pixels after which the map repeats itself). Specify Double.POSITIVE_INFINITY to indicate that the map does not repeat.

tileCheckRange

@Exported
public abstract boolean tileCheckRange(TileIndex index,
                                                int zoomLevel,
                                                int tileSize)
Indicates to the map if the tile index is in a valid range for the map type. Otherwise the map will display an empty tile.

Parameters:
index - the tile index to check. The coordinates may be modified to point to another instance of the same tile in the case that the map contains more than one copy of the earth, and hence the same tile at different tile coordinates.
zoomLevel - the zoom level to check
tileSize -
Returns:
true if the tile index is in a valid range for the map type.