Esempio n. 1
0
        /// <summary>
        /// Gets a custom factor for the given tags.
        /// </summary>
        private static Func <IAttributeCollection, Factor> InternalGetFactor(Pedestrian pedestrian)
        {
            var getSpeedDefault = pedestrian.GetGetSpeed();

            return((tags) =>
            {
                if (tags == null)
                {
                    return new Itinero.Profiles.Factor()
                    {
                        Direction = 0,
                        Value = 0
                    };
                }

                string shortcuts;
                if (tags.TryGetValue("shortcut", out shortcuts) &&
                    !string.IsNullOrEmpty(shortcuts))
                {
                    return new Factor()
                    {
                        Value = 1.0f,
                        Direction = 1
                    };
                }

                var speed = getSpeedDefault(tags);

                if (speed.Value == 0)
                {
                    return new Itinero.Profiles.Factor()
                    {
                        Direction = 0,
                        Value = 0
                    };
                }

                return new Factor()
                {
                    Value = 1.0f / speed.Value,
                    Direction = speed.Direction
                };
            });
        }
Esempio n. 2
0
 internal PedestrianShortcuts(Pedestrian pedestrian)
     : base(pedestrian.UniqueName + ".Shortcuts", pedestrian.GetGetSpeed(), pedestrian.GetGetMinSpeed(),
            pedestrian.GetCanStop(), pedestrian.GetEquals(), pedestrian.VehicleTypes, InternalGetFactor(pedestrian), ProfileMetric.TimeInSeconds)
 {
 }