예제 #1
0
 private static void SetFeatureClassForGroup(MajorClass mc, DFWinForms.LogicTree.GroupLayerClass group, Dictionary <string, IFeatureClass> dicfc, Dictionary <string, DF2DFeatureClass> dict)
 {
     if (mc == null || string.IsNullOrEmpty(mc.ClassifyField) || string.IsNullOrEmpty(mc.Fc2D))
     {
         return;
     }
     string[] arrayFc2D = mc.Fc2D.Split(';');
     if (arrayFc2D == null || arrayFc2D.Count() == 0)
     {
         return;
     }
     dict.Clear();
     foreach (string fc2D in arrayFc2D)
     {
         foreach (KeyValuePair <string, IFeatureClass> kv in dicfc)//在<要素类ID,要素类>字典里找到MajorClass对应的要素类,添加到dict中
         {
             if (kv.Key == fc2D)
             {
                 dict[kv.Key] = new DF2DFeatureClass(kv.Value);
                 DF2DFeatureClassManager.Instance.Add(dict[kv.Key]);
                 break;
             }
         }
     }
     if (group is TreeNodeMajorClass2D)
     {
         (group as TreeNodeMajorClass2D).FeatureClasses = dict;                               //设置MajorClass的要素类为dict
     }
 }
예제 #2
0
 private static void SetSubClass(MajorClass mc, DFWinForms.LogicTree.GroupLayerClass group, Dictionary <string, DF2DFeatureClass> dict, Dictionary <string, IFeatureLayer> dicFLs)
 {
     foreach (SubClass sc in mc.SubClasses)
     {
         TreeNodeSubClass2D tnsc = new TreeNodeSubClass2D()
         {
             Name          = sc.Name,
             CustomValue   = sc,
             ClassifyField = mc.ClassifyField,
             DictFLs       = dicFLs
         };
         tnsc.FeatureClasses = dict;
         group.Add(tnsc);
         tnsc.Visible = true;
     }
     group.CollapseAll();
 }