Esempio n. 1
0
 /// <summary>
 /// 读取路径节点信息
 /// </summary>
 /// <param name="mapModel"></param>
 public void readNodeData(MapModel mapModel)
 {
     // 清除原路径信息
     mapModel.Points.Clear();
     // 读取对应节点
     node = file.readData();
     node = node.SelectSingleNode("/" + MapInfo.root + "/" + MapInfo.typeP);
     for (int i = 0; i < node.ChildNodes.Count; ++i)
     {
         int     id      = i + 1;
         XmlNode subNode = node.ChildNodes[i];
         // 使用反射装配属性值
         KeyPoint p = new KeyPoint();
         for (int j = 0; j < subNode.ChildNodes.Count; ++j)
         {
             XmlNode pointNode = subNode.ChildNodes[j];
             // 剔除不存在属性
             if (SearchUtil.getItemIndex(MapInfo.pItem, pointNode.Name) == -1)
             {
                 continue;
             }
             // 装配属性值
             ValSet.SetModelValue(pointNode.Name, pointNode.InnerText, p);
         }
         mapModel.Points.Add(p);
     }
     //
     // 读取对应的切割线段信息
     //
     node = node.SelectSingleNode("/" + MapInfo.root + "/" + MapInfo.typeS);
     for (int i = 0; node != null && i < node.ChildNodes.Count; ++i)
     {
         mapModel.Segments.Add(readSegNode(node.ChildNodes[i]));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 将配置文件信息保存到参数模型中
 /// </summary>
 /// <param name="InfoModel"></param>
 public void readNodeData(StrModel infoModel)
 {
     node = file.readData();
     foreach (XmlNode subNode in node.ChildNodes)
     {
         int index = SearchUtil.getItemIndex(SPAM.paramName, subNode.Name);
         if (index != -1)
         {
             infoModel.Data[index] = subNode.InnerText;
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 将界面信息保存到文件
 /// </summary>
 /// <param name="InfoModel"></param>
 public bool saveNodeData(StrModel infoModel)
 {
     if (node == null)
     {
         node = file.readData();
     }
     foreach (XmlNode subNode in node.ChildNodes)
     {
         int index = SearchUtil.getItemIndex(SPAM.paramName, subNode.Name);
         if (index != -1)
         {
             subNode.InnerText = infoModel.Data[index];
         }
     }
     return(file.saveData());
 }