Class TileAddress
java.lang.Object
org.deltava.util.tile.TileAddress
- All Implemented Interfaces:
Serializable, Comparable<TileAddress>
- Direct Known Subclasses:
TileServlet.TileAddress5D
A class to store quadtree Tile addresses.
- Since:
- 1.3
- Version:
- 11.3
- Author:
- Luke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTileAddress(int x, int y, int level) Creates a new Tile Address from cartesian coordinates.TileAddress(String name) Creates a new Tile Address from a tile filename. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(TileAddress addr2) Compares two addresses by comparing their levels, Y and X coordinates.booleanstatic TileAddressfromPixel(int px, int py, int zoom) Creates a new Tile Address from pixel coordinates.Returns the addresses of all of this Tile's children.getChildren(int level) Returns the addresses of all of this Tile's descendents at a particular zoom level.intgetLevel()Returns the Tile level.getName()Returns the base filename of this Tile.Returns this Tile's parent address.Returns the addresses of all of this Tile's parents.intReturns the X-coordinate of this tile within the global image.intReturns the Y-coordinate of this tile within the global image.intgetX()Returns the X-coordinate of this Tile.intgetY()Returns the Y-coordinate of this Tile.inthashCode()toString()Returns the coordinates and level of the Tile.zoomTo(int newLevel) Returns the address of this Tile when zooming to another level.
-
Constructor Details
-
TileAddress
public TileAddress(int x, int y, int level) Creates a new Tile Address from cartesian coordinates.- Parameters:
x- the zero-offset X coordinatey- the zero-offset Y coordinatelevel- the level
-
TileAddress
Creates a new Tile Address from a tile filename.- Parameters:
name- the tile filename- Throws:
NullPointerException- if name is null
-
-
Method Details
-
fromPixel
Creates a new Tile Address from pixel coordinates.- Parameters:
px- the zero-offset X coordinatepy- the zero-offset Y coordinatezoom- the zoom level- Returns:
- the new TileAddress
-
getLevel
public int getLevel()Returns the Tile level.- Returns:
- the level
-
getX
public int getX()Returns the X-coordinate of this Tile.- Returns:
- the zero-offset X coordinate
-
getY
public int getY()Returns the Y-coordinate of this Tile.- Returns:
- the zero-offset Y coordinate
-
getPixelX
public int getPixelX()Returns the X-coordinate of this tile within the global image.- Returns:
- the zero-offset pixel X coordinate
-
getPixelY
public int getPixelY()Returns the Y-coordinate of this tile within the global image.- Returns:
- the zero-offset pixel Y coordinate
-
getName
-
toString
-
compareTo
Compares two addresses by comparing their levels, Y and X coordinates.- Specified by:
compareToin interfaceComparable<TileAddress>- See Also:
-
equals
-
hashCode
-
getParent
Returns this Tile's parent address.- Returns:
- the Tile's parent address
- See Also:
-
getParents
Returns the addresses of all of this Tile's parents.- Returns:
- a Collection of TileAddress beans
- See Also:
-
getChildren
Returns the addresses of all of this Tile's children.- Returns:
- a Collection of TileAddress beans
- See Also:
-
getChildren
Returns the addresses of all of this Tile's descendents at a particular zoom level.- Parameters:
level- the new zoom level- Returns:
- a Collection of TileAddress beans
-
zoomTo
Returns the address of this Tile when zooming to another level. If zooming to a higher level, then the address of the top-left child will be returned.- Parameters:
newLevel- the new zoom level- Returns:
- the Address of the tile
-