com.micello.mapapi.render
Class MapViewRegion

java.lang.Object
  extended by com.micello.mapapi.render.MapViewRegion
All Implemented Interfaces:
CommunityChangedListener

public class MapViewRegion
extends java.lang.Object
implements CommunityChangedListener

This class manages the viewport to the map in the MicelloMapView. An instance of MapViewRegion can be obtained from the static class MicelloManager. An manipulation of the view region should be done through this class.


Nested Class Summary
static class MapViewRegion.MapToTileData
          This class wraps the transformation data between the map coordinates system and the zoom = 1 tile coordinate system.
 
Field Summary
static int END_X
           
static int END_Y
           
static int START_X
           
static int START_Y
           
 
Fields inherited from interface com.micello.mapapi.data.CommunityChangedListener
COMMUNITY_CHANGED, DRAWING_CHANGED, ENTITIES_LOADED, GEOMETRY_LOADED, LEVEL_CHANGED, LEVEL_READY, META_DATA_LOADED
 
Constructor Summary
MapViewRegion(MicelloManager micelloManager)
          Constructor
 
Method Summary
 void clearDynamicZoom()
          Thie methods sets the dynamic zoom to 1.
 float getStaticZoomScale()
          This method retrieves the zoom scale of the rendered ties relative to the base scale of the map.
 int getSurfaceHeight()
          This method returns the current surface height.
 int getSurfaceWidth()
          This returns the current surface width.
 float getTotalZoomScale()
          This returns the sum of the static zoom scale and the current dynamic zoom scale to give the total zoom scale.
 void onCommunityChanged(Community comunity, Drawing drawing, DrawingLevel level, int flags)
          This is part of the drawing changed listener implementation.
 void onCommunityError(int cid, int did, int lid, int error, int flags)
          This is part of the drawing changed listener implementation.
 void pan(float dPixX, float dPixY)
          This method pans the map a specified number of pixels.
 void setAngleDegrees(float angleDegrees)
          This sets the rotation angle in degrees from the default rotation.
 void setDynamicAngleDegrees(float angleDegrees)
          This method sets the dynamic rotation angle for the map, which is executed as a rotation of the map image, as opposed to rendering the image at this angle.
 void setDynamicZoom(float zoomFactor, float centerPixX, float centerPixY)
          This method sets the dynamic zoom scale for the map, which is executed as a scaling of the map image, as opposed to rendering the image at this scale.
 void setNorthUp(boolean northUp)
          If north up is set to true, the map will have north at the top of the map.
 void setTileToMapTransform(Matrix tileToMapTransform)
          This method initializes a base transformation between map space and tile space.
 void setView(float zoomScale, float centerMapX, float centerMapY)
          This method set the visible view of the map.
 void zoom(float zoomFactor)
          This method zooms the map by the given factor, around the center of the screen.
 void zoom(float zoomFactor, float startCenterPixX, float startCenterPixY)
          This method zooms the map by the given factor around the specified point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_X

public static final int START_X
See Also:
Constant Field Values

START_Y

public static final int START_Y
See Also:
Constant Field Values

END_X

public static final int END_X
See Also:
Constant Field Values

END_Y

public static final int END_Y
See Also:
Constant Field Values
Constructor Detail

MapViewRegion

public MapViewRegion(MicelloManager micelloManager)
Constructor

Method Detail

setNorthUp

public void setNorthUp(boolean northUp)
If north up is set to true, the map will have north at the top of the map. By default, the map is oriented at a coordinate system convenient for the map contents.


setTileToMapTransform

public void setTileToMapTransform(Matrix tileToMapTransform)
This method initializes a base transformation between map space and tile space. If the identity transformation is desired, pass null for the matrix.


onCommunityChanged

public void onCommunityChanged(Community comunity,
                               Drawing drawing,
                               DrawingLevel level,
                               int flags)
This is part of the drawing changed listener implementation.

Specified by:
onCommunityChanged in interface CommunityChangedListener
Parameters:
comunity - The relevant community object. May be null.
drawing - The relevant drawing object. May be null.
level - The relevent level object. May be null.
flags - flags indicating the event

onCommunityError

public void onCommunityError(int cid,
                             int did,
                             int lid,
                             int error,
                             int flags)
This is part of the drawing changed listener implementation.

Specified by:
onCommunityError in interface CommunityChangedListener
Parameters:
cid - The relavant community id
did - The relevant drawing id
lid - The relevant level id
error - An error code
flags - flags indicating the event

setView

public void setView(float zoomScale,
                    float centerMapX,
                    float centerMapY)
This method set the visible view of the map.


setAngleDegrees

public void setAngleDegrees(float angleDegrees)
This sets the rotation angle in degrees from the default rotation. To set the absolute angle relative to north, the offset of the default rotaton from north must be looked up.


setDynamicAngleDegrees

public void setDynamicAngleDegrees(float angleDegrees)
This method sets the dynamic rotation angle for the map, which is executed as a rotation of the map image, as opposed to rendering the image at this angle. This allows for a faster redraw.


setDynamicZoom

public void setDynamicZoom(float zoomFactor,
                           float centerPixX,
                           float centerPixY)
This method sets the dynamic zoom scale for the map, which is executed as a scaling of the map image, as opposed to rendering the image at this scale. This allows for a faster redraw.


clearDynamicZoom

public void clearDynamicZoom()
Thie methods sets the dynamic zoom to 1.


pan

public void pan(float dPixX,
                float dPixY)
This method pans the map a specified number of pixels.


zoom

public void zoom(float zoomFactor)
This method zooms the map by the given factor, around the center of the screen.


zoom

public void zoom(float zoomFactor,
                 float startCenterPixX,
                 float startCenterPixY)
This method zooms the map by the given factor around the specified point.


getStaticZoomScale

public float getStaticZoomScale()
This method retrieves the zoom scale of the rendered ties relative to the base scale of the map. This zoom scale excludes does not include the dynamic zoom scale, which is any stretching of the screen during an action like a pinch zoom, or any baseline zoom set with the function setTileToMapTransform, which sets a default transformation between the map coordinates and the baseline teil coordinates.


getTotalZoomScale

public float getTotalZoomScale()
This returns the sum of the static zoom scale and the current dynamic zoom scale to give the total zoom scale.


getSurfaceWidth

public int getSurfaceWidth()
This returns the current surface width.


getSurfaceHeight

public int getSurfaceHeight()
This method returns the current surface height.