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("frmStatProvinceRegionTemplates :LoadCustomRegionFiles ", ex);
     }
 }
Beispiel #2
0
        private void InitCategories()
        {
            treeView1.Nodes.Clear();
            //VectorTempFeatureCategory wholeCategory = new VectorTempFeatureCategory("当前区域");
            //_categories.Add(wholeCategory);
            VectorTempFeatureCategory chinaAdminsCategory = new VectorTempFeatureCategory("省级行政区域", VectorAOITemplate.FindVectorFullname("省级行政区域_面.shp"));
            VectorTempFeatureCategory chinaCategory       = new VectorTempFeatureCategory("中国边界", VectorAOITemplate.FindVectorFullname("中国边界.shp"));

            _categories.Add(chinaCategory);
            _categories.Add(chinaAdminsCategory);
            //VectorTempFeatureCategory cityCategory = new VectorTempFeatureCategory("地区行政区域", VectorAOITemplate.FindVectorFullname("市级行政区域_面.shp"));
            //_categories.Add(cityCategory);
            //VectorTempFeatureCategory countryCategory = new VectorTempFeatureCategory("县市行政区域", VectorAOITemplate.FindVectorFullname("县级行政区域_面.shp"));
            //_categories.Add(countryCategory);
            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];
            listView1.MultiSelect  = true;
            btnSelectAll.Visible   = btnUnSelectAll.Visible = true;
        }
        private void InitCategories()
        {
            listView1.Items.Clear();
            listView1.Columns.Clear();
            cbFields.Items.Clear();
            VectorTempFeatureCategory c = new VectorTempFeatureCategory("省级行政区域", VectorAOITemplate.FindVectorFullname("省级行政区域_面.shp"));

            if (c != null)
            {
                Feature[] fets = c.LoadFeatures();
                if (fets == null || fets.Length == 0)
                {
                    return;
                }
                AddVectoreFeaturesToListView(fets);
                _selectUrl = c.Urls[0];
            }
            LoadCustomRegionFiles();
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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];
         }
     }
 }
Beispiel #6
0
        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];
        }