[TASK] Initial commit with basic product setup

This commit is contained in:
2019-08-18 13:50:14 +02:00
commit 01a66a8e1f
2548 changed files with 167528 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using Mapbox.Map;
using Mapbox.Utils;
namespace Mapbox.Unity.Map.TileProviders
{
public class GlobeTileProvider : AbstractTileProvider
{
public override void OnInitialized()
{
_currentExtent.activeTiles = new HashSet<UnwrappedTileId>();
}
public override void UpdateTileExtent()
{
// HACK: don't allow too many tiles to be requested.
if (_map.AbsoluteZoom > 5)
{
throw new System.Exception("Too many tiles! Use a lower zoom level!");
}
var tileCover = TileCover.Get(Vector2dBounds.World(), _map.AbsoluteZoom);
foreach (var tile in tileCover)
{
_currentExtent.activeTiles.Add(new UnwrappedTileId(tile.Z, tile.X, tile.Y));
}
OnExtentChanged();
}
public override bool Cleanup(UnwrappedTileId tile)
{
return (!_currentExtent.activeTiles.Contains(tile));
}
}
}