com.maryanovsky.map.client.projections
Class ScaleProjection

java.lang.Object
  extended by com.maryanovsky.map.client.projections.AbstractProjection
      extended by com.maryanovsky.map.client.projections.ScaleProjection
All Implemented Interfaces:
Projection
Direct Known Subclasses:
Epsg4326Projection

public class ScaleProjection
extends AbstractProjection

A projection which simply scales the latitude and longitude values into the world size rectangle specified in the constructor.

Author:
Maryanovsky Alexander

Field Summary
 
Fields inherited from class com.maryanovsky.map.client.projections.AbstractProjection
longitudeWraps, nativeZoom, worldHeight, worldWidth, zoomStrategy
 
Constructor Summary
ScaleProjection(ZoomStrategy zoomStrategy, int nativeZoom, SizeView worldSize, boolean longitudeWraps, double centralLongitude)
          Creates a new ScaleProjection 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

ScaleProjection

public ScaleProjection(ZoomStrategy zoomStrategy,
                       int nativeZoom,
                       SizeView worldSize,
                       boolean longitudeWraps,
                       double centralLongitude)
Creates a new ScaleProjection 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.
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