/// <summary> /// Reads waypoints from the user selected Navi path file. /// </summary> /// <param name="waypointFatigueList">Waypoint list to reference</param> /// <returns>Number of entries in the Navi path file</returns> public static int ReadWaypointsFromXML(WaypointListEnum waypointFatigueList) { OpenFileDialog ofd = new OpenFileDialog(); DialogResult result = ofd.ShowDialog(); if (result == DialogResult.OK) { try { var xdoc = XDocument.Load(ofd.FileName, LoadOptions.None); var WaypointField = new List<WaypointsXML>(); foreach (var waypoint in xdoc.Descendants("Path").Descendants()) { if (waypoint.Attribute("x") != null) { WaypointsXML _position = new WaypointsXML(); _position.X = float.Parse(waypoint.Attribute("x").Value); _position.Y = float.Parse(waypoint.Attribute("y").Value); _position.Z = float.Parse(waypoint.Attribute("z").Value); _position.Zone = Int32.Parse(waypoint.Attribute("zone").Value); WaypointField.Add(_position); } } if (waypointFatigueList == WaypointListEnum.WaypointFatigueList) WaypointFatigueList = WaypointField; else if (waypointFatigueList == WaypointListEnum.WaypointListXML) WaypointListXML = WaypointField; return WaypointField.Count; } catch (Exception ex) { MessageBox.Show(ex.ToString()); throw; } } return 0; }
private static void RunToExactLastPoint(WaypointsXML lastwaypoint) { _FFACE.Navigator.DistanceTolerance = 0.5f; _FFACE.Navigator.Goto(lastwaypoint.X, lastwaypoint.Y, lastwaypoint.Z, false); _FFACE.Navigator.DistanceTolerance = 3f; }