예제 #1
0
        public static int GetLeft(IList <MicroPlannerMessage> messages, IRoutingInterpreter interpreter)
        {
            int left = 0;

            foreach (MicroPlannerMessage message in messages)
            {
                if (message is MicroPlannerMessagePoint)
                {
                    MicroPlannerMessagePoint point = (message as MicroPlannerMessagePoint);
                    left = left + MicroPlannerHelper.GetLeft(point, interpreter);
                }
            }
            return(left);
        }
예제 #2
0
        public static int GetStraightOn(IList <MicroPlannerMessage> messages, IRoutingInterpreter interpreter)
        {
            int straight = 0;

            foreach (MicroPlannerMessage message in messages)
            {
                if (message is MicroPlannerMessagePoint)
                {
                    MicroPlannerMessagePoint point = (message as MicroPlannerMessagePoint);
                    straight = straight + MicroPlannerHelper.GetStraightOn(point, interpreter);
                }
            }
            return(straight);
        }
예제 #3
0
 public static int GetRight(MicroPlannerMessagePoint point, IRoutingInterpreter interpreter)
 {
     int right = 0;
     if (point.Point.ArcsNotTaken != null)
     {
         foreach (KeyValuePair<RelativeDirection, AggregatedArc> arc_pair in point.Point.ArcsNotTaken)
         {
             if (MicroPlannerHelper.IsRight(arc_pair.Key.Direction, interpreter))
             {
                 if (interpreter.EdgeInterpreter.IsRoutable(arc_pair.Value.Tags))
                 {
                     right++;
                 }
             }
         }
     }
     return right;
 }
예제 #4
0
 public static int GetLeft(MicroPlannerMessagePoint point, IRoutingInterpreter interpreter)
 {
     int left = 0;
     if (point.Point.ArcsNotTaken != null)
     {
         foreach (KeyValuePair<RelativeDirection, AggregatedArc> arc_pair in point.Point.ArcsNotTaken)
         {
             if (MicroPlannerHelper.IsLeft(arc_pair.Key.Direction, interpreter))
             {
                 if (interpreter.EdgeInterpreter.IsRoutable(arc_pair.Value.Tags.ConvertToDictionary()))
                 {
                     left++;
                 }
             }
         }
     }
     return left;
 }
예제 #5
0
        public static int GetStraightOn(MicroPlannerMessagePoint point, IRoutingInterpreter interpreter)
        {
            int straight = 0;

            if (point.Point.ArcsNotTaken != null)
            {
                foreach (KeyValuePair <RelativeDirection, AggregatedArc> arc_pair in point.Point.ArcsNotTaken)
                {
                    if (!MicroPlannerHelper.IsTurn(arc_pair.Key.Direction, interpreter))
                    {
                        if (interpreter.EdgeInterpreter.IsRoutable(arc_pair.Value.Tags))
                        {
                            straight++;
                        }
                    }
                }
            }
            return(straight);
        }
예제 #6
0
        /// <summary>
        /// Creates and plans a new message.
        /// </summary>
        /// <param name="aggregated"></param>
        private void PlanNewMessage(Aggregated aggregated)
        {
            // create the message.
            MicroPlannerMessage message = null;

            if (aggregated is AggregatedPoint)
            {
                MicroPlannerMessagePoint point = new MicroPlannerMessagePoint();
                point.Point = aggregated as AggregatedPoint;

                message = point;
            }
            else if (aggregated is AggregatedArc)
            {
                MicroPlannerMessageArc arc = new MicroPlannerMessageArc();
                arc.Arc = aggregated as AggregatedArc;

                message = arc;
            }

            // plan the message.
            this.Plan(message);
        }
예제 #7
0
        /// <summary>
        /// Creates and plans a new message.
        /// </summary>
        /// <param name="aggregated"></param>
        private void PlanNewMessage(Aggregated aggregated)
        {
            // create the message.
            MicroPlannerMessage message = null;
            if (aggregated is AggregatedPoint)
            {
                MicroPlannerMessagePoint point = new MicroPlannerMessagePoint();
                point.Point = aggregated as AggregatedPoint;

                message = point;
            }
            else if (aggregated is AggregatedArc)
            {
                MicroPlannerMessageArc arc = new MicroPlannerMessageArc();
                arc.Arc = aggregated as AggregatedArc;

                message = arc;
            }

            // plan the message.
            this.Plan(message);
        }