public static bool IsAroundPosition(double currentLat, double currentLon, double poslat, double poslon, double iRadius_metre) { bool bRes = true; DistanceLatLonKm_Utils.MapPoint position = new DistanceLatLonKm_Utils.MapPoint { Latitude = poslat, Longitude = poslon }; DistanceLatLonKm_Utils.BoundingBox boundingBox = DistanceLatLonKm_Utils.GetBoundingBox(position, iRadius_metre); if (currentLon < boundingBox.MinPoint.Longitude || currentLon > boundingBox.MaxPoint.Longitude) { bRes = false; } if (currentLat < boundingBox.MinPoint.Latitude || currentLat > boundingBox.MaxPoint.Latitude) { bRes = false; } return(bRes); }
public static bool IsInIncludedInSearchZone(double currentLat, double currentLon, double SearchZone_TopRight_Lat, double SearchZone_TopRight_Lon, double SearchZone_BottomLeft_Lat, double SearchZone_BottomLeft_Lon) { bool bRes = false; DistanceLatLonKm_Utils.MapPoint TopRight = new DistanceLatLonKm_Utils.MapPoint { Latitude = SearchZone_TopRight_Lat, Longitude = SearchZone_TopRight_Lon }; DistanceLatLonKm_Utils.MapPoint BottomLeft = new DistanceLatLonKm_Utils.MapPoint { Latitude = SearchZone_BottomLeft_Lat, Longitude = SearchZone_BottomLeft_Lon }; DistanceLatLonKm_Utils.BoundingBox boundingBox = new DistanceLatLonKm_Utils.BoundingBox { MinPoint = BottomLeft, MaxPoint = TopRight }; if (currentLat < boundingBox.MaxPoint.Latitude && currentLon < boundingBox.MaxPoint.Longitude && currentLat > boundingBox.MinPoint.Latitude || currentLon > boundingBox.MinPoint.Longitude) { bRes = true; } return(bRes); }