Exemplo n.º 1
0
        private static Map InitializeMapGoogle(GoogleMapType mt)
        {
            Map map = new Map();

            GoogleRequest req;
            ITileSource   tileSource;
            TileLayer     tileLayer;

            if (mt == (GoogleMapType.GoogleSatellite | GoogleMapType.GoogleLabels))
            {
                req        = new GoogleRequest(GoogleMapType.GoogleSatellite);
                tileSource = new GoogleTileSource(req);
                tileLayer  = new TileLayer(tileSource, "TileLayer - " + GoogleMapType.GoogleSatellite);
                map.Layers.Add(tileLayer);
                req        = new GoogleRequest(GoogleMapType.GoogleLabels);
                tileSource = new GoogleTileSource(req);
                mt         = GoogleMapType.GoogleLabels;
            }
            else
            {
                req        = new GoogleRequest(mt);
                tileSource = new GoogleTileSource(req);
            }

            tileLayer = new TileLayer(tileSource, "TileLayer - " + mt);
            map.Layers.Add(tileLayer);
            map.ZoomToBox(tileLayer.Envelope);
            return(map);
        }
Exemplo n.º 2
0
    public static SharpMap.Map InitializeGoogleMap(GoogleMapType mt)
    {
        SharpMap.Map map = new SharpMap.Map();

        GoogleRequest  req;
        ITileSource    tileSource;
        TileAsyncLayer tileLayer;

        if (mt == (GoogleMapType.GoogleSatellite | GoogleMapType.GoogleLabels))
        {
            req        = new GoogleRequest(GoogleMapType.GoogleSatellite);
            tileSource = new GoogleTileSource(req);
            tileLayer  = new TileAsyncLayer(tileSource, "TileLayer - " + GoogleMapType.GoogleSatellite);
            map.Layers.Add(tileLayer);
            req        = new GoogleRequest(GoogleMapType.GoogleLabels);
            tileSource = new GoogleTileSource(req);
            mt         = GoogleMapType.GoogleLabels;
        }
        else
        {
            req        = new GoogleRequest(mt);
            tileSource = new GoogleTileSource(req);
        }

        tileLayer = new TileAsyncLayer(tileSource, "TileLayer - " + mt);
        map.BackgroundLayer.Add(tileLayer);
        map.ZoomToBox(tileLayer.Envelope);
        return(map);
    }
Exemplo n.º 3
0
        private bool InitializeBrutileProvider()
        {
            if (this.TileServerName.Equals(Properties.Resources.BingHybrid, StringComparison.InvariantCultureIgnoreCase))
            {
                string token = String.Empty;
                string url   = string.IsNullOrWhiteSpace(token)
                ? BingRequest.UrlBingStaging
                : BingRequest.UrlBing;

                TileSource = new BingTileSource(new BingRequest(url, string.Empty, BingMapType.Hybrid));
                TileCache  = new MemoryCache <byte[]>(100, 200);

                return(true);
            }

            if (this.TileServerName.Equals(Properties.Resources.GoogleSatellite, StringComparison.InvariantCultureIgnoreCase))
            {
                TileSource = new GoogleTileSource(GoogleMapType.GoogleSatellite);
                TileCache  = new MemoryCache <byte[]>(100, 200);

                return(true);
            }

            if (this.TileServerName.Equals(Properties.Resources.GoogleMap, StringComparison.InvariantCultureIgnoreCase))
            {
                TileSource = new GoogleTileSource(GoogleMapType.GoogleMap);
                TileCache  = new MemoryCache <byte[]>(100, 200);

                return(true);
            }

            if (this.TileServerName.Equals(Properties.Resources.YahooMap, StringComparison.InvariantCultureIgnoreCase))
            {
                /*
                 * TileSource = new YahooTileSource(YahooMapType.YahooMap);
                 * TileCache = new MemoryCache<byte[]>(100, 200);
                 * return true;
                 */
            }

            if (this.TileServerName.Equals(Properties.Resources.YahooSatellite, StringComparison.InvariantCultureIgnoreCase))
            {
                /*
                 * TileSource = new YahooTileSource(YahooMapType.YahooSatellite);
                 * TileCache = new MemoryCache<byte[]>(100, 200);
                 * return true;
                 */
            }

            if (this.TileServerName.Equals(Properties.Resources.WMSMap, StringComparison.InvariantCultureIgnoreCase))
            {
                TileSource = WmsTileSource.Create(WmsServerInfo);
                TileCache  = new MemoryCache <byte[]>(100, 200);

                return(true);
            }

            TileSource = null;
            TileCache  = null;

            return(false);
        }