private BandValueColorPair[] GetBandValueColorPairs() { L2ColorTableParser p = null; string indexSpacename = null; GetSelectedColorTable(out p, out indexSpacename); if (p != null && indexSpacename != null) { return(p.GetBandValueColorPairByIndexSpacename(indexSpacename)); } return(null); }
private void GetSelectedColorTable(out L2ColorTableParser p, out string indexSpacename) { p = null; indexSpacename = null; TreeNode tn = tvColotTables.SelectedNode; if (tn == null || tn.Tag == null || tn.Tag.ToString() != "BandValue") { MsgBox.ShowInfo("请从左边填色方案树中索引空间节点下选择要应用的索引空间。\n\n系统会根据索引空间查找对应的颜色表。"); return; } indexSpacename = tn.Text; p = tn.Parent.Parent.Tag as L2ColorTableParser; }
private string GetTipsByFile(L2ColorTableParser p) { string sApplyFor = string.Empty; if (p.ApplyFor != null) { foreach (string s in p.ApplyFor) { sApplyFor += (s + ","); } sApplyFor.Substring(0, sApplyFor.Length - 1); } return(p.Name + "\n" + sApplyFor + "\n" + p.Description); }
private void LoadBandValueNodes(TreeNode tn, L2ColorTableParser p) { string[] tips = null; string[] names = p.GetBandValueRanges(out tips); if (names == null || names.Length == 0) { return; } foreach (string n in names) { TreeNode t = new TreeNode(n); t.Tag = "BandValue"; tn.Nodes.Add(t); _nodeTips.Add(t, p.GetBandValueTips(n)); } string strTips = null; foreach (string s in tips) { strTips += (s + "\n"); } _nodeTips.Add(tn, strTips.Substring(0, strTips.Length - 1)); }
private void frmL2ColorTable_Load(object sender, EventArgs e) { string dir = AppDomain.CurrentDomain.BaseDirectory + @"SystemData\L2ColorTableFiles"; string[] files = Directory.GetFiles(dir, "*.xml"); if (files == null || files.Length == 0) { return; } foreach (string f in files) { string name = Path.GetFileNameWithoutExtension(f); TreeNode tn = new TreeNode(name); L2ColorTableParser p = new L2ColorTableParser(f); tn.Text = tn.Text + "(" + p.Description + ")"; tn.Tag = p; string tips = GetTipsByFile(p); _nodeTips.Add(tn, tips); TreeNode tnIndex = new TreeNode("索引空间"); tnIndex.Tag = "AllIndex"; LoadBandValueNodes(tnIndex, p); tn.Nodes.Add(tnIndex); TreeNode tnColorTable = new TreeNode("颜色表"); tnColorTable.Tag = "AllColorTable"; LoadColorTableNodes(tnColorTable, p); tn.Nodes.Add(tnColorTable); tvColotTables.Nodes.Add(tn); //tn.Expand(); //tnIndex.Expand(); } // if (tvColotTables.Nodes.Count > 0) { FillAttsOfTreeNode(tvColotTables.Nodes[0]); } }