Exemple #1
0
        private void SaveTilesHandler(Layer layer, string[,] tileUrls, System.Drawing.Image[,] tileImages)
        {
            MapTileLayer layer2 = GetLayer(layer.Name);

            if (Embedded(layer2) || m_success)
            {
                return;
            }
            int num  = tileUrls.GetUpperBound(0) + 1;
            int num2 = tileUrls.GetUpperBound(1) + 1;

            for (int i = 0; i < num; i++)
            {
                for (int j = 0; j < num2; j++)
                {
                    string url = tileUrls[i, j];
                    System.Drawing.Image image = tileImages[i, j];
                    using (MemoryStream memoryStream = new MemoryStream())
                    {
                        image.Save(memoryStream, ImageFormat.Png);
                        if (layer2.Instance.GetTileData(url, out string _) == null)
                        {
                            layer2.Instance.SetTileData(url, memoryStream.ToArray(), null);
                        }
                    }
                }
            }
        }
Exemple #2
0
        private System.Drawing.Image GetSnapshotTile(MapTileLayer mapTileLayer, string url)
        {
            string mimeType;
            Stream tileData = mapTileLayer.Instance.GetTileData(url, out mimeType);

            if (tileData == null)
            {
                return(null);
            }
            return(System.Drawing.Image.FromStream(tileData));
        }
Exemple #3
0
        private bool GetUseSecureConnection(MapTileLayer mapTileLayer)
        {
            ReportBoolProperty useSecureConnection = mapTileLayer.UseSecureConnection;

            if (useSecureConnection == null)
            {
                return(false);
            }
            if (!useSecureConnection.IsExpression)
            {
                return(useSecureConnection.Value);
            }
            return(mapTileLayer.Instance.UseSecureConnection);
        }
Exemple #4
0
 private System.Drawing.Image GetEmbeddedTile(MapTileLayer mapTileLayer, string url)
 {
     foreach (MapTile mapTile in mapTileLayer.MapTiles)
     {
         if (mapTile.Name == url)
         {
             using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(mapTile.TileData)))
             {
                 return(System.Drawing.Image.FromStream(stream));
             }
         }
     }
     return(null);
 }
Exemple #5
0
        private TileSystem GetTileSystem(MapTileLayer mapTileLayer)
        {
            ReportEnumProperty <MapTileStyle> tileStyle = mapTileLayer.TileStyle;
            MapTileStyle mapTileStyle = MapTileStyle.Road;

            if (tileStyle != null)
            {
                mapTileStyle = (tileStyle.IsExpression ? mapTileLayer.Instance.TileStyle : tileStyle.Value);
            }
            switch (mapTileStyle)
            {
            case MapTileStyle.Aerial:
                return(TileSystem.VirtualEarthAerial);

            case MapTileStyle.Hybrid:
                return(TileSystem.VirtualEarthHybrid);

            default:
                return(TileSystem.VirtualEarthRoad);
            }
        }
Exemple #6
0
        private System.Drawing.Image[,] LoadTilesHandler(Layer layer, string[,] tileUrls)
        {
            System.Drawing.Image[,] array = null;
            int          num    = tileUrls.GetUpperBound(0) + 1;
            int          num2   = tileUrls.GetUpperBound(1) + 1;
            MapTileLayer layer2 = GetLayer(layer.Name);

            try
            {
                for (int i = 0; i < num; i++)
                {
                    for (int j = 0; j < num2; j++)
                    {
                        System.Drawing.Image image = (!Embedded(layer2)) ? GetSnapshotTile(layer2, tileUrls[i, j]) : GetEmbeddedTile(layer2, tileUrls[i, j]);
                        if (image == null)
                        {
                            DisposeTiles(array, num, num2);
                            return(null);
                        }
                        if (array == null)
                        {
                            array = new System.Drawing.Image[num, num2];
                        }
                        array[i, j] = image;
                    }
                }
            }
            catch (Exception e)
            {
                if (AsynchronousExceptionDetection.IsStoppingException(e))
                {
                    throw;
                }
                DisposeTiles(array, num, num2);
                return(null);
            }
            m_success = (array != null);
            return(array);
        }
Exemple #7
0
 internal MapTileLayerInstance(MapTileLayer defObject)
     : base(defObject)
 {
     m_defObject = defObject;
 }
Exemple #8
0
 private bool Embedded(MapTileLayer mapTileLayer)
 {
     return(mapTileLayer.MapTiles != null);
 }
Exemple #9
0
 internal void AddLayer(MapTileLayer mapTileLayer)
 {
     m_mapTileLayers.Add(mapTileLayer.Name, mapTileLayer);
     m_coreMap.Layers[mapTileLayer.Name].TileSystem = GetTileSystem(mapTileLayer);
     m_coreMap.Layers[mapTileLayer.Name].UseSecureConnectionForTiles = GetUseSecureConnection(mapTileLayer);
 }