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    TilePosition(int x, int y, int zoom) {
015        this.x = x;
016        this.y = y;
017        this.zoom = zoom;
018    }
019
020    /**
021     * Constructs a new {@code TilePosition}.
022     * @param tile tile
023     */
024    public TilePosition(Tile tile) {
025        this(tile.getXtile(), tile.getYtile(), tile.getZoom());
026    }
027
028    /**
029     * @return the x position
030     */
031    public int getX() {
032        return x;
033    }
034
035    /**
036     * @return the y position
037     */
038    public int getY() {
039        return y;
040    }
041
042    /**
043     * @return the zoom
044     */
045    public int getZoom() {
046        return zoom;
047    }
048
049    @Override
050    public String toString() {
051        return "TilePosition [x=" + x + ", y=" + y + ", zoom=" + zoom + ']';
052    }
053}