コード例 #1
0
        public override void OnClick()
        {
            const string url       = "https://bertt.github.io/wmts/capabilities/nokia.xml";
            var          wmtsLayer = WmtsHelper.GetWmtsLayer(_application, "png", url, "Nokia streets", "nokia-streets");
            var          mxdoc     = (IMxDocument)_application.Document;
            var          map       = mxdoc.FocusMap;

            ((IMapLayers)map).InsertLayer(wmtsLayer, true, 0);
        }
コード例 #2
0
        public override void OnClick()
        {
            var mxdoc      = (IMxDocument)_application.Document;
            var tileSource = KnownTileSources.Create(KnownTileSource.BingHybrid);
            var wmtsLayer  = WmtsHelper.GetWmtsLayer(_application, tileSource, "Bing Hybrid");
            var map        = mxdoc.FocusMap;

            ((IMapLayers)map).InsertLayer(wmtsLayer, true, 0);
        }
コード例 #3
0
 public override void OnClick()
 {
     try
     {
         const string url       = "https://bertt.github.io/wmts/capabilities/osm.xml";
         var          wmtsLayer = WmtsHelper.GetWmtsLayer(_application, "png", url, "OpenStreetMap.FR", "osm-openstreetmap.fr");
         var          mxdoc     = (IMxDocument)_application.Document;
         var          map       = mxdoc.FocusMap;
         ((IMapLayers)map).InsertLayer(wmtsLayer, true, 0);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #4
0
        public override void OnClick()
        {
            try
            {
                const string url       = "https://bertt.github.io/wmts/capabilities/thunderforest.xml";
                var          wmtsLayer = WmtsHelper.GetWmtsLayer(_application, "png", url, "Landscape", "thunderforest-landscape");

                var mxdoc = (IMxDocument)_application.Document;
                var map   = mxdoc.FocusMap;
                ((IMapLayers)map).InsertLayer(wmtsLayer, true, 0);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #5
0
        private void AddStravaLayer(StravaColor stravaColor, StravaActivityType stravaActivityType)
        {
            const string url       = "http://bertt.github.io/wmts/capabilities/strava2017.xml";
            var          wmtsLayer = WmtsHelper.GetWmtsLayer(_application, "png", url, $"Strava 2017 - {stravaActivityType.ToString()}", "strava-riding");
            var          prov      = (HttpTileProvider)wmtsLayer.TileSource.Provider;

            foreach (var resourceUrl in ((WmtsRequest)prov.Request)._resourceUrls)
            {
                var template = resourceUrl.Template;
                template             = template.Replace("{color}", stravaColor.ToString());
                template             = template.Replace("{activity_type}", stravaActivityType.ToString());
                resourceUrl.Template = template;
            }
            var schema = (WmtsTileSchema)wmtsLayer.TileSource.Schema;

            schema.Layer = $"strava-{stravaColor.ToString()}-{stravaActivityType.ToString()}";
            wmtsLayer.TileSource.Schema = schema;

            var mxdoc = (IMxDocument)_application.Document;
            var map   = mxdoc.FocusMap;

            ((IMapLayers)map).InsertLayer(wmtsLayer, true, 0);
        }