Ejemplo n.º 1
0
        internal override void OnRegistered(UnityTile tile)
        {
            RasterTile rasterTile;

            if (_mapId.StartsWith("mapbox://", StringComparison.Ordinal))
            {
                rasterTile = _useRetina ? new RetinaRasterTile() : new RasterTile();
            }
            else
            {
                rasterTile = _useRetina ? new ClassicRetinaRasterTile() : new ClassicRasterTile();
            }

            tile.RasterDataState = TilePropertyState.Loading;

            tile.AddTile(rasterTile);
            Progress++;
            rasterTile.Initialize(_fileSource, tile.CanonicalTileId, _mapId, () =>
            {
                if (rasterTile.HasError)
                {
                    tile.RasterDataState = TilePropertyState.Error;
                    Progress--;
                    return;
                }

                tile.SetRasterData(rasterTile.Data, _useMipMap, _useCompression);
                tile.RasterDataState = TilePropertyState.Loaded;
                Progress--;
            });
        }
Ejemplo n.º 2
0
 protected override void OnRegistered(UnityTile tile)
 {
     if (_properties.sourceType == ImagerySourceType.None)
     {
         tile.SetRasterData(null);
         tile.RasterDataState = TilePropertyState.None;
         return;
     }
     else
     {
         tile.RasterDataState = TilePropertyState.Loading;
         if (_properties.sourceType != ImagerySourceType.Custom)
         {
             _properties.sourceOptions.layerSource = MapboxDefaultImagery.GetParameters(_properties.sourceType);
         }
         ImageDataFetcherParameters parameters = new ImageDataFetcherParameters()
         {
             canonicalTileId = tile.CanonicalTileId,
             tile            = tile,
             mapid           = MapId,
             useRetina       = _properties.rasterOptions.useRetina
         };
         DataFetcher.FetchData(parameters);
     }
 }
 private void OnImageRecieved(UnityTile tile, RasterTile rasterTile)
 {
     if (tile != null)
     {
         Progress--;
         tile.SetRasterData(rasterTile.Data, _properties.rasterOptions.useMipMap, _properties.rasterOptions.useCompression);
         tile.RasterDataState = TilePropertyState.Loaded;
     }
 }
Ejemplo n.º 4
0
 private void OnImageRecieved(UnityTile tile, RasterTile rasterTile)
 {
     if (tile != null)
     {
         if (tile.RasterDataState != TilePropertyState.Unregistered)
         {
             _tilesWaitingResponse.Remove(tile);
             tile.SetRasterData(rasterTile.Data, _properties.rasterOptions.useMipMap, _properties.rasterOptions.useCompression);
         }
     }
 }
Ejemplo n.º 5
0
 private void OnImageRawLayerRecieved(UnityTile tile, byte[] data, Layers layer)
 {
     if (tile != null)
     {
         if (tile.RasterDataState != TilePropertyState.Unregistered)
         {
             _tilesWaitingResponse.Remove(tile);
             tile.SetRasterData(data, layer, _properties.rasterOptions.useMipMap, _properties.rasterOptions.useCompression);
         }
     }
 }
Ejemplo n.º 6
0
        internal override void OnRegistered(UnityTile tile)
        {
            if (_properties.sourceType == ImagerySourceType.None)
            {
                Progress++;
                Progress--;
                return;
            }

            RasterTile rasterTile;

            if (MapId.StartsWith("mapbox://", StringComparison.Ordinal))
            {
                rasterTile = _properties.rasterOptions.useRetina ? new RetinaRasterTile() : new RasterTile();
            }
            else
            {
                rasterTile = _properties.rasterOptions.useRetina ? new ClassicRetinaRasterTile() : new ClassicRasterTile();
            }

            tile.RasterDataState = TilePropertyState.Loading;

            tile.AddTile(rasterTile);
            Progress++;
            rasterTile.Initialize(_fileSource, tile.CanonicalTileId, MapId, () =>
            {
                if (tile == null)
                {
                    Progress--;
                    return;
                }

                if (rasterTile.HasError)
                {
                    OnErrorOccurred(new TileErrorEventArgs(tile.CanonicalTileId, rasterTile.GetType(), tile, rasterTile.Exceptions));
                    tile.RasterDataState = TilePropertyState.Error;
                    Progress--;
                    return;
                }

                tile.SetRasterData(rasterTile.Data, _properties.rasterOptions.useMipMap, _properties.rasterOptions.useCompression);
                tile.RasterDataState = TilePropertyState.Loaded;
                Progress--;
            });
        }