com.nutiteq.components
Class TileMapBounds

java.lang.Object
  extended by com.nutiteq.components.TileMapBounds

public class TileMapBounds
extends java.lang.Object

Defines map bounds on pixel map. Definition is done by valid minimum and maximum points on map. For example for a map, that has world at zoom level 0 in 256x256 tile, map bounds on zoom 0 would be min = (0, 0) and max = (255, 255)


Constructor Summary
TileMapBounds(MapPos minPoint, MapPos maxPoint)
          Create tile map bounds.
 
Method Summary
 MapPos calculateCorrection(MapPos middlePoint)
          Calculate map position correction for it to be within map bounds.
 MapPos getMaxPoint()
           
 MapPos getMinPoint()
           
 boolean isWithinBounds(int mapX, int mapY)
          Is given position on tile map within map bounds
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TileMapBounds

public TileMapBounds(MapPos minPoint,
                     MapPos maxPoint)
Create tile map bounds.

Parameters:
minPoint - minimum valid point on map
maxPoint - maximum valid point on map
Method Detail

isWithinBounds

public boolean isWithinBounds(int mapX,
                              int mapY)
Is given position on tile map within map bounds

Parameters:
mapX - position x
mapY - position y
Returns:
if given point is within map bounds

calculateCorrection

public MapPos calculateCorrection(MapPos middlePoint)
Calculate map position correction for it to be within map bounds.

Parameters:
middlePoint - point for witch to get the correction
Returns:
correction needed on x/y axis

getMaxPoint

public MapPos getMaxPoint()

getMinPoint

public MapPos getMinPoint()