Ejemplo n.º 1
0
        public RteLoop(int iterationCount)
        {
            Rte = MakeRunTimeEnvironment();
            Rte.AddOrUpdate(new Line(FirstLineLabel, new Nop()));
            Rte.StartRun();
            Rte.Runner.MoveNext();

            Loop = MakeLoop(iterationCount);
        }
Ejemplo n.º 2
0
        public void TestGprte()
        {
            string input = "$GPRTE,2,1,c,0,W3IWI,DRIVWY,32CEDR,32-29,32BKLD,32-I95,32-US1,BW-32,BW-198*69";
            var    msg   = NmeaMessage.Parse(input);

            Assert.IsInstanceOfType(msg, typeof(Rte));
            Rte rte = (Rte)msg;

            Assert.IsFalse(((IMultiSentenceMessage)rte).IsComplete);
            Assert.AreEqual(Rte.WaypointListType.CompleteWaypointsList, rte.ListType);
            Assert.AreEqual("0", rte.RouteId);
            Assert.AreEqual("0", rte.RouteId);
            Assert.AreEqual(9, rte.Waypoints.Count);
            Assert.AreEqual("W3IWI", rte.Waypoints[0]);
            Assert.AreEqual("32BKLD", rte.Waypoints[4]);
            Assert.AreEqual("BW-198", rte.Waypoints[8]);
        }
Ejemplo n.º 3
0
        public void TestGprte()
        {
            string input = "$GPRTE,2,1,c,0,W3IWI,DRIVWY,32CEDR,32-29,32BKLD,32-I95,32-US1,BW-32,BW-198*69";
            var    msg   = NmeaMessage.Parse(input);

            Assert.IsInstanceOfType(msg, typeof(Rte));
            Rte gsv = (Rte)msg;

            Assert.AreEqual(2, gsv.TotalMessages);
            Assert.AreEqual(1, gsv.MessageNumber);
            Assert.AreEqual(Rte.WaypointListType.CompleteWaypointsList, gsv.ListType);
            Assert.AreEqual("0", gsv.RouteId);
            Assert.AreEqual("0", gsv.RouteId);
            Assert.AreEqual(9, gsv.Waypoints.Count);
            Assert.AreEqual("W3IWI", gsv.Waypoints[0]);
            Assert.AreEqual("32BKLD", gsv.Waypoints[4]);
            Assert.AreEqual("BW-198", gsv.Waypoints[8]);
        }
Ejemplo n.º 4
0
        public GpxReader(string xml)
        {
            if (xml.Equals(""))
            {
                return;
            }
            _gpx.LoadXml(xml);
            if (_gpx.DocumentElement == null || !_gpx.DocumentElement.Name.Equals("gpx"))
            {
                return;
            }
            var gpxNodes = _gpx.GetElementsByTagName("gpx")[0].ChildNodes;

            foreach (XmlNode node in gpxNodes)
            {
                switch (node.Name)
                {
                case "name":
                    Name = node.InnerText;
                    break;

                case "desc":
                    Description = node.InnerText;
                    break;

                case "author":
                    Author = node.InnerText;
                    break;

                case "email":
                    EMail = node.InnerText;
                    break;

                case "time":
                    Time = node.InnerText;
                    break;

                case "keywords":
                    KeyWords = node.InnerText;
                    break;

                case "bounds":
                    Bounds = new GpsBoundary();
                    if (node.Attributes != null)
                    {
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "minlat":
                                Bounds.Min.Lat = att.Value;
                                break;

                            case "minlon":
                                Bounds.Min.Lon = att.Value;
                                break;

                            case "maxlat":
                                Bounds.Max.Lat = att.Value;
                                break;

                            case "maxlon":
                                Bounds.Max.Lon = att.Value;
                                break;
                            }
                        }
                    }
                    break;

                case "wpt":
                    var newWayPoint = new Wpt(node);
                    WayPoints.Add(newWayPoint);
                    break;

                case "rte":
                    var newRoute = new Rte(node);
                    Routes.Add(newRoute);
                    break;

                case "trk":
                    var track = new Trk(node);
                    Tracks.Add(track);
                    break;

                case "url":
                    Url = node.InnerText;
                    break;

                case "urlname":
                    UrlName = node.InnerText;
                    break;

                case "topografix:active_point":
                case "topografix:map":
                    break;

                default:
                    Logger.Write("Unhandled data in GPX file, attempting to skip.", LogLevel.Info);
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        public GpxReader(string xml, ISession session)
        {
            _ctx = session;
            if (xml.Equals(""))
            {
                return;
            }
            _gpx.LoadXml(xml);
            if (_gpx.DocumentElement == null || !_gpx.DocumentElement.Name.Equals("gpx"))
            {
                return;
            }
            var gpxNodes = _gpx.GetElementsByTagName("gpx")[0].ChildNodes;

            foreach (XmlNode node in gpxNodes)
            {
                switch (node.Name)
                {
                case "name":
                    Name = node.InnerText;
                    break;

                case "desc":
                    Description = node.InnerText;
                    break;

                case "author":
                    Author = node.InnerText;
                    break;

                case "email":
                    EMail = node.InnerText;
                    break;

                case "time":
                    Time = node.InnerText;
                    break;

                case "keywords":
                    KeyWords = node.InnerText;
                    break;

                case "bounds":
                    Bounds = new GpsBoundary();
                    if (node.Attributes != null)
                    {
                        foreach (XmlAttribute att in node.Attributes)
                        {
                            switch (att.Name)
                            {
                            case "minlat":
                                Bounds.Min.Lat = att.Value;
                                break;

                            case "minlon":
                                Bounds.Min.Lon = att.Value;
                                break;

                            case "maxlat":
                                Bounds.Max.Lat = att.Value;
                                break;

                            case "maxlon":
                                Bounds.Max.Lon = att.Value;
                                break;
                            }
                        }
                    }
                    break;

                case "wpt":
                    var newWayPoint = new Wpt(node);
                    WayPoints.Add(newWayPoint);
                    break;

                case "rte":
                    var newRoute = new Rte(node);
                    Routes.Add(newRoute);
                    break;

                case "trk":
                    var track = new Trk(node);
                    Tracks.Add(track);
                    break;

                case "url":
                    Url = node.InnerText;
                    break;

                case "urlname":
                    UrlName = node.InnerText;
                    break;

                case "topografix:active_point":
                case "topografix:map":
                    break;

                default:
                    session.EventDispatcher.Send(new WarnEvent()
                    {
                        Message = session.Translation.GetTranslation(TranslationString.UnhandledGpxData)
                    });
                    break;
                }
            }
        }