Esempio n. 1
0
        private void AddTransitionIfNeeded(
            TerminalProcedureName sidTrans,
            SidEntry rwySpecificPart,
            ref bool endsWithVector,
            SidEntry commonPart,
            List <Waypoint> wpts)
        {
            if (sidTrans.TransitionName != "")
            {
                // There is transition
                var transitionPart = GetSid(sidTrans.ProcedureName, sidTrans.TransitionName);

                if (transitionPart == null)
                {
                    throw new SidNotFoundException();
                }

                // The last wpt of (runway specific + common part) should
                // be the same as the first one of the transition part.
                wpts.TryRemoveLast();
                wpts.AddRange(transitionPart.Waypoints);
                endsWithVector = transitionPart.EndWithVector;
            }
            else if (rwySpecificPart == null && commonPart == null)
            {
                // No transition, both part are null
                throw new SidNotFoundException();
            }
        }
Esempio n. 2
0
        private bool AddTransitionIfNeeded(
            TerminalProcedureName starTrans, List <Waypoint> wpts)
        {
            if (starTrans.TransitionName != "")
            {
                // There is transition
                var transitionPart = GetStar(
                    starTrans.ProcedureName, starTrans.TransitionName);

                if (transitionPart == null)
                {
                    throw new StarNotFoundException();
                }

                wpts.AddRange(transitionPart.Waypoints);
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public SidWaypoints SidWaypoints(
            string sid, string rwy, Waypoint origRwy)
        {
            var sidTrans = new TerminalProcedureName(sid);

            var rwySpecificPart = GetSid(sidTrans.ProcedureName, rwy);
            var commonPart      = GetSid(sidTrans.ProcedureName);

            bool endsWithVector = false;
            var  wpts           = new List <Waypoint>();

            wpts.Add(origRwy);

            // May be null.
            if (rwySpecificPart != null)
            {
                wpts.AddRange(rwySpecificPart.Waypoints);
                endsWithVector = rwySpecificPart.EndWithVector;
            }

            if (commonPart != null)
            {
                // The last wpt of runway specific part should be
                // the same as the first one of the common part.
                wpts.TryRemoveLast();
                wpts.AddRange(commonPart.Waypoints);
                endsWithVector = commonPart.EndWithVector;
            }

            AddTransitionIfNeeded(
                sidTrans,
                rwySpecificPart,
                ref endsWithVector,
                commonPart,
                wpts);

            return(new SidWaypoints(wpts, endsWithVector));
        }
Esempio n. 4
0
        public IReadOnlyList <Waypoint> StarWaypoints(
            string star, string rwy, Waypoint destRwy)
        {
            var starTrans = new TerminalProcedureName(star);

            var rwySpecificPart = GetStar(starTrans.ProcedureName, rwy);
            var commonPart      = GetStar(starTrans.ProcedureName);

            var  wpts       = new List <Waypoint>();
            bool addedTrans = AddTransitionIfNeeded(starTrans, wpts);

            if (commonPart != null)
            {
                // The last wpt of runway specific part should be the
                // same as the first one of the common part.
                wpts.TryRemoveLast();
                wpts.AddRange(commonPart.Waypoints);
            }

            if (rwySpecificPart != null)
            {
                wpts.TryRemoveLast();
                wpts.AddRange(rwySpecificPart.Waypoints);
            }
            else
            {
                if (commonPart == null && addedTrans == false)
                {
                    throw new StarNotFoundException();
                }
            }

            wpts.Add(destRwy);

            return(wpts);
        }