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>
 public override void updateInfo()
 {
     for (int i = 0; i < FieldName.Length; ++i)
     {
         ValSet.SetModelValue(FieldName[i], DataArea.infoModel.Data[FieldId[i]], this);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 读取segment节点信息
        /// </summary>
        private Segment readSegNode(XmlNode segNode)
        {
            Segment ans = new Segment();

            for (int i = 0; i < segNode.ChildNodes.Count; ++i)
            {
                XmlNode sub = segNode.ChildNodes[i];
                // 填充节点信息
                SimPoint simP = new SimPoint();
                for (int j = 0; j < sub.ChildNodes.Count; ++j)
                {
                    ValSet.SetModelValue(sub.ChildNodes[j].Name, sub.ChildNodes[j].InnerText, simP);
                }
                // 添加至左侧或者右侧
                if (sub.Name.Equals(MapInfo.detLS))
                {
                    ans.LeftP.Add(simP);
                }
                else
                {
                    ans.RightP.Add(simP);
                }
            }
            return(ans);
        }