public void AddAttributeTable(IFeature pFeature, GmpPoint pGmpPoint, int j) { try { pFeature.set_Value(pFeature.Fields.FindField("PointType"), pGmpPoint.szPointType); pFeature.set_Value(pFeature.Fields.FindField("speed"), pGmpPoint.speed); pFeature.set_Value(pFeature.Fields.FindField("规划开始时间"), pGmpPoint.szPSTime); pFeature.set_Value(pFeature.Fields.FindField("规划时长"), pGmpPoint.szPTSTime); pFeature.set_Value(pFeature.Fields.FindField("行走开始时间"), pGmpPoint.szWSTime); pFeature.set_Value(pFeature.Fields.FindField("行走时长"), pGmpPoint.szWTSTime); pFeature.set_Value(pFeature.Fields.FindField("探测开始时间"), pGmpPoint.szESTime); pFeature.set_Value(pFeature.Fields.FindField("探测时长"), pGmpPoint.szETSTime); pFeature.set_Value(pFeature.Fields.FindField("探测结束时间"), pGmpPoint.szEETTime); pFeature.Store(); } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
public bool ReadGmpXML(string XMLPath) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(XMLPath); XmlNode xn = xmlDoc.SelectSingleNode(@"cmlRoot/szMacroNum"); if (xn != null) { szMacroNum = xn.InnerText; } xn = xmlDoc.SelectSingleNode(@"cmlRoot/uiPointNum"); if (xn != null) { uiPointNum = Convert.ToInt32(xn.InnerText); } XmlNodeList xnl = xmlDoc.SelectNodes(@"cmlRoot/stPointInfo"); foreach (XmlNode xNod in xnl) { GmpPoint GmpPointTemp = new GmpPoint(); XmlNode xmlnode = xNod.SelectSingleNode("szPointType"); if (xmlnode != null) { GmpPointTemp.szPointType = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("dPointY"); if (xmlnode != null) { GmpPointTemp.dPointX = double.Parse(xmlnode.InnerText); } xmlnode = xNod.SelectSingleNode("dPointX"); if (xmlnode != null) { GmpPointTemp.dPointY = double.Parse(xmlnode.InnerText); } xmlnode = xNod.SelectSingleNode("speed"); if (xmlnode != null) { GmpPointTemp.speed = double.Parse(xmlnode.InnerText); } xmlnode = xNod.SelectSingleNode("szPSTime"); if (xmlnode != null) { GmpPointTemp.szPSTime = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("szPTSTime"); if (xmlnode != null) { GmpPointTemp.szPTSTime = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("szWSTime"); if (xmlnode != null) { GmpPointTemp.szWSTime = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("szWTSTime"); if (xmlnode != null) { GmpPointTemp.szWTSTime = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("szESTime"); if (xmlnode != null) { GmpPointTemp.szESTime = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("szETSTime"); if (xmlnode != null) { GmpPointTemp.szETSTime = xmlnode.InnerText; } xmlnode = xNod.SelectSingleNode("szEETTime"); if (xmlnode != null) { GmpPointTemp.szEETTime = xmlnode.InnerText; } GmpPointS.Add(GmpPointTemp); } return(true); } catch (System.Exception ex) { return(false); } }