Пример #1
0
        public RouteDto addOutdoorTransisiton(NavType type, CoordinateDto location, int floor)
        {
            string subtype = NavStackNode.TYPE_WALKING;

            switch (type)
            {
                case NavType.walking:
                    subtype = NavStackNode.TYPE_WALKING;
                    break;
            }

            var vert = new NavStackNode(NavStackNode.TYPE_OUTDOOR, subtype, location, floor, 0);
            navStack.Add(vert);

            return this;
        }
Пример #2
0
        public RouteDto addVerticalTransisiton(NavType type, CoordinateDto location, int floor, int toFloor)
        {
            string subtype = "";

            string direction = (floor - toFloor) > 0 ? "-down" : "-up";

            switch (type)
            {
                case NavType.stair:
                    subtype = NavStackNode.TYPE_STAIRS;
                    break;
                case NavType.elevator:
                    subtype = NavStackNode.TYPE_ELEVATOR;
                    break;
                case NavType.escalator:
                    subtype = NavStackNode.TYPE_ESCALATOR;
                    break;
            }

            subtype += (floor - toFloor) > 0 ? "-down" : "-up";

            NavStackNode vert = new NavStackNode(NavStackNode.TYPE_VERTICAL, subtype, location, floor, toFloor);
            navStack.Add(vert);

            return this;
        }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node1"></param>
        /// <param name="node2"></param>
        /// <returns></returns>
        private NavStackNode mergeTurns(NavStackNode node1, NavStackNode node2)
        {
            string type = NavStackNode.TYPE_PATH;
            CoordinateDto location = node1.location;
            int floor = node1.floor;
            int toFloor = node1.toFloor;

            if (node1.subtype.Equals(node2.subtype))
            {
                if (node1.subtype.Equals(NavStackNode.TYPE_ANGLE_LEFT))
                {
                    return new NavStackNode(type, NavStackNode.TYPE_LEFT, location, floor, toFloor);
                }
                else if (node1.subtype.Equals(NavStackNode.TYPE_ANGLE_RIGHT))
                {
                    return new NavStackNode(type, NavStackNode.TYPE_RIGHT, location, floor, toFloor);
                }
            }

            // TODO: THis should not necessarily be the default
            return node1;
        }
Пример #4
0
        /// <summary>
        /// Takes a congruent path and interprets where navStack events should take place. i.g. "left at x, y"
        /// </summary>
        /// <param name="floor"></param>
        /// <param name="path"></param>
        private void addPathToNavStack(int floor, List<CoordinateDto> path)
        {
            // paths should not be length 1, but just in case
            if (path.Count <= 2)
            {
                return;
            }

            // initialize the turn-wheel witht the first two points
            TurnWheel wheel = new TurnWheel(path[0], path[1]);

            // initialize an empty list to temporarily hold our new nav items
            List<NavStackNode> list = new List<NavStackNode>();

            for (int i = 2; i < path.Count; i++)
            {
                string turnType = wheel.getNext(path[i]);
                if (!turnType.Equals(NavStackNode.TYPE_STRAIGHT))
                {
                    NavStackNode navItem = new NavStackNode(NavStackNode.TYPE_PATH, turnType, path[i], floor, 0);
                    list.Add(navItem);
                }
            }

            // two angle-lefts in a row close to eachother should probably be a hard-right. let's condense things like that
            condenseTurns(list);

            // put our temporary list items into the navStack
            navStack.AddRange(list);
        }