private void TriggerTileRedrawForExtent(ExtentArgs currentExtent) { var _activeTiles = _mapVisualizer.ActiveTiles; _currentExtent = new HashSet <UnwrappedTileId>(currentExtent.activeTiles); if (tilesToProcess == null) { tilesToProcess = new List <UnwrappedTileId>(); } else { tilesToProcess.Clear(); } foreach (var item in _activeTiles) { if (TileProvider.Cleanup(item.Key)) { tilesToProcess.Add(item.Key); } } if (tilesToProcess.Count > 0) { OnTilesDisposing(tilesToProcess); foreach (var t2r in tilesToProcess) { TileProvider_OnTileRemoved(t2r); } } foreach (var tile in _activeTiles) { // Reposition tiles in case we panned. TileProvider_OnTileRepositioned(tile.Key); } tilesToProcess.Clear(); foreach (var tile in _currentExtent) { if (!_activeTiles.ContainsKey(tile)) { tilesToProcess.Add(tile); } } if (tilesToProcess.Count > 0) { OnTilesStarting(tilesToProcess); foreach (var tileId in tilesToProcess) { _mapVisualizer.State = ModuleState.Working; TileProvider_OnTileAdded(tileId); } } }
private void OnMapExtentChanged(object sender, ExtentArgs currentExtent) { if (GetType() == typeof(AbstractMap)) { TriggerTileRedrawForExtent(currentExtent); } else { StartCoroutine(TriggerTileRedrawForExtent2(currentExtent, System.Diagnostics.Stopwatch.StartNew())); } }
private void OnMapExtentChanged(object sender, ExtentArgs currentExtent) { if (!Application.isPlaying) { TriggerTileRedrawForExtent(currentExtent); } else { StartCoroutine(TriggerTileRedrawForExtent2(currentExtent, System.Diagnostics.Stopwatch.StartNew())); } }
private void TriggerTileRedrawForExtent(ExtentArgs currentExtent) { var _activeTiles = _mapVisualizer.ActiveTiles; _currentExtent = new HashSet <UnwrappedTileId>(currentExtent.activeTiles); List <UnwrappedTileId> _toRemove = new List <UnwrappedTileId>(); foreach (var item in _activeTiles) { if (_tileProvider.Cleanup(item.Key)) //(!_currentExtent.Contains(item.Key)) { _toRemove.Add(item.Key); } } foreach (var t2r in _toRemove) { TileProvider_OnTileRemoved(t2r); } foreach (var tile in _activeTiles) { // Reposition tiles in case we panned. TileProvider_OnTileRepositioned(tile.Key); } foreach (var tile in _currentExtent) { if (!_activeTiles.ContainsKey(tile)) { // Change Map Visualizer state _mapVisualizer.State = ModuleState.Working; TileProvider_OnTileAdded(tile); } } }
private void OnMapExtentChanged(object sender, ExtentArgs currentExtent) { TriggerTileRedrawForExtent(currentExtent); }
private IEnumerator TriggerTileRedrawForExtent2(ExtentArgs currentExtent, System.Diagnostics.Stopwatch t) { RedrawComplete = false; int dt = 17; var _activeTiles = _mapVisualizer.ActiveTiles; _currentExtent = new HashSet <UnwrappedTileId>(currentExtent.activeTiles); List <UnwrappedTileId> _toRemove = new List <UnwrappedTileId>(); foreach (var item in _activeTiles) { if (_tileProvider.Cleanup(item.Key)) //(!_currentExtent.Contains(item.Key)) { _toRemove.Add(item.Key); } if (t.ElapsedMilliseconds > dt) { yield return(null); t.Restart(); } } foreach (var t2r in _toRemove) { TileProvider_OnTileRemoved(t2r); if (t.ElapsedMilliseconds > dt) { yield return(null); t.Restart(); } } foreach (var tile in _activeTiles) { // Reposition tiles in case we panned. TileProvider_OnTileRepositioned(tile.Key); if (t.ElapsedMilliseconds > dt) { yield return(null); t.Restart(); } } foreach (var tile in _currentExtent) { if (!_activeTiles.ContainsKey(tile)) { // Change Map Visualizer state _mapVisualizer.State = ModuleState.Working; TileProvider_OnTileAdded(tile); } if (t.ElapsedMilliseconds > dt) { yield return(null); t.Restart(); } } RedrawComplete = true; }