コード例 #1
0
        public override void OnClick()
        {
            try
            {
                var mxdoc = (IMxDocument)_application.Document;
                _map = mxdoc.FocusMap;

                var addWmsCForm = new AddWmsCForm();
                var result = addWmsCForm.ShowDialog(new ArcMapWindow(_application));

                if (result == DialogResult.OK)
                {
                    var tileSource = addWmsCForm.SelectedTileSource;

                    IConfig configWmsC = new ConfigWmsC(tileSource);
                    var brutileLayer = new BruTileLayer(_application,configWmsC)
                    {
                        Name = configWmsC.CreateTileSource().Schema.Name,
                        Visible = true
                    };
                    _map.AddLayer(brutileLayer);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
        public override void OnClick()
        {
            try
            {
                var mxdoc = (IMxDocument)_application.Document;
                var map = mxdoc.FocusMap;
                var brutileLayer = new BruTileLayer(_application, _enumBruTileLayer)
                {
                    Name = m_name,
                    Visible = true
                };

                map.AddLayer(brutileLayer);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
        public override void OnClick()
        {
            try
            {
                var mxdoc = (IMxDocument)_application.Document;
                var map = mxdoc.FocusMap;

                var addServicesForm = new AddServicesForm();

                var result = addServicesForm.ShowDialog(new ArcMapWindow(_application));
                if (result == DialogResult.OK)
                {
                    var selectedService = addServicesForm.SelectedService;

                    // Fix the service labs.metacarta.com bug: it doubles the version :-(
                    selectedService.Href = selectedService.Href.Replace(@"1.0.0/1.0.0", @"1.0.0").Trim();

                    var layerType=EnumBruTileLayer.TMS;

                    // If the type is inverted TMS we have to do something special
                    if (selectedService.Type != null)
                    {
                        if (selectedService.Type == "InvertedTMS")
                        {
                            layerType = EnumBruTileLayer.InvertedTMS;
                        }
                    }

                    var brutileLayer = new BruTileLayer(_application, layerType, selectedService.Href, selectedService.OverwriteUrls)
                    {
                        Name = selectedService.Title,
                        Visible = true
                    };
                    map.AddLayer(brutileLayer);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }