/// <summary> /// Load the information for a single tile (as in parse the needed .t -file. /// </summary> /// <param name="tileX">The cornerIndexX-value of the tile number</param> /// <param name="tileZ">The cornerIndexZ-value of the tile number</param> /// <param name="loTiles">Loading LO tile (Distant Mountain) or not</param> /// <returns>The tile information as a 'Tile' object</returns> private Tile LoadTile(int tileX, int tileZ, bool loTiles) { TileHelper.Zoom zoom = loTiles ? TileHelper.Zoom.DMSmall : TileHelper.Zoom.Small; string path = loTiles ? this.lotilesPath : this.tilesPath; // Note, code is similar to ORTS.Viewer3D.TileManager.Load // Check for 1x1 or 8x8 tiles. TileHelper.Snap(ref tileX, ref tileZ, zoom); // we set visible to false to make sure errors are loaded Tile newTile = new Tile(path, tileX, tileZ, zoom, false); if (newTile.Loaded) { return(newTile); } else { // Check for 2x2 or 16x16 tiles. TileHelper.Snap(ref tileX, ref tileZ, zoom - 1); newTile = new Tile(tilesPath, tileX, tileZ, zoom - 1, false); if (newTile.Loaded) { return(newTile); } } return(null); }
/// <summary> /// Constructs a new TileManager for loading tiles from a specific path, either at high-resolution or low-resolution. /// </summary> /// <param name="filePath">Path of the directory containing the MSTS tiles</param> /// <param name="loTiles">Flag indicating whether the tiles loaded should be high-resolution (2KM and 4KM square) or low-resolution (16KM and 32KM square, for distant mountains)</param> public TileManager(string filePath, bool loTiles) { FilePath = filePath; Zoom = loTiles ? TileHelper.Zoom.DMSmall : TileHelper.Zoom.Small; }