Ejemplo n.º 1
0
        private void rdbActivityTypeChanged(object sender, EventArgs e)
        {
            var rdb = (RadioButton)sender;

            if (rdb.Checked)
            {
                StravaActivityType = GetActivityTypeOption(rdb);
            }
        }
Ejemplo n.º 2
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);
        }