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)); } }
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)); }
private List <Waypoint> GetCandidates(Waypoint start, Waypoint end) { var startVector = start.ToVector3D(); var endVector = end.ToVector3D(); var tangent = EarthGeometry.GetW(startVector, endVector); var maxDisVector = (startVector + Tan(MaxAngleRadian) * tangent) .Normalize(); var midPoint = (startVector + maxDisVector) * 0.5; var pt = midPoint.ToLatLon(); var smallRegion = searcher.Find(pt.Lat, pt.Lon, MaxLegDis * 0.5); if (smallRegion.Count > 0) { return(smallRegion); } return(searcher.Find(start.Lat, start.Lon, MaxLegDis)); }
public List <Airport> Find(double lat, double lon, double distance) { return(airportFinder.Find(lat, lon, distance)); }
public List <WptSeachWrapper> Find(double lat, double lon, double distance) { return(_finder.Find(lat, lon, distance)); }