/** * Constructs a texture tile for a given sector with a default level, row and column. * * @param sector the sector to create the tile for. */ public Tile(Sector sector) { if (sector == null) { String msg = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } Random random = new Random(); this.sector = sector; this.level = null; this.row = random.nextInt(); this.column = random.nextInt(); this.cacheName = null; this.tileKey = new TileKey(this); this.path = null; }
/** * Constructs a tile for a given sector, level, row and column of the tile's containing tile set. * * @param sector the sector corresponding with the tile. * @param level the tile's level within a containing level set. * @param row the row index (0 origin) of the tile within the indicated level. * @param column the column index (0 origin) of the tile within the indicated level. * * @throws ArgumentException if <code>sector</code> or <code>level</code> is null. */ public Tile(Sector sector, Level level, int row, int column) { if (sector == null) { String msg = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } if (level == null) { String msg = Logging.getMessage("nullValue.LevelIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } // // Allow negative row/col IDs to be used as a signal to prevent their use for non-arranged tiles // if (row < 0) // { // String msg = Logging.getMessage("generic.RowIndexOutOfRange", row); // msg += String.valueOf(row); // // Logging.logger().severe(msg); // throw new ArgumentException(msg); // } // // if (column < 0) // { // String msg = Logging.getMessage("generic.ColumnIndexOutOfRange", column); // msg += String.valueOf(row); // // Logging.logger().severe(msg); // throw new ArgumentException(msg); // } this.sector = sector; this.level = level; this.row = row; this.column = column; this.cacheName = null; this.tileKey = new TileKey(this); this.path = null; }
/** * Constructs a texture tile for a given sector and level, and with a default row and column. * * @param sector the sector to create the tile for. * @param level the level to associate the tile with * * @throws ArgumentException if sector or level are null. */ public Tile(Sector sector, Level level) { if (sector == null) { String msg = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } if (level == null) { String msg = Logging.getMessage("nullValue.LevelIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } this.sector = sector; this.level = level; this.row = Tile.computeRow(sector.getDeltaLat(), sector.getMinLatitude(), Angle.NEG90); this.column = Tile.computeColumn(sector.getDeltaLon(), sector.getMinLongitude(), Angle.NEG180); this.cacheName = null; this.tileKey = new TileKey(this); this.path = null; }
/** * Constructs a tile for a given sector, level, row and column of the tile's containing tile set. If the cache name * is non-null, it overrides the level's cache name and is returned by {@link #getCacheName()}. Otherwise, the * level's cache name is used. * * @param sector the sector corresponding with the tile. * @param level the tile's level within a containing level set. * @param row the row index (0 origin) of the tile within the indicated level. * @param column the column index (0 origin) of the tile within the indicated level. * @param cacheName optional cache name to override the Level's cache name. May be null. * * @throws ArgumentException if <code>sector</code> or <code>level</code> is null. */ public Tile(Sector sector, Level level, int row, int column, String cacheName) { if (sector == null) { String msg = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } if (level == null) { String msg = Logging.getMessage("nullValue.LevelIsNull"); Logging.logger().severe(msg); throw new ArgumentException(msg); } this.sector = sector; this.level = level; this.row = row; this.column = column; this.cacheName = cacheName; this.tileKey = new TileKey(this); this.path = null; }