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()
           
 int getZoomLevel()
           
 boolean intersectsWithBounds(int mapX, int mapY, int tileSize)
           
 boolean isWithinBounds(int mapX, int mapY)
          Is given position on tile map within map bounds
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, 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()

getZoomLevel

public int getZoomLevel()

intersectsWithBounds

public boolean intersectsWithBounds(int mapX,
                                    int mapY,
                                    int tileSize)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object