コード例 #1
0
 public void AddItem(string route, TurnWay way)
 {
     this.RouteWay.Add(new TurnWayInfo()
     {
         RouteCode = route, Way = way
     });
 }
コード例 #2
0
        /// <summary>
        /// 根据转向获取当前朝向
        /// </summary>
        /// <param name="fromWay"></param>
        /// <param name="turnWay"></param>
        /// <returns></returns>
        public DirectionWay getDirection(DirectionWay fromWay, TurnWay turnWay)
        {
            if (turnWay == TurnWay.Next)
            {
                return(fromWay);
            }
            if (fromWay == DirectionWay.Easet)
            {
                switch (turnWay)
                {
                case TurnWay.Left: return(DirectionWay.North);

                case TurnWay.Right: return(DirectionWay.South);

                case TurnWay.Back: return(DirectionWay.West);
                }
            }
            else if (fromWay == DirectionWay.South)
            {
                switch (turnWay)
                {
                case TurnWay.Left: return(DirectionWay.Easet);

                case TurnWay.Right: return(DirectionWay.West);

                case TurnWay.Back: return(DirectionWay.North);
                }
            }
            else if (fromWay == DirectionWay.West)
            {
                switch (turnWay)
                {
                case TurnWay.Left: return(DirectionWay.South);

                case TurnWay.Right: return(DirectionWay.North);

                case TurnWay.Back: return(DirectionWay.Easet);
                }
            }
            else if (fromWay == DirectionWay.North)
            {
                switch (turnWay)
                {
                case TurnWay.Left: return(DirectionWay.West);

                case TurnWay.Right: return(DirectionWay.Easet);

                case TurnWay.Back: return(DirectionWay.South);
                }
            }
            return(DirectionWay.None);
        }
コード例 #3
0
        private string getTurnwayMap(TurnWay way)
        {
            switch (way)
            {
            case TurnWay.Stop: return("05");

            case TurnWay.Next: return("01");

            case TurnWay.Right: return("02");

            case TurnWay.Back: return("03");

            case TurnWay.Left: return("04");
            }
            return("05");
        }