示例#1
0
        public void CanAvoidCountry()
        {
            var w1 = new Waypoint("1", 0.0, 1.0);
            var w2 = new Waypoint("2", 0.0, 2.0, 0);
            var w3 = new Waypoint("3", 5.0, 2.0, 1);
            var w4 = new Waypoint("4", 0.0, 3.0);

            var wptList = GetWptList(w1, w2, w3, w4);
            int i1      = wptList.FindByWaypoint(w1);
            int i2      = wptList.FindByWaypoint(w2);
            int i3      = wptList.FindByWaypoint(w3);
            int i4      = wptList.FindByWaypoint(w4);

            wptList.AddNeighbor(i1, "12", i2);
            wptList.AddNeighbor(i1, "13", i3);
            wptList.AddNeighbor(i2, "24", i4);
            wptList.AddNeighbor(i3, "34", i4);

            var avoid = new CountryCodeCollection(new[] { 0 });
            var route = new RouteFinder(wptList, avoid).FindRoute(i1, i4);

            var expected = GetRoute(
                w1, "13", -1.0,
                w3, "34", -1.0,
                w4);

            Assert.IsTrue(expected.Equals(route));
        }
示例#2
0
 public RouteFinder(
     WaypointList wptList,
     CountryCodeCollection avoidedCountry = null,
     AvgWindCalculator windCalc           = null)
 {
     this.wptList        = wptList;
     this.avoidedCountry = avoidedCountry ?? new CountryCodeCollection();
     this.windCalc       = windCalc;
 }
示例#3
0
 public RouteFinderFacade(
     WaypointList wptList,
     AirportManager airportList,
     string navDataLocation = null,
     CountryCodeCollection avoidedCountry = null,
     AvgWindCalculator windCalc           = null)
 {
     this.wptList         = wptList;
     this.airportList     = airportList;
     this.navDataLocation = navDataLocation;
     finder = new RouteFinder(wptList, avoidedCountry, windCalc);
 }