示例#1
0
 protected override void OnTextUpdate(EventArgs e)
 {
     base.OnTextUpdate(e);
     // set the location value
     if (MaidenheadLocator.Check(this.Text))
     {
         if (this.Text.Length >= 6)
         {
             GeoLocation = MaidenheadLocator.GPointFromLoc(this.Text);
         }
         else
         {
             geolocation = MaidenheadLocator.GPointFromLoc(this.Text);
         }
     }
     else
     {
         GeoLocation = null;
     }
     itemchanged     = false;
     locationchanged = false;
 }
示例#2
0
 /// <summary>
 /// Gives the bounds of a 'Maidenhead Locator' (latitudes and longitudes, in degrees).
 /// </summary>
 /// <param name="maidenheadLocator">The 'Maidenhead Locator'.</param>
 /// <returns>The geographical bounds as LatLon.GRect.</returns>
 /// <exception cref="ArgumentException">
 /// If the length of the locator text is null or not an even number.
 /// If the locator text contains invalid characters.
 /// </exception>
 /// <summary>
 public static LatLon.GRect BoundsFromLoc(string maidenheadLocator)
 {
     LatLon.GPoint gmin = GPointFromLoc(maidenheadLocator, PositionInRectangle.BottomLeft);
     LatLon.GPoint gmax = GPointFromLoc(maidenheadLocator, PositionInRectangle.TopRight);
     return(new LatLon.GRect(gmin.Lat, gmin.Lon, gmax.Lat, gmax.Lon));
 }