//------------------------------------------------------------------------------ internal string GetAuditString(bool reset) { string s = AuditString.ToString(); if (reset) { AuditString.Length = 0; } return(s); }
protected void GeoReferenceForPoly(List <LatLong> rgll, string szCountry, string szAdmin) { if (rgll == null) { throw new ArgumentNullException(nameof(rgll)); } if (szCountry == null) { throw new ArgumentNullException(nameof(szCountry)); } if (!rgll.Any()) { throw new InvalidOperationException("No latitude/longitudes in rgll!"); } // Get the bounding box. LatLongBox llb = new LatLongBox(rgll.First()); foreach (LatLong ll in rgll) { llb.ExpandToInclude(ll); } IEnumerable <airport> rgap = AdminAirport.UntaggedAirportsInBox(llb); GeoRegion geo = new GeoRegion(string.Empty, rgll); int cAirports = 0; foreach (AdminAirport ap in rgap) { if (geo.ContainsLocation(ap.LatLong)) { UpdateString.AppendLine(String.Format(CultureInfo.InvariantCulture, "UPDATE airports SET Country='{0}' {1} WHERE type='{2}' AND airportID='{3}';", szCountry, String.IsNullOrWhiteSpace(szAdmin) ? string.Empty : String.Format(CultureInfo.InvariantCulture, ", admin1 = '{0}' ", szAdmin), ap.FacilityTypeCode, ap.Code)); ap.SetLocale(szCountry, szAdmin); cAirports++; } } if (cAirports > 0) { AuditString.AppendLine(String.Format(CultureInfo.CurrentCulture, "Updated {0} airports for country {1}, region {2}", cAirports, szCountry, szAdmin)); } }