com.maryanovsky.map.client
Class MapLocationModel

java.lang.Object
  extended by com.maryanovsky.map.client.MapLocationModel
All Implemented Interfaces:
HasChange

public class MapLocationModel
extends Object
implements HasChange

Represents the location on the map displayed by a MapWidget: latitude and longitude coordinates and a zoom.

Author:
Maryanovsky Alexander

Constructor Summary
MapLocationModel(int minZoom, int maxZoom, LatLng center, int zoom)
          Creates a new MapLocationModel with the specified arguments.
 
Method Summary
 void addChangeListener(ChangeListener listener)
          Adds the specified ChangeListener to receive notifications when this MapLocationModel changes.
 int clampToLegal(int zoom)
          Returns the nearest legal zoom to the specified one.
 LatLng getCenter()
          Returns the location of the center.
 int getMaxZoom()
          Returns the biggest possible zoom in this model.
 int getMinZoom()
          Returns the smallest possible zoom in this model.
 int getZoom()
          Returns the zoom.
 boolean isLegalZoom(int zoom)
          Returns whether the specified zoom is within the zoom bounds of this MapLocationModel.
 void removeChangeListener(ChangeListener listener)
          Removes the specified ChangeListener from receiving notifications when this MapLocationModel changes.
 void set(LatLng center, int zoom)
          Sets both the center and zoom in one call (to avoid a temporary state where either the zoom or the center are wrong).
 void set(MapLocationModel mapLocationModel)
          Copies all relevant information from the specified MapLocationModel to this one.
 void setCenter(LatLng center)
          Sets the center to the specified location.
 void setZoom(int zoom)
          Sets the zoom to the specified value.
 void zoomCheck(int zoom)
          Checks whether the specified zoom is within our zoom bounds of our and throws an IllegalArgumentException exception if not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapLocationModel

public MapLocationModel(int minZoom,
                        int maxZoom,
                        LatLng center,
                        int zoom)
Creates a new MapLocationModel with the specified arguments.

Parameters:
minZoom - The minimum possible zoom.
maxZoom - The maximum possible zoom.
center - The location of the center of the view.
zoom - The zoom of the view.
Method Detail

addChangeListener

public void addChangeListener(ChangeListener listener)
Adds the specified ChangeListener to receive notifications when this MapLocationModel changes.

Specified by:
addChangeListener in interface HasChange

removeChangeListener

public void removeChangeListener(ChangeListener listener)
Removes the specified ChangeListener from receiving notifications when this MapLocationModel changes.

Specified by:
removeChangeListener in interface HasChange

getMinZoom

public int getMinZoom()
Returns the smallest possible zoom in this model.


getMaxZoom

public int getMaxZoom()
Returns the biggest possible zoom in this model.


isLegalZoom

public boolean isLegalZoom(int zoom)
Returns whether the specified zoom is within the zoom bounds of this MapLocationModel.


zoomCheck

public void zoomCheck(int zoom)
Checks whether the specified zoom is within our zoom bounds of our and throws an IllegalArgumentException exception if not.


clampToLegal

public int clampToLegal(int zoom)
Returns the nearest legal zoom to the specified one.


getCenter

public LatLng getCenter()
Returns the location of the center.


setCenter

public void setCenter(LatLng center)
Sets the center to the specified location.


getZoom

public int getZoom()
Returns the zoom.


setZoom

public void setZoom(int zoom)
Sets the zoom to the specified value.


set

public void set(LatLng center,
                int zoom)
Sets both the center and zoom in one call (to avoid a temporary state where either the zoom or the center are wrong).


set

public void set(MapLocationModel mapLocationModel)
Copies all relevant information from the specified MapLocationModel to this one.