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     * Returns the x position.
037     * @return the x position
038     */
039    public int getX() {
040        return x;
041    }
042
043    /**
044     * Returns the y position.
045     * @return the y position
046     */
047    public int getY() {
048        return y;
049    }
050
051    /**
052     * Returns the zoom.
053     * @return the zoom
054     */
055    public int getZoom() {
056        return zoom;
057    }
058
059    @Override
060    public String toString() {
061        return "TilePosition [x=" + x + ", y=" + y + ", zoom=" + zoom + ']';
062    }
063}