Ejemplo n.º 1
0
        private void HandleTileReceived(object sender, TileReceivedEventArgs e)
        {
            var i = e.TileInfo.Index;

            if (i.Level != _level)
            {
                return;
            }

            //System.Diagnostics.Debug.WriteLine("Tile received (Index({0}, {1}, {2}))", i.Level, i.Row, i.Col);
// some timed refreshes if the server becomes slooow...
            if (_stopwatch.Elapsed.Milliseconds > 250 && !_tileFetcher.Ready())
            {
                _stopwatch.Reset();
                MapFrame.Invalidate();
                _stopwatch.Restart();
                return;
            }

            var ext = ToBrutileExtent(MapFrame.ViewExtents);

            if (ext.Intersects(e.TileInfo.Extent))
            {
                MapFrame.Invalidate(FromBruTileExtent(e.TileInfo.Extent));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event invoker for the <see cref="TileReceived"/> event
        /// </summary>
        /// <param name="tileReceivedEventArgs">The event arguments</param>
        private void OnTileReceived(TileReceivedEventArgs tileReceivedEventArgs)
        {
            // Don't raise events if we are not in async mode!
            if (!AsyncMode)
            {
                return;
            }

            if (TileReceived != null)
            {
                TileReceived(this, tileReceivedEventArgs);
            }

            var i = tileReceivedEventArgs.TileInfo.Index;

            System.Diagnostics.Debug.WriteLine("Tile received (Index({0}, {1}, {2})) {3} tiles loading", i.Level, i.Row, i.Col, _openTileRequests.Count);

            if (_activeTileRequests.Count == 0 && _openTileRequests.Count == 0)
            {
                OnQueueEmpty(EventArgs.Empty);
            }
        }
Ejemplo n.º 3
0
        private void HandleTileReceived(object sender, TileReceivedEventArgs e)
        {
            var i = e.TileInfo.Index;
            if (i.Level != _level) return;
            
            //System.Diagnostics.Debug.WriteLine("Tile received (Index({0}, {1}, {2}))", i.Level, i.Row, i.Col);
// some timed refreshes if the server becomes slooow...
            if (_stopwatch.Elapsed.Seconds > 1 && ! _tileFetcher.Ready())
            {
                _stopwatch.Reset();
                Invalidate();
                _stopwatch.Restart();
                return;
            }

            var ext = ToBrutileExtent(MapFrame.ViewExtents);
            if (ext.Intersects(e.TileInfo.Extent))
            {
                Invalidate(FromBruTileExtent(e.TileInfo.Extent));
            }
        }