Ejemplo n.º 1
0
        void Start()
        {
            // Model reference.
            SegmentSource segmentSource_ = GetComponent <SegmentSource>();

            segment = segmentSource_.segment;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Получение сегментов маршрутов транспорта
        /// </summary>
        /// <returns>The segments.</returns>
        /// <param name="trk">Trk.</param>
        public static SegmentSource ToSegmentSource(this IEnumerable <XElement> trk)
        {
            if (trk == null)
            {
                throw new ArgumentNullException(nameof(trk));
            }
            var result = new SegmentSource();
            var i      = 0;

            foreach (var elements in trk.Select(item => item.Elements()
                                                .Where(x => x.Name.LocalName
                                                       .ToLower()
                                                       .Equals(Trkseg))))
            {
                result.Add(i, elements);
                i++;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static Segments SegmentSourceToSegments(this SegmentSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            var segments = new Segments();

            foreach (var item in source)
            {
                var key = item.Key;
                var val = item.Value;
                var l   = new List <IRoutePoint>();
                foreach (var v in val)
                {
                    var point = v.ToRoutePoint();
                    l.Add(point);
                }
                segments.Add(key, l);
            }
            return(segments);
        }