private void LoadCustomRegionFiles() { try { if (_customVectorRegionFilename == null || !File.Exists(_customVectorRegionFilename)) { return; } string[] files = File.ReadAllLines(_customVectorRegionFilename, Encoding.Default); if (files == null || files.Length == 0) { return; } foreach (string f in files) { string[] parts = f.Split('$'); if (parts.Length != 2) { continue; } VectorTempFeatureCategory c = new VectorTempFeatureCategory(parts[0].ToUpper(), parts[1]); if (_customRegions == null) { _customRegions = new List <string>(); } _customRegions.Add(parts[0].ToUpper()); _categories.Add(c); _customRegions.Add(parts[0]); } } catch (Exception ex) { throw new Exception("frmStatSubRegionTemplate :LoadCustomRegionFiles ", ex); } }
private void treeView1_MouseClick(object sender, MouseEventArgs e) { if (notLoadFeatures || e.Button == MouseButtons.Right) { return; } TreeNode tn = treeView1.GetNodeAt(e.Location); if (tn == null) { return; } listView1.Items.Clear(); listView1.Columns.Clear(); cbFields.Items.Clear(); if (tn.Tag != null) { VectorTempFeatureCategory c = tn.Tag as VectorTempFeatureCategory; if (c != null) { Feature[] fets = c.LoadFeatures(); if (fets == null || fets.Length == 0) { return; } AddVectoreFeaturesToListView(fets); _selectUrl = c.Urls[0]; } } }
private void InitCategories(Dictionary <string, string> fileDirList) { treeView1.Nodes.Clear(); // foreach (string keyItem in fileDirList.Keys) { string shpFileName = VectorAOITemplate.FindVectorFullname(fileDirList[keyItem]); if (!string.IsNullOrEmpty(shpFileName)) { VectorTempFeatureCategory categoryItem = new VectorTempFeatureCategory(keyItem, shpFileName); _categories.Add(categoryItem); } else { VectorTempFeatureCategory categoryItem = new VectorTempFeatureCategory(keyItem); _categories.Add(categoryItem); } } LoadCustomRegionFiles(); // foreach (VectorTempFeatureCategory c in _categories) { TreeNode tn = new TreeNode(c.Name); tn.Tag = c; treeView1.Nodes.Add(tn); } treeView1.ExpandAll(); // treeView1.SelectedNode = treeView1.Nodes[0]; }
private void SetFeatures(int selectedNum) { if (treeView1.Nodes.Count < selectedNum) { return; } TreeNode landNode = treeView1.Nodes[selectedNum]; VectorTempFeatureCategory c = landNode.Tag as VectorTempFeatureCategory; if (c != null) { Feature[] fets = c.LoadFeatures(); if (fets == null || fets.Length == 0) { return; } AddVectoreFeaturesToListView(fets); } }
private void InitCategories() { treeView1.Nodes.Clear(); // VectorTempFeatureCategory wholeCategory = new VectorTempFeatureCategory("当前区域"); _categories.Add(wholeCategory); // VectorTempFeatureCategory chinaCategory = new VectorTempFeatureCategory("中国边界", VectorAOITemplate.FindVectorFullname("中国边界.shp")); _categories.Add(chinaCategory); // VectorTempFeatureCategory chinaAdminsCategory = new VectorTempFeatureCategory("省级行政区域", VectorAOITemplate.FindVectorFullname("省级行政区域_面.shp")); _categories.Add(chinaAdminsCategory); // VectorTempFeatureCategory cityCategory = new VectorTempFeatureCategory("地区行政区域", VectorAOITemplate.FindVectorFullname("市级行政区域_面.shp")); _categories.Add(cityCategory); // VectorTempFeatureCategory countryCategory = new VectorTempFeatureCategory("县市行政区域", VectorAOITemplate.FindVectorFullname("县级行政区域_面.shp")); _categories.Add(countryCategory); //// //VectorTempFeatureCategory landUseTypeCategory = new VectorTempFeatureCategory("土地利用类型", VectorAOITemplate.FindVectorFullname("土地利用类型_合并.shp")); //_categories.Add(landUseTypeCategory); //// VectorTempFeatureCategory waterBackCategory = new VectorTempFeatureCategory("湖泊", VectorAOITemplate.FindVectorFullname("中国湖泊.shp")); _categories.Add(waterBackCategory); LoadCustomRegionFiles(); // foreach (VectorTempFeatureCategory c in _categories) { TreeNode tn = new TreeNode(c.Name); tn.Tag = c; treeView1.Nodes.Add(tn); } treeView1.ExpandAll(); // treeView1.SelectedNode = treeView1.Nodes[0]; }
private void AddTreeListViewItems(TreeNode tn) { listView1.Items.Clear(); listView1.Columns.Clear(); cbFields.Items.Clear(); if (tn.Tag != null) { VectorTempFeatureCategory c = tn.Tag as VectorTempFeatureCategory; if (c != null) { Feature[] fets = c.LoadFeatures(); if (fets == null || fets.Length == 0) { return; } AddVectoreFeaturesToListView(fets); _selectUrl = c.Urls[0]; } } }