public NavStackNode(string type, string subtype, CoordinateDto location, int floor, int toFloor)
 {
     this.type = type;
     this.subtype = subtype;
     this.location = location;
     this.floor = floor;
     this.toFloor = toFloor;
 }
        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;
        }
        /// <summary>
        /// Add the next coordinate to the path and get the turn code that it took to get there:
        /// 
        ///    -2 = right 90 deg
        ///    -1 = right 45 deg
        ///     0 = straight (no change in vector)
        ///     1 = left 45 deg
        ///     2 = left 90 deg
        /// 
        /// </summary>
        /// <param name="newCoordiante"></param>
        /// <returns></returns>
        public string getNext(CoordinateDto newCoordiante)
        {
            int deltaX = newCoordiante.X - _lastCoordinate.X;
            int deltaY = newCoordiante.Y - _lastCoordinate.Y;
            _lastCoordinate = newCoordiante;

            string key = deltaX + "" + deltaY;

            // if we did not have to turn to get this coordinate, return 0
            if (key.Equals(_turns[_currentIndex]))
            {
                return NavStackNode.TYPE_STRAIGHT;
            }

            // look to the right and to the left of our last position by one
            // until we find the new one
            for (int i = 1; i < _turns.Count(); i++)
            {
                int right = wrapIndex(_currentIndex + i);
                int left = wrapIndex(_currentIndex - i);

                if (key.Equals(_turns[right]))
                {
                    _currentIndex = right;
                    return i == 1 ? NavStackNode.TYPE_ANGLE_LEFT : NavStackNode.TYPE_LEFT;
                }

                if (key.Equals(_turns[left]))
                {
                    _currentIndex = left;
                    return i == 1 ? NavStackNode.TYPE_ANGLE_RIGHT : NavStackNode.TYPE_RIGHT;
                }
            }

            return NavStackNode.TYPE_STRAIGHT;
        }
 /// <summary>
 /// Constructs a new TurnWheel and initializes the vector form the first two points
 /// </summary>
 /// <param name="c1"></param>
 /// <param name="c2"></param>
 public TurnWheel(CoordinateDto c1, CoordinateDto c2)
 {
     _lastCoordinate = c1;
     getNext(c2);
 }
        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;
        }
 private double distance(CoordinateDto c1, CoordinateDto c2)
 {
     return Math.Sqrt(Math.Pow(c1.X - c2.X, 2) + Math.Pow(c1.Y - c2.Y, 2));
 }