private void ReadSettings() { cboWmts.Items.Clear(); var settings = Path.Combine(Application.LocalUserAppDataPath, "BruTileLayer", "wmts.config"); if (!File.Exists(settings)) { return; } using (var streamReader = new StreamReader(File.OpenRead(settings))) { while (!streamReader.EndOfStream) { var line = streamReader.ReadLine(); if (string.IsNullOrEmpty(line)) { continue; } if (line.Length < 7) { continue; } if (line.StartsWith("#")) { continue; } cboWmts.Items.Add(WmsConnectionInfo.Parse(line)); } } if (cboWmts.Items.Count > 0) { cboWmts.SelectedIndex = 0; } }
private void FillTree(WmsConnectionInfo connectionInfo) { lvwWmtsLayers.Items.Clear(); //Trying to get more information about layers to display XDocument doc; var req = (HttpWebRequest)WebRequest.Create(connectionInfo.Url); if (!string.IsNullOrEmpty(connectionInfo.Username)) { req.Credentials = new NetworkCredential(connectionInfo.Username, connectionInfo.Password); } if (!string.IsNullOrEmpty(connectionInfo.Referrer)) { req.Referer = connectionInfo.Referrer; } var tileSources = new List <ITileSource>(); using (var resp = req.GetResponse()) { using (var s = resp.GetResponseStream()) { tileSources.AddRange(WmtsParser.Parse(s)); } } foreach (var tileSource in tileSources) { var tmp = (WmtsTileSchema)tileSource.Schema; var n = lvwWmtsLayers.Items.Add(tmp.Identifier); n.SubItems.Add(tmp.Format); n.SubItems.Add(tmp.Style); n.SubItems.Add(tileSource.Name); n.SubItems.Add(tmp.Abstract); n.SubItems.Add(tmp.Name); n.SubItems.Add(tmp.Srs); n.Tag = tileSource; } }
private void FillTree(WmsConnectionInfo connectionInfo) { lvwWmtsLayers.Items.Clear(); //Trying to get more information about layers to display XDocument doc; var req = (HttpWebRequest)WebRequest.Create(connectionInfo.Url); if (!string.IsNullOrEmpty(connectionInfo.Username) ) req.Credentials = new NetworkCredential(connectionInfo.Username, connectionInfo.Password); if (!string.IsNullOrEmpty(connectionInfo.Referrer)) req.Referer = connectionInfo.Referrer; var tileSources = new List<ITileSource>(); using (var resp = req.GetResponse()) { using (var s = resp.GetResponseStream()) { tileSources.AddRange(WmtsParser.Parse(s)); } } foreach (var tileSource in tileSources) { var tmp = (WmtsTileSchema)tileSource.Schema; var n = lvwWmtsLayers.Items.Add(tmp.Identifier); n.SubItems.Add(tmp.Format); n.SubItems.Add(tmp.Style); n.SubItems.Add(tileSource.Name); n.SubItems.Add(tmp.Abstract); n.SubItems.Add(tmp.Name); n.SubItems.Add(tmp.Srs); n.Tag = tileSource; } }