Example #1
0
        /// <summary>
        /// Дает координату на линии по проехавшему от начала перегона пути
        /// </summary>
        /// <param name="space"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">Thrown when the arguments are <see langword="null"/></exception>
        /// <exception cref="ArgumentOutOfRangeException">Condition.</exception>
        /// <exception cref="InvalidOperationException">Исходная последовательность пуста.</exception>
        public override Double GetLimit(Double space)
        {
            var limit = Limits.FirstOrDefault(item => item.Space >= space);

            if (limit == null)
            {
                throw new ArgumentOutOfRangeException(nameof(space));
            }

            var tmpPiketage = limit.Value;
            var direction   = Limits.First() < Limits.Last();

            var deltaSpace = space - limit.Space;

            return(direction ? tmpPiketage + deltaSpace / 100 : tmpPiketage - deltaSpace / 100);
        }
        public LimitLevel GetLimitLevel(LimitType limitType, FeatureType featureType, CycleType cycleType, LevelType levelType)
        {
            var limit = Limits.FirstOrDefault(l => l.Type == limitType && l.FeatureType == featureType);

            if (limit is null)
            {
                return(null);
            }

            var cycle = limit.Cycles.FirstOrDefault(c => c.Type == cycleType);

            if (cycle is null)
            {
                return(null);
            }

            return(cycle.LimitLevels.FirstOrDefault(l => l.Type == levelType));
        }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="head"></param>
 /// <returns></returns>
 public Limit GetFirstLimit(Double head)
 {
     return(Limits.FirstOrDefault(s => s.Space >= head));
 }