com.maryanovsky.map.client.projections
Class MercatorProjection

java.lang.Object
  extended by com.maryanovsky.map.client.projections.AbstractProjection
      extended by com.maryanovsky.map.client.projections.MercatorProjection
All Implemented Interfaces:
Projection
Direct Known Subclasses:
Osgeo41001Projection, OsmMercatorProjection

public class MercatorProjection
extends AbstractProjection

An implementation of the mercator projection.


Field Summary
 
Fields inherited from class com.maryanovsky.map.client.projections.AbstractProjection
longitudeWraps, nativeZoom, worldHeight, worldWidth, zoomStrategy
 
Constructor Summary
MercatorProjection(ZoomStrategy zoomStrategy, int nativeZoom, SizeView worldSize, boolean longitudeWraps, double centralLongitude, double maxMercatorY)
          Creates a new MercatorProjection with the specified arguments.
 
Method Summary
protected  double[] fromLatLngToPixelImpl(LatLng latLng)
          Converts from latitude-longitude to pixel coordinates at the native zoom.
protected  LatLng fromPixelToLatLngImpl(double x, double y)
          Converts from pixel coordinates to latitude-longitude at the native zoom.
 
Methods inherited from class com.maryanovsky.map.client.projections.AbstractProjection
fromLatLngToPixel, fromPixelToLatLng, getWrapSize, getWrapSizeImpl, getZoomMagnification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MercatorProjection

public MercatorProjection(ZoomStrategy zoomStrategy,
                          int nativeZoom,
                          SizeView worldSize,
                          boolean longitudeWraps,
                          double centralLongitude,
                          double maxMercatorY)
Creates a new MercatorProjection with the specified arguments.

Parameters:
zoomStrategy - The strategy that defines zoom magnification for us.
nativeZoom - The "native" zoom. There is no special meaning to this zoom other than that worldSize is given at that zoom.
worldSize - The size of the world, in pixels, at the native zoom.
longitudeWraps - Whether the map wraps around the X (longitude) axis.
centralLongitude - The longitude at the center of the map.
maxMercatorY - The Y mercator value at the top (and the opposite of the value at the bottom) of the map.
Method Detail

fromLatLngToPixelImpl

protected double[] fromLatLngToPixelImpl(LatLng latLng)
Converts from latitude-longitude to pixel coordinates at the native zoom. Returns the X and Y coordinates in a 2-element array. The returned values must be in the range [0, worldWidth or worldHeight].

Specified by:
fromLatLngToPixelImpl in class AbstractProjection

fromPixelToLatLngImpl

protected LatLng fromPixelToLatLngImpl(double x,
                                       double y)
Converts from pixel coordinates to latitude-longitude at the native zoom. The passed values are guaranteed to be in the range [0, worldWidth or worldHeight].

Specified by:
fromPixelToLatLngImpl in class AbstractProjection