001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.layer.imagery;
003
004import org.openstreetmap.gui.jmapviewer.Tile;
005
006/**
007 * The position of a single tile.
008 * @author Michael Zangl
009 */
010public class TilePosition {
011    private final int x;
012    private final int y;
013    private final int zoom;
014
015    public TilePosition(int x, int y, int zoom) {
016        this.x = x;
017        this.y = y;
018        this.zoom = zoom;
019    }
020
021    /**
022     * Constructs a new {@code TilePosition}.
023     * @param tile tile
024     */
025    public TilePosition(Tile tile) {
026        this(tile.getXtile(), tile.getYtile(), tile.getZoom());
027    }
028
029    /**
030     * @return the x position
031     */
032    public int getX() {
033        return x;
034    }
035
036    /**
037     * @return the y position
038     */
039    public int getY() {
040        return y;
041    }
042
043    /**
044     * @return the zoom
045     */
046    public int getZoom() {
047        return zoom;
048    }
049
050    @Override
051    public String toString() {
052        return "TilePosition [x=" + x + ", y=" + y + ", zoom=" + zoom + ']';
053    }
054}