Esempio n. 1
0
 public GpxTime1_0(GpxTime1_0 t) : base()
 {
     Time = t.Time;
 }
Esempio n. 2
0
        /// <summary>
        /// setzt die Objektdaten aus dem XML-Text
        /// </summary>
        /// <param name="xmltxt"></param>
        /// <param name="removenamespace"></param>
        public override void FromXml(string xmltxt, bool removenamespace = false)
        {
            Init();
            XPathNavigator nav = GetNavigator4XmlText(removenamespace ? RemoveNamespace(xmltxt) : xmltxt);

            string[] tmp = XReadOuterXml(nav, "/" + NODENAME + "/" + GpxMetadata1_1.NODENAME);
            if (tmp != null)
            {
                Metadata = new GpxMetadata1_1(tmp[0]);
            }
            else
            {
                Metadata = new GpxMetadata1_1();

                tmp = XReadOuterXml(nav, "/" + NODENAME + "/" + GpxBounds.NODENAME);
                if (tmp != null)
                {
                    Metadata.Bounds = new GpxBounds(tmp[0]);
                }

                tmp = XReadOuterXml(nav, "/" + NODENAME + "/" + GpxTime1_0.NODENAME);
                if (tmp != null)
                {
                    GpxTime1_0 time = new GpxTime1_0(tmp[0]);
                    Metadata.Time = time.Time;
                }
            }

            Waypoints = new List <GpxWaypoint>();
            tmp       = XReadOuterXml(nav, "/" + NODENAME + "/" + GpxWaypoint.NODENAME);
            if (tmp != null)
            {
                for (int w = 0; w < tmp.Length; w++)
                {
                    Waypoints.Add(new GpxWaypoint(tmp[w]));
                }
            }

            Routes = new List <GpxRoute>();
            tmp    = XReadOuterXml(nav, "/" + NODENAME + "/" + GpxRoute.NODENAME);
            if (tmp != null)
            {
                for (int r = 0; r < tmp.Length; r++)
                {
                    Routes.Add(new GpxRoute(tmp[r]));
                }
            }

            Tracks = new List <GpxTrack>();
            tmp    = XReadOuterXml(nav, "/" + NODENAME + "/" + GpxTrack.NODENAME);
            if (tmp != null)
            {
                for (int t = 0; t < tmp.Length; t++)
                {
                    Tracks.Add(new GpxTrack(tmp[t]));
                }
            }

            // registrieren der unbehandelten Childs
            RegisterUnhandledChild(nav,
                                   "/" + NODENAME + "/*",
                                   new string[] {
                "<" + GpxMetadata1_1.NODENAME + ">",
                "<" + GpxBounds.NODENAME + ">",
                "<" + GpxTime1_0.NODENAME + ">",
                "<" + GpxWaypoint.NODENAME + ">",
                "<" + GpxRoute.NODENAME + ">",
                "<" + GpxTrack.NODENAME + ">",
            });
        }