Пример #1
0
        public void FindTest()
        {
            var searcher = new LatLonSearcher <Waypoint>(5, 10);
            var allPts   = new List <Waypoint>();

            for (int i = -90; i <= 90; i++)
            {
                for (int j = -180; j <= 180; j++)
                {
                    var wpt = new Waypoint("", i, j);
                    allPts.Add(wpt);
                }
            }

            foreach (var k in allPts)
            {
                searcher.Add(k);
            }

            var result      = searcher.Find(75.0, 120.0, 1000.0);
            var expectation = Expected(allPts);

            Assert.AreEqual(expectation.Count, result.Count);

            foreach (var m in result)
            {
                Assert.IsTrue(expectation.Contains(m));
            }
        }
Пример #2
0
        public void RemoveTest()
        {
            var searcher    = new LatLonSearcher <Waypoint>(5, 10);
            var wptToRemove = new Waypoint("", -55.0, 100.0);

            for (int i = -90; i <= 90; i++)
            {
                for (int j = -180; j <= 180; j++)
                {
                    if (i == -55 && j == 100)
                    {
                        searcher.Add(wptToRemove);
                    }
                    else
                    {
                        searcher.Add(new Waypoint("", i, j));
                    }
                }
            }

            searcher.Remove(wptToRemove);

            var result = searcher.Find(-55.0, 100.0, 300.0);

            Assert.IsFalse(result.Contains(wptToRemove));
        }
Пример #3
0
 private void GenerateSearchGrids()
 {
     airportFinder = new LatLonSearcher <Airport>(GridSizeOption.Small);
     foreach (var i in airportData.Values)
     {
         airportFinder.Add(i);
     }
 }
Пример #4
0
        public RandomRouteFinder(IEnumerable <Waypoint> candidates, int gridSize, int polarRegSize)
        {
            searcher = new LatLonSearcher <Waypoint>(gridSize, polarRegSize);

            foreach (var i in candidates)
            {
                searcher.Add(i);
            }
        }
Пример #5
0
 public WaypointList()
 {
     _content = new WaypointContainer();
     _finder  = new LatLonSearcher <WptSeachWrapper>(1, 5);
 }