public GeoPoint(float lat, float lon, float alt, GeoCalculator.DistanceUnits altUnit = GeoCalculator.DistanceUnits.Kilofeet) { _lat = lat; _lon = lon; switch (altUnit) { case GeoCalculator.DistanceUnits.Feet: this._alt = (float)GeoCalculator.ConvertDistanceUnit(alt, GeoCalculator.DistanceUnits.Feet, GeoCalculator.DistanceUnits.Degrees); break; case GeoCalculator.DistanceUnits.Kilofeet: this._alt = (float)GeoCalculator.ConvertDistanceUnit(alt, GeoCalculator.DistanceUnits.Kilofeet, GeoCalculator.DistanceUnits.Degrees); break; case GeoCalculator.DistanceUnits.NauticalMiles: this._alt = (float)GeoCalculator.ConvertDistanceUnit(alt, GeoCalculator.DistanceUnits.NauticalMiles, GeoCalculator.DistanceUnits.Degrees); break; case GeoCalculator.DistanceUnits.Degrees: this._alt = alt; break; case GeoCalculator.DistanceUnits.Meters: this._alt = (float)GeoCalculator.ConvertDistanceUnit(alt, GeoCalculator.DistanceUnits.Meters, GeoCalculator.DistanceUnits.Degrees); break; default: throw new FormatException("Geopoint could not be constructed with the given Distance Units input"); } }
public string ToString(string format, IFormatProvider formatProvider) { switch (format) { case "0.0": return(String.Format("({0}, {1}, {2})", Lat, Lon, GeoCalculator.ConvertDistanceUnit(Alt, GeoCalculator.DistanceUnits.Degrees, GeoCalculator.DistanceUnits.Kilofeet).ToString("0.0"))); default: return(this.ToString()); break; } }
public override string ToString() { return(String.Format("Degree: {0}, Degree: {1}, KFT: {2}", Lat, Lon, GeoCalculator.ConvertDistanceUnit(Alt, GeoCalculator.DistanceUnits.Degrees, GeoCalculator.DistanceUnits.Kilofeet))); }