1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.maps.tile;
15 * @author Tuukka Lehtonen
18 public class TileKey {
21 * Valid values within {0, 1, 2,... , n}. When the value is 0, the only
22 * valid (x,y) values are in {(0,0), (1,0)}, meaning half of the whole
23 * globe. Every time the value of level increases by one, the map is
24 * subdivided by 4 in the x direction and by two in the y direction, i.e.
25 * into eight equal size parts.
27 private final int level;
33 private final int hash;
35 public TileKey(int level, int x, int y) {
45 result = prime * result + level;
46 result = prime * result + x;
47 result = prime * result + y;
51 public int getLevel() {
64 public int hashCode() {
69 public boolean equals(Object obj) {
74 if (getClass() != obj.getClass())
76 final TileKey other = (TileKey) obj;
77 if (level != other.level)
87 public String toString() {
88 return "TileKey [level=" + level + ", x=" + x + ", y=" + y + "]";