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