Example #1
0
 internal Func <TagsCollectionBase, OsmSharp.Routing.Profiles.Speed> GetGetSpeed()
 {
     return((Func <TagsCollectionBase, OsmSharp.Routing.Profiles.Speed>)(tags =>
     {
         if (!this.CanTraverse(tags))
         {
             return OsmSharp.Routing.Profiles.Speed.NoSpeed;
         }
         OsmSharp.Routing.Profiles.Speed speed = new OsmSharp.Routing.Profiles.Speed()
         {
             Value = (float)this.ProbableSpeed(tags).Value / 3.6f,
             Direction = 0
         };
         bool?nullable = this.IsOneWay(tags);
         if (nullable.HasValue)
         {
             speed.Direction = !nullable.Value ? (short)2 : (short)1;
         }
         return speed;
     }));
 }
Example #2
0
        internal Func <TagsCollectionBase, Factor> GetGetFactor()
        {
            Func <TagsCollectionBase, OsmSharp.Routing.Profiles.Speed> getSpeed = this.GetGetSpeed();

            return((Func <TagsCollectionBase, Factor>)(tags =>
            {
                OsmSharp.Routing.Profiles.Speed speed = getSpeed(tags);
                if ((double)speed.Value == 0.0)
                {
                    return new Factor()
                    {
                        Value = 0.0f,
                        Direction = 0
                    }
                }
                ;
                return new Factor()
                {
                    Value = 1f / speed.Value,
                    Direction = speed.Direction
                };
            }));
        }