Esempio n. 1
0
 /// <summary>
 /// Tests if the given turn is significant.
 /// </summary>
 /// <param name="test"></param>
 /// <param name="machine"></param>
 /// <returns></returns>
 private static bool TestNonSignificantTurnNonPoi(FiniteStateMachine <MicroPlannerMessage> machine, object test)
 {
     if (!PoiWithTurnMachine.TestPoi(machine, test))
     {
         if (test is MicroPlannerMessagePoint)
         {
             MicroPlannerMessagePoint point = (test as MicroPlannerMessagePoint);
             if (point.Point.Angle != null)
             {
                 if (point.Point.ArcsNotTaken == null || point.Point.ArcsNotTaken.Count == 0)
                 {
                     return(true);
                 }
                 switch (point.Point.Angle.Direction)
                 {
                 case OsmSharp.Math.Geo.Meta.RelativeDirectionEnum.StraightOn:
                 case RelativeDirectionEnum.SlightlyLeft:
                 case RelativeDirectionEnum.SlightlyRight:
                     return(true);
                 }
             }
         }
         return(false);
     }
     return(false);
 }
Esempio n. 2
0
        /// <summary>
        /// Tests if the given turn is significant.
        /// </summary>
        /// <param name="machine"></param>
        /// <param name="test"></param>
        /// <returns></returns>
        private static bool TestSignificantTurn(FiniteStateMachine <MicroPlannerMessage> machine, object test)
        {
            if (test is MicroPlannerMessagePoint)
            {
                MicroPlannerMessagePoint point = (test as MicroPlannerMessagePoint);
                if (point.Point.Angle != null)
                {
                    if (point.Point.ArcsNotTaken == null || point.Point.ArcsNotTaken.Count == 0)
                    {
                        return(false);
                    }
                    switch (point.Point.Angle.Direction)
                    {
                    case RelativeDirectionEnum.SlightlyLeft:
                    case RelativeDirectionEnum.SlightlyRight:
                        // test to see if is needed to generate instruction.
                        // if there is no other straight on
                        int straight_count = MicroPlannerHelper.GetStraightOn(point, (machine as MicroPlannerMachine).Planner.Interpreter);
                        if (straight_count > 0)
                        {
                            return(true);
                        }
                        return(false);

                    case OsmSharp.Math.Geo.Meta.RelativeDirectionEnum.StraightOn:
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
0
 /// <summary>
 /// Tests if the given point is a poi.
 /// </summary>
 /// <param name="test"></param>
 /// <param name="machine"></param>
 /// <returns></returns>
 private static bool TestPoi(FiniteStateMachine <MicroPlannerMessage> machine, object test)
 {
     if (test is MicroPlannerMessagePoint)
     {
         MicroPlannerMessagePoint point = (test as MicroPlannerMessagePoint);
         if (point.Point.Points != null && point.Point.Points.Count > 0)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
 /// <summary>
 /// Tests if the given turn is a turn out of a roundabout.
 /// </summary>
 /// <param name="machine"></param>
 /// <param name="test"></param>
 /// <returns></returns>
 private static bool TestRoundaboutExit(FiniteStateMachine <MicroPlannerMessage> machine, object test)
 {
     if (test is MicroPlannerMessagePoint)
     {
         MicroPlannerMessagePoint point = (test as MicroPlannerMessagePoint);
         if (point.Point.Next != null)
         {
             if ((machine as MicroPlannerMachine).Planner.Interpreter.EdgeInterpreter.IsRoundabout(point.Point.Next.Tags))
             {
                 return(true);
             }
         }
     }
     return(false);
 }